From 8b55253cee62d4624a20f7ed9958ac180237e023 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Tue, 7 Mar 2023 07:15:06 +0100 Subject: [PATCH] Add MauiUIApplicationDelegate.PerformFetch (#7982) * Add MauiUIApplicationDelegate.PerformFetch * Add delegate * Update PublicAPI.Unshipped.txt --- src/Core/src/LifecycleEvents/iOS/iOSLifecycle.cs | 4 +++- src/Core/src/Platform/iOS/MauiUIApplicationDelegate.cs | 6 ++++++ src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt | 2 ++ .../src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Core/src/LifecycleEvents/iOS/iOSLifecycle.cs b/src/Core/src/LifecycleEvents/iOS/iOSLifecycle.cs index 8f7d8c9c77de..52896b4c5a93 100644 --- a/src/Core/src/LifecycleEvents/iOS/iOSLifecycle.cs +++ b/src/Core/src/LifecycleEvents/iOS/iOSLifecycle.cs @@ -1,4 +1,5 @@ -using Foundation; +using System; +using Foundation; using ObjCRuntime; using UIKit; @@ -17,6 +18,7 @@ public static class iOSLifecycle public delegate void WillEnterForeground(UIApplication application); public delegate void WillTerminate(UIApplication application); public delegate void ApplicationSignificantTimeChange(UIApplication application); + public delegate void PerformFetch(UIApplication application, Action completionHandler); // Scene public delegate void SceneWillConnect(UIScene scene, UISceneSession session, UISceneConnectionOptions connectionOptions); diff --git a/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.cs b/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.cs index a1191859a243..3a119be2863d 100644 --- a/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.cs +++ b/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.cs @@ -143,6 +143,12 @@ public virtual void ApplicationSignificantTimeChange(UIApplication application) Services?.InvokeLifecycleEvents(del => del(application)); } + [Export("application:performFetchWithCompletionHandler:")] + public virtual void PerformFetch(UIApplication application, Action completionHandler) + { + Services?.InvokeLifecycleEvents(del => del(application, completionHandler)); + } + public static MauiUIApplicationDelegate Current { get; private set; } = null!; [Export("window")] diff --git a/src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt index 6f552ad11fd6..67ef7761bbfe 100644 --- a/src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt +++ b/src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt @@ -4,6 +4,7 @@ Microsoft.Maui.Handlers.SwipeItemButton.FrameChanged -> System.EventHandler? Microsoft.Maui.Handlers.SwipeItemButton.SwipeItemButton() -> void Microsoft.Maui.Hosting.MauiApp.DisposeAsync() -> System.Threading.Tasks.ValueTask Microsoft.Maui.Layouts.FlexBasis.Equals(Microsoft.Maui.Layouts.FlexBasis other) -> bool +Microsoft.Maui.LifecycleEvents.iOSLifecycle.PerformFetch Microsoft.Maui.SizeRequest.Equals(Microsoft.Maui.SizeRequest other) -> bool override Microsoft.Maui.Handlers.SwipeItemButton.Frame.get -> CoreGraphics.CGRect override Microsoft.Maui.Handlers.SwipeItemButton.Frame.set -> void @@ -33,3 +34,4 @@ static Microsoft.Maui.Platform.WebViewExtensions.UpdateUserAgent(this WebKit.WKW Microsoft.Maui.WeakEventManager.HandleEvent(object? sender, object? args, string! eventName) -> void static Microsoft.Maui.SizeRequest.operator !=(Microsoft.Maui.SizeRequest left, Microsoft.Maui.SizeRequest right) -> bool static Microsoft.Maui.SizeRequest.operator ==(Microsoft.Maui.SizeRequest left, Microsoft.Maui.SizeRequest right) -> bool +virtual Microsoft.Maui.MauiUIApplicationDelegate.PerformFetch(UIKit.UIApplication! application, System.Action! completionHandler) -> void diff --git a/src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt index 6f552ad11fd6..d7db88fdc7d6 100644 --- a/src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt +++ b/src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt @@ -33,3 +33,5 @@ static Microsoft.Maui.Platform.WebViewExtensions.UpdateUserAgent(this WebKit.WKW Microsoft.Maui.WeakEventManager.HandleEvent(object? sender, object? args, string! eventName) -> void static Microsoft.Maui.SizeRequest.operator !=(Microsoft.Maui.SizeRequest left, Microsoft.Maui.SizeRequest right) -> bool static Microsoft.Maui.SizeRequest.operator ==(Microsoft.Maui.SizeRequest left, Microsoft.Maui.SizeRequest right) -> bool +Microsoft.Maui.LifecycleEvents.iOSLifecycle.PerformFetch +virtual Microsoft.Maui.MauiUIApplicationDelegate.PerformFetch(UIKit.UIApplication! application, System.Action! completionHandler) -> void