-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Organize and centralize HandlerExtensions (#3716)
- Loading branch information
Showing
16 changed files
with
339 additions
and
416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using Android.App; | ||
using Android.Content; | ||
using AView = Android.Views.View; | ||
|
||
namespace Microsoft.Maui.Platform | ||
{ | ||
public static partial class ElementExtensions | ||
{ | ||
public static AView ToContainerView(this IElement view, IMauiContext context) => | ||
new ContainerView(context) { CurrentView = view }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using Foundation; | ||
using ObjCRuntime; | ||
using UIKit; | ||
|
||
namespace Microsoft.Maui.Platform | ||
{ | ||
public static partial class ElementExtensions | ||
{ | ||
const string UIApplicationSceneManifestKey = "UIApplicationSceneManifest"; | ||
|
||
public static UIViewController ToUIViewController(this IElement view, IMauiContext context) | ||
{ | ||
var nativeView = view.ToNative(context); | ||
if (view?.Handler is INativeViewHandler nvh && nvh.ViewController != null) | ||
return nvh.ViewController; | ||
|
||
return new ContainerViewController { CurrentView = view, Context = context }; | ||
} | ||
|
||
// If < iOS 13 or the Info.plist does not have a scene manifest entry we need to assume no multi window, and no UISceneDelegate. | ||
// We cannot check for iPads/Mac because even on the iPhone it uses the scene delegate if one is specified in the manifest. | ||
public static bool HasSceneManifest(this UIApplicationDelegate nativeApplication) => | ||
UIDevice.CurrentDevice.CheckSystemVersion(13, 0) && | ||
NSBundle.MainBundle.InfoDictionary.ContainsKey(new NSString(UIApplicationSceneManifestKey)); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.