File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -87,13 +87,21 @@ struct ZimFileDetail: View {
87
87
. modifier ( FileLocator ( isPresenting: $isPresentingFileLocator) )
88
88
. navigationTitle ( zimFile. name)
89
89
. navigationBarTitleDisplayMode ( . inline)
90
- . task {
91
- if let zimFileName = await ZimFileService . shared. getFileURL ( zimFileID: zimFile. fileID) ? . lastPathComponent,
92
- let documentDirectoryURL = FileManager . default. urls ( for: . documentDirectory, in: . userDomainMask) . first,
93
- FileManager . default. fileExists ( atPath: documentDirectoryURL. appendingPathComponent ( zimFileName) . path) {
94
- isInDocumentsDirectory = true
95
- } else {
96
- isInDocumentsDirectory = false
90
+ . onReceive ( zimFile. publisher ( for: \. fileURLBookmark) ) { _ in
91
+ Task { @MainActor in
92
+ if let zimFileName = await ZimFileService . shared. getFileURL (
93
+ zimFileID: zimFile. fileID
94
+ ) ? . lastPathComponent,
95
+ let documentDirectoryURL = FileManager . default. urls (
96
+ for: . documentDirectory, in: . userDomainMask
97
+ ) . first,
98
+ FileManager . default. fileExists (
99
+ atPath: documentDirectoryURL. appendingPathComponent ( zimFileName) . path
100
+ ) {
101
+ isInDocumentsDirectory = true
102
+ } else {
103
+ isInDocumentsDirectory = false
104
+ }
97
105
}
98
106
}
99
107
#endif
You can’t perform that action at this time.
0 commit comments