mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-24 04:03:03 -04:00
Rename share to export
This commit is contained in:
parent
ad07bc53c6
commit
e5a98ee598
@ -71,7 +71,7 @@ extension Notification.Name {
|
|||||||
static let alert = Notification.Name("alert")
|
static let alert = Notification.Name("alert")
|
||||||
static let openFiles = Notification.Name("openFiles")
|
static let openFiles = Notification.Name("openFiles")
|
||||||
static let openURL = Notification.Name("openURL")
|
static let openURL = Notification.Name("openURL")
|
||||||
static let shareFileData = Notification.Name("shareFileData")
|
static let exportFileData = Notification.Name("exportFileData")
|
||||||
static let saveContent = Notification.Name("saveContent")
|
static let saveContent = Notification.Name("saveContent")
|
||||||
static let toggleSidebar = Notification.Name("toggleSidebar")
|
static let toggleSidebar = Notification.Name("toggleSidebar")
|
||||||
}
|
}
|
||||||
@ -90,8 +90,8 @@ extension NotificationCenter {
|
|||||||
NotificationCenter.default.post(name: .openFiles, object: nil, userInfo: ["urls": urls, "context": context])
|
NotificationCenter.default.post(name: .openFiles, object: nil, userInfo: ["urls": urls, "context": context])
|
||||||
}
|
}
|
||||||
|
|
||||||
static func shareFileData(_ data: FileExportData) {
|
static func exportFileData(_ data: FileExportData) {
|
||||||
NotificationCenter.default.post(name: .shareFileData, object: nil, userInfo: ["data": data])
|
NotificationCenter.default.post(name: .exportFileData, object: nil, userInfo: ["data": data])
|
||||||
}
|
}
|
||||||
|
|
||||||
static func saveContent(url: URL) {
|
static func saveContent(url: URL) {
|
||||||
|
@ -40,7 +40,7 @@ struct ShareButton: View {
|
|||||||
Task {
|
Task {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
guard let exportData = await dataNameAndExtension() else { return }
|
guard let exportData = await dataNameAndExtension() else { return }
|
||||||
NotificationCenter.shareFileData(exportData)
|
NotificationCenter.exportFileData(exportData)
|
||||||
#else
|
#else
|
||||||
guard let url = await tempFileURL() else { return }
|
guard let url = await tempFileURL() else { return }
|
||||||
NSSharingServicePicker(items: [url]).show(relativeTo: .null, of: browser.webView, preferredEdge: .minY)
|
NSSharingServicePicker(items: [url]).show(relativeTo: .null, of: browser.webView, preferredEdge: .minY)
|
||||||
|
@ -19,11 +19,11 @@ import SwiftUI
|
|||||||
/// On receiving FileExportData, it gives the ability to share it
|
/// On receiving FileExportData, it gives the ability to share it
|
||||||
struct FileExportHandler: ViewModifier {
|
struct FileExportHandler: ViewModifier {
|
||||||
|
|
||||||
private let shareFileData = NotificationCenter.default.publisher(for: .shareFileData)
|
private let exportFileData = NotificationCenter.default.publisher(for: .exportFileData)
|
||||||
@State private var temporaryURL: URL?
|
@State private var temporaryURL: URL?
|
||||||
|
|
||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
content.onReceive(shareFileData) { notification in
|
content.onReceive(exportFileData) { notification in
|
||||||
|
|
||||||
guard let userInfo = notification.userInfo,
|
guard let userInfo = notification.userInfo,
|
||||||
let exportData = userInfo["data"] as? FileExportData,
|
let exportData = userInfo["data"] as? FileExportData,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user