Files
Folo/apps/mobile/native/ios/Helper/HelperModule.swift
T
Innei 975285ec30 feat(mobile): implement native image preview with QuickLook on iOS
- Add ImagePreview helper class for displaying images using QuickLook
- Extend HelperModule with previewImage function to load and display images
- Update WebView bridge to support image preview from web content
- Implement MarkdownImage component with base64 image conversion
- Add cross-platform quickLookImage method for native image preview

Signed-off-by: Innei <tukon479@gmail.com>
2025-02-08 01:24:56 +08:00

36 lines
900 B
Swift

//
// HelperModule.swift
// Pods
//
// Created by Innei on 2025/2/7.
//
import ExpoModulesCore
public class HelperModule: Module {
public func definition() -> ExpoModulesCore.ModuleDefinition {
Name("Helper")
Function("openLink") { (urlString: String) in
guard let url = URL(string: urlString) else {
return
}
DispatchQueue.main.async {
guard let rootVC = UIApplication.shared.windows.first?.rootViewController else { return }
WebViewManager.presentModalWebView(url: url, from: rootVC)
}
}
Function("previewImage") { (images: [String]) in
let imagesData: [Data] =
images.compactMap { image in
let url = URL(string: image)
let data = try? Data(contentsOf: url!)
return data
}
DispatchQueue.main.async {
ImagePreview.quickLookImage(imagesData)
}
}
}
}