Fix downloadFile
This commit is contained in:
24
salesbook.Maui/Platforms/iOS/Core/FilePreviewService.cs
Normal file
24
salesbook.Maui/Platforms/iOS/Core/FilePreviewService.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using QuickLook;
|
||||
using salesbook.Maui.Core.Interface;
|
||||
using salesbook.Maui.Helpers;
|
||||
using UIKit;
|
||||
|
||||
namespace salesbook.Maui.Core;
|
||||
|
||||
public class FilePreviewService : IFilePreviewService
|
||||
{
|
||||
public Task Preview(string fileName, string filePath)
|
||||
{
|
||||
var currentController = UIApplication.SharedApplication.KeyWindow?.RootViewController;
|
||||
while (currentController?.PresentedViewController != null)
|
||||
currentController = currentController.PresentedViewController;
|
||||
|
||||
var currentView = currentController?.View;
|
||||
var qLPreview = new QLPreviewController();
|
||||
var item = new QlPreviewItemBundle(fileName, filePath);
|
||||
qLPreview.DataSource = new PreviewControllerDs(item);
|
||||
currentController?.PresentViewController(qLPreview, true, null);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user