Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[src] Fix containing namespace/framework for AVCustomRoutingControllerDelegate. #18137

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions src/avkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
36 changes: 36 additions & 0 deletions src/avrouting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 9 additions & 2 deletions tools/common/Frameworks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,16 @@ static void Gather (Application app, AssemblyDefinition product_assembly, HashSe
var namespaces = new HashSet<string> ();

// 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);
Expand Down
5 changes: 5 additions & 0 deletions tools/common/StaticRegistrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2166,6 +2166,11 @@ void CheckNamespace (TypeReference type, List<Exception> 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) {
Expand Down
6 changes: 6 additions & 0 deletions tools/common/Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down