Skip to content

Commit

Permalink
Add MauiUIApplicationDelegate.PerformFetch (#7982)
Browse files Browse the repository at this point in the history
* Add MauiUIApplicationDelegate.PerformFetch

* Add delegate

* Update PublicAPI.Unshipped.txt
  • Loading branch information
jfversluis committed Mar 7, 2023
1 parent 63d002f commit 8b55253
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Core/src/LifecycleEvents/iOS/iOSLifecycle.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Foundation;
using System;
using Foundation;
using ObjCRuntime;
using UIKit;

Expand All @@ -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<UIBackgroundFetchResult> completionHandler);

// Scene
public delegate void SceneWillConnect(UIScene scene, UISceneSession session, UISceneConnectionOptions connectionOptions);
Expand Down
6 changes: 6 additions & 0 deletions src/Core/src/Platform/iOS/MauiUIApplicationDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ public virtual void ApplicationSignificantTimeChange(UIApplication application)
Services?.InvokeLifecycleEvents<iOSLifecycle.ApplicationSignificantTimeChange>(del => del(application));
}

[Export("application:performFetchWithCompletionHandler:")]
public virtual void PerformFetch(UIApplication application, Action<UIBackgroundFetchResult> completionHandler)
{
Services?.InvokeLifecycleEvents<iOSLifecycle.PerformFetch>(del => del(application, completionHandler));
}

public static MauiUIApplicationDelegate Current { get; private set; } = null!;

[Export("window")]
Expand Down
2 changes: 2 additions & 0 deletions src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<UIKit.UIBackgroundFetchResult>! completionHandler) -> void
Original file line number Diff line number Diff line change
Expand Up @@ -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<UIKit.UIBackgroundFetchResult>! completionHandler) -> void

0 comments on commit 8b55253

Please sign in to comment.