mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-14 14:49:50 -04:00
Move ZimFileContextMenu to a new class, add warning on dependencies injected
This commit is contained in:
parent
42b7edc645
commit
1b49e65830
@ -151,7 +151,10 @@ struct DetailSidePanel<Content: View>: View {
|
||||
}
|
||||
}.frame(width: 275).background(.ultraThinMaterial)
|
||||
}
|
||||
}.environmentObject(selection)
|
||||
}
|
||||
// !important, otherwise the wrapped contentView
|
||||
// won't get the selection dependency
|
||||
.environmentObject(selection)
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,19 +192,6 @@ struct MultiZimFilesOpenedContext<Content: View>: View {
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ZimFileContextMenu: View {
|
||||
let zimFile: ZimFile
|
||||
|
||||
var body: some View {
|
||||
if zimFile.fileURLBookmark != nil, !zimFile.isMissing {
|
||||
Section { ArticleActions(zimFileID: zimFile.fileID) }
|
||||
}
|
||||
if let downloadURL = zimFile.downloadURL {
|
||||
Section { CopyPasteMenu(downloadURL: downloadURL) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// On macOS, makes the content view clickable, to select a single ZIM file
|
||||
/// On iOS, converts the modified view to a NavigationLink that goes to the zim file detail.
|
||||
struct LibraryZimFileContext<Content: View>: View {
|
||||
|
29
Views/Library/ZimFileContextMenu.swift
Normal file
29
Views/Library/ZimFileContextMenu.swift
Normal file
@ -0,0 +1,29 @@
|
||||
// This file is part of Kiwix for iOS & macOS.
|
||||
//
|
||||
// Kiwix is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// Kiwix is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Kiwix; If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ZimFileContextMenu: View {
|
||||
let zimFile: ZimFile
|
||||
|
||||
var body: some View {
|
||||
if zimFile.fileURLBookmark != nil, !zimFile.isMissing {
|
||||
Section { ArticleActions(zimFileID: zimFile.fileID) }
|
||||
}
|
||||
if let downloadURL = zimFile.downloadURL {
|
||||
Section { CopyPasteMenu(downloadURL: downloadURL) }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user