using PostIt.Services; using PostIt.Android.Services; namespace PostIt.Android; /// /// One-shot platform bootstrap. Called from /// so that the shared OIDC login /// path sees the Android-specific redirect URI and a working /// IBrowser (Chrome Custom Tabs) without referencing Android /// APIs from the shared library. /// internal static class PlatformBootstrap { internal static void InitPlatform() { Platform.CreateBrowser = () => { var activity = MainActivity.Current; return activity is null ? null : new AndroidSystemBrowser(activity); }; Platform.TryGetCurrentLocationAsync = AndroidCurrentLocationProvider.TryGetCurrentLocationAsync; Platform.CreateVideoSurface = (player, replay) => new AndroidVideoSurface(player, replay); if (System.OperatingSystem.IsAndroidVersionAtLeast(26)) { Platform.GetLanCallDevices = AndroidLanCallMedia.GetDevices; Platform.CreateLanCallMedia = (address, port) => System.OperatingSystem.IsAndroidVersionAtLeast(26) ? new AndroidLanCallMedia(address, port) : throw new System.PlatformNotSupportedException("Android 8 requis pour les appels LAN."); Platform.GetPodcastCaptureDevices = AndroidPodcastCapture.GetDevices; Platform.RequestPodcastPermissionsAsync = AndroidPodcastCapture.RequestPermissionsAsync; Platform.CreatePodcastCaptureAsync = AndroidPodcastCapture.StartAsync; } } }