- 在Android SDK中新增FileSDK模块,提供统一的文件上传、下载、打开接口 - 实现Android端文件下载到沙盒目录或公共Downloads目录,并支持通知栏进度显示 - 完善Android WebView组件,增加文件选择、拍照、下载拦截、H5双向通信能力 - 在iOS SDK中新增XuqmFileSDK模块,提供文件上传下载功能 - 实现iOS端WebView组件的文件下载拦截和原生文件选择器集成 - 更新文档说明Android和iOS SDK的文件操作API使用方法 - 重构iOS SDK项目结构,按功能拆分为多个独立模块便于集成 - 添加文件下载进度通知和完成后的文件打开功能
46 行
1.4 KiB
Swift
46 行
1.4 KiB
Swift
import Foundation
|
|
import XuqmFileSDK
|
|
|
|
public struct XWebViewConfig: Sendable {
|
|
public var url: String
|
|
public var title: String
|
|
public var hideToolbar: Bool
|
|
public var hideStatusBar: Bool
|
|
public var userAgent: String?
|
|
public var injectedJavaScript: String?
|
|
/// Where intercepted WebView downloads are saved.
|
|
public var downloadDestination: FileDownloadDestination
|
|
public var onMessage: (@Sendable (String) -> Void)?
|
|
|
|
public init(
|
|
url: String = "",
|
|
title: String = "",
|
|
hideToolbar: Bool = false,
|
|
hideStatusBar: Bool = false,
|
|
userAgent: String? = nil,
|
|
injectedJavaScript: String? = nil,
|
|
downloadDestination: FileDownloadDestination = .sandbox,
|
|
onMessage: (@Sendable (String) -> Void)? = nil
|
|
) {
|
|
self.url = url
|
|
self.title = title
|
|
self.hideToolbar = hideToolbar
|
|
self.hideStatusBar = hideStatusBar
|
|
self.userAgent = userAgent
|
|
self.injectedJavaScript = injectedJavaScript
|
|
self.downloadDestination = downloadDestination
|
|
self.onMessage = onMessage
|
|
}
|
|
}
|
|
|
|
public protocol XWebViewController: AnyObject {
|
|
func canGoBack() -> Bool
|
|
func canGoForward() -> Bool
|
|
func currentUrl() -> String?
|
|
func goBack()
|
|
func goForward()
|
|
func reload()
|
|
func load(url: String)
|
|
func postMessageToWeb(js: String)
|
|
}
|