diff --git a/src/avkit.cs b/src/avkit.cs index 5ac8802e44a0..ca654b8a0af1 100644 --- a/src/avkit.cs +++ b/src/avkit.cs @@ -1135,27 +1135,4 @@ interface AVPlaybackSpeed { [Export ("localizedNumericName")] string LocalizedNumericName { get; } } - - delegate void AVCustomRoutingControllerDelegateCompletionHandler (bool success); - - interface IAVCustomRoutingControllerDelegate { } - - [NoWatch, NoTV, NoMac, iOS (16, 0), MacCatalyst (16, 0)] -#if NET - [Protocol, Model] -#else - [Protocol, Model (AutoGeneratedName = true)] -#endif - [BaseType (typeof (NSObject))] - interface AVCustomRoutingControllerDelegate { - [Abstract] - [Export ("customRoutingController:handleEvent:completionHandler:")] - void HandleEvent (AVCustomRoutingController controller, AVCustomRoutingEvent @event, AVCustomRoutingControllerDelegateCompletionHandler completionHandler); - - [Export ("customRoutingController:eventDidTimeOut:")] - void EventDidTimeOut (AVCustomRoutingController controller, AVCustomRoutingEvent @event); - - [Export ("customRoutingController:didSelectItem:")] - void DidSelectItem (AVCustomRoutingController controller, AVCustomRoutingActionItem customActionItem); - } } diff --git a/src/avrouting.cs b/src/avrouting.cs index 7ca0c4763cd6..b31fcaee1635 100644 --- a/src/avrouting.cs +++ b/src/avrouting.cs @@ -99,6 +99,42 @@ interface AVCustomRoutingController { NSString AuthorizedRoutesDidChangeNotification { get; } } + // The AVCustomRoutingControllerDelegate type was incorrectly placed in the AVKit framework. +#if !XAMCORE_5_0 +} +namespace AVKit { + using AVRouting; +#endif + + delegate void AVCustomRoutingControllerDelegateCompletionHandler (bool success); + + interface IAVCustomRoutingControllerDelegate { } + + [NoWatch, NoTV, NoMac, iOS (16, 0), MacCatalyst (16, 0)] +#if NET + [Protocol, Model] +#else + [Protocol, Model (AutoGeneratedName = true)] +#endif + [BaseType (typeof (NSObject))] + interface AVCustomRoutingControllerDelegate { + [Abstract] + [Export ("customRoutingController:handleEvent:completionHandler:")] + void HandleEvent (AVCustomRoutingController controller, AVCustomRoutingEvent @event, AVCustomRoutingControllerDelegateCompletionHandler completionHandler); + + [Export ("customRoutingController:eventDidTimeOut:")] + void EventDidTimeOut (AVCustomRoutingController controller, AVCustomRoutingEvent @event); + + [Export ("customRoutingController:didSelectItem:")] + void DidSelectItem (AVCustomRoutingController controller, AVCustomRoutingActionItem customActionItem); + } + +#if !XAMCORE_5_0 +} +namespace AVRouting { +#endif + + [NoWatch, NoTV, NoMac, iOS (16, 0), MacCatalyst (16, 0)] [BaseType (typeof (NSObject))] interface AVCustomRoutingEvent { diff --git a/tools/common/Frameworks.cs b/tools/common/Frameworks.cs index b73f53206883..06aaae243cf4 100644 --- a/tools/common/Frameworks.cs +++ b/tools/common/Frameworks.cs @@ -736,9 +736,16 @@ static void Gather (Application app, AssemblyDefinition product_assembly, HashSe var namespaces = new HashSet (); // Collect all the namespaces. - foreach (ModuleDefinition md in product_assembly.Modules) - foreach (TypeDefinition td in md.Types) + foreach (ModuleDefinition md in product_assembly.Modules) { + foreach (TypeDefinition td in md.Types) { +#if !XAMCORE_5_0 + // AVCustomRoutingControllerDelegate was incorrectly placed in AVKit + if (td.Namespace == "AVKit" && td.Name == "AVCustomRoutingControllerDelegate") + namespaces.Add ("AVRouting"); +#endif namespaces.Add (td.Namespace); + } + } // Iterate over all the namespaces and check which frameworks we need to link with. var all_frameworks = GetFrameworks (app.Platform, app.IsSimulatorBuild); diff --git a/tools/common/StaticRegistrar.cs b/tools/common/StaticRegistrar.cs index a01684e45b02..aa264d5abdb9 100644 --- a/tools/common/StaticRegistrar.cs +++ b/tools/common/StaticRegistrar.cs @@ -2166,6 +2166,11 @@ void CheckNamespace (TypeReference type, List exceptions) var ns = type.Namespace; +#if !XAMCORE_5_0 + // AVCustomRoutingControllerDelegate was incorrectly placed in AVKit + if (type.Is ("AVKit", "AVCustomRoutingControllerDelegate")) + ns = "AVRouting"; +#endif Framework framework; if (Driver.GetFrameworks (App).TryGetValue (ns, out framework)) { if (framework.Version > App.SdkVersion) { diff --git a/tools/common/Target.cs b/tools/common/Target.cs index 30fd6c932125..169f6d7f43f8 100644 --- a/tools/common/Target.cs +++ b/tools/common/Target.cs @@ -199,6 +199,12 @@ public void GatherFrameworks () foreach (TypeDefinition td in md.Types) { // process only once each namespace (as we keep adding logic below) string nspace = td.Namespace; +#if !XAMCORE_5_0 + // AVCustomRoutingControllerDelegate was incorrectly placed in AVKit + if (td.Is ("AVKit", "AVCustomRoutingControllerDelegate")) + nspace = "AVRouting"; +#endif + if (processed.Contains (nspace)) continue; processed.Add (nspace);