mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-24 12:13:32 -04:00
Merge pull request #810 from kiwix/809-macos-side-tab-should-update-after-unlinking-a-zim-file
Fix macOS unlink last ZIM file issue
This commit is contained in:
commit
dcc86ed284
@ -95,7 +95,7 @@
|
|||||||
|
|
||||||
"zim_file_missing_indicator.help" = "Zim file is missing.";
|
"zim_file_missing_indicator.help" = "Zim file is missing.";
|
||||||
|
|
||||||
"library.zim_file_details.side_panel.message" = "Select a ZIM file to see detail";
|
"library.zim_file_details.side_panel.message" = "Select a ZIM file to see details";
|
||||||
"library.zim_file_context.main_page.label" = "Main Page";
|
"library.zim_file_context.main_page.label" = "Main Page";
|
||||||
"library.zim_file_context.random.label" = "Random Page";
|
"library.zim_file_context.random.label" = "Random Page";
|
||||||
"library.zim_file_context.copy_url" = "Copy URL";
|
"library.zim_file_context.copy_url" = "Copy URL";
|
||||||
|
@ -25,6 +25,7 @@ struct ZimFilesOpened: View {
|
|||||||
animation: .easeInOut
|
animation: .easeInOut
|
||||||
) private var zimFiles: FetchedResults<ZimFile>
|
) private var zimFiles: FetchedResults<ZimFile>
|
||||||
@State private var isFileImporterPresented = false
|
@State private var isFileImporterPresented = false
|
||||||
|
@EnvironmentObject private var viewModel: LibraryViewModel
|
||||||
let dismiss: (() -> Void)? // iOS only
|
let dismiss: (() -> Void)? // iOS only
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@ -46,6 +47,9 @@ struct ZimFilesOpened: View {
|
|||||||
Message(text: "zim_file_opened.overlay.no-opened.message".localized)
|
Message(text: "zim_file_opened.overlay.no-opened.message".localized)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.onChange(of: zimFiles.count) { _ in
|
||||||
|
viewModel.selectedZimFile = zimFiles.first // makes sure we also nil out, if all ZIMs were unlinked
|
||||||
|
}
|
||||||
// not using OpenFileButton here, because it does not work on iOS/iPadOS 15 when this view is in a modal
|
// not using OpenFileButton here, because it does not work on iOS/iPadOS 15 when this view is in a modal
|
||||||
.fileImporter(
|
.fileImporter(
|
||||||
isPresented: $isFileImporterPresented,
|
isPresented: $isFileImporterPresented,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user