Revision: 29630
          http://sourceforge.net/p/bibdesk/svn/29630
Author:   hofman
Date:     2025-09-26 16:25:11 +0000 (Fri, 26 Sep 2025)
Log Message:
-----------
no need for didCreateDestination delegate method for DSKDownload, it is always 
the value returned from the decideDestination callback

Modified Paths:
--------------
    trunk/bibdesk/BDSKDownloadManager.m
    trunk/bibdesk/BDSKDownloader.h
    trunk/bibdesk/BDSKDownloader.m
    trunk/bibdesk/BDSKItemDownload.m
    trunk/bibdesk/BDSKTextImportController.m
    trunk/bibdesk/BDSKURLGroup.m

Modified: trunk/bibdesk/BDSKDownloadManager.m
===================================================================
--- trunk/bibdesk/BDSKDownloadManager.m 2025-09-26 15:45:24 UTC (rev 29629)
+++ trunk/bibdesk/BDSKDownloadManager.m 2025-09-26 16:25:11 UTC (rev 29630)
@@ -463,11 +463,11 @@
 }
 
 - (void)download:(BDSKDownload *)download 
decideDestinationWithSuggestedFilename:(NSString *)filename 
completionHandler:(void (^)(NSURL *destinationURL))completionHandler {
-    [downloadManager download:download 
decideDestinationWithSuggestedFilename:filename modalForWindow:nil 
completionHandler:completionHandler];
+    [downloadManager download:download 
decideDestinationWithSuggestedFilename:filename modalForWindow:nil 
completionHandler:^(NSURL *destinationURL) {
+        if (destinationURL)
+            [[downloadManager webDownloadForDownload:download] 
setFileURL:destinationURL];
+        completionHandler(destinationURL);
+    }];
 }
 
-- (void)download:(BDSKDownload *)download didCreateDestination:(NSURL 
*)destinationURL {
-    [[downloadManager webDownloadForDownload:download] 
setFileURL:destinationURL];
-}
-
 @end

Modified: trunk/bibdesk/BDSKDownloader.h
===================================================================
--- trunk/bibdesk/BDSKDownloader.h      2025-09-26 15:45:24 UTC (rev 29629)
+++ trunk/bibdesk/BDSKDownloader.h      2025-09-26 16:25:11 UTC (rev 29630)
@@ -98,7 +98,6 @@
 
 // only for file downloads
 - (void)download:(BDSKDownload *)download 
decideDestinationWithSuggestedFilename:(NSString *)destinationName 
completionHandler:(void (^)(NSURL *_Nullable destinationURL))completionHandler;
-- (void)download:(BDSKDownload *)download didCreateDestination:(NSURL 
*)destinationURL;
 
 @end
 

Modified: trunk/bibdesk/BDSKDownloader.m
===================================================================
--- trunk/bibdesk/BDSKDownloader.m      2025-09-26 15:45:24 UTC (rev 29629)
+++ trunk/bibdesk/BDSKDownloader.m      2025-09-26 16:25:11 UTC (rev 29630)
@@ -49,7 +49,6 @@
 - (void)_didReceiveDataOfLength:(uint64_t)length;
 - (void)_didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge 
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, 
NSURLCredential *credential))completionHandler;
 - (void)_decideDestinationWithSuggestedFilename:(NSString *)suggestedFileName 
completionHandler:(void (^)(NSURL *destinationURL))completionHandler;
-- (void)_didCreateDestination:(NSURL *)destinationURL;
 
 @end
 
@@ -181,7 +180,6 @@
             if ([[destinationURL URLByDeletingLastPathComponent] 
checkResourceIsReachableAndReturnError:NULL] == NO) {
                 [fm createDirectoryAtPath:[[destinationURL 
URLByDeletingLastPathComponent] path] withIntermediateDirectories:YES 
attributes:nil error:NULL];
             }
-            [download _didCreateDestination:destinationURL];
             if ([fm moveItemAtURL:location toURL:destinationURL error:&error]) 
{
                 [download _didCompleteWithError:nil];
             } else {
@@ -311,11 +309,5 @@
     }
 }
 
-- (void)_didCreateDestination:(NSURL *)destinationURL {
-    if ([delegate 
respondsToSelector:@selector(download:didCreateDestination:)]) {
-        [delegate download:self didCreateDestination:destinationURL];
-    }
-}
-
 @end
 

Modified: trunk/bibdesk/BDSKItemDownload.m
===================================================================
--- trunk/bibdesk/BDSKItemDownload.m    2025-09-26 15:45:24 UTC (rev 29629)
+++ trunk/bibdesk/BDSKItemDownload.m    2025-09-26 16:25:11 UTC (rev 29630)
@@ -124,13 +124,10 @@
         destURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() 
stringByAppendingPathComponent:destinationName]];
     if ([destURL checkResourceIsReachableAndReturnError:NULL])
         destURL = [[NSFileManager defaultManager] uniqueFileURL:destURL];
+    fileURL = destURL;
     completionHandler(destURL);
 }
 
-- (void)download:(BDSKDownload *)aDownload didCreateDestination:(NSURL 
*)destinationURL {
-    fileURL = destinationURL;
-}
-
 - (void)download:(BDSKDownload *)aDownload 
didReceiveExpectedContentLength:(int64_t)expectedContentLength {
     expectedLength = expectedContentLength;
     [[self delegate] itemDownloadDidStart:self];

Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m    2025-09-26 15:45:24 UTC (rev 
29629)
+++ trunk/bibdesk/BDSKTextImportController.m    2025-09-26 16:25:11 UTC (rev 
29630)
@@ -1261,14 +1261,11 @@
         fileURL = [sPanel URL];
         if ([fileURL checkResourceIsReachableAndReturnError:NULL])
             [[NSFileManager defaultManager] removeItemAtURL:fileURL error:nil];
+        downloadFileName = [fileURL path];
     }
     completionHandler(fileURL);
 }
 
-- (void)download:(BDSKDownload *)aDownload didCreateDestination:(NSURL 
*)destinationURL {
-       downloadFileName = [[destinationURL path] copy];
-}
-
 - (void)download:(BDSKDownload *)aDownload didCompleteWithError:(NSError 
*)error {
     [self setDownloading:NO];
     if (error == nil) {

Modified: trunk/bibdesk/BDSKURLGroup.m
===================================================================
--- trunk/bibdesk/BDSKURLGroup.m        2025-09-26 15:45:24 UTC (rev 29629)
+++ trunk/bibdesk/BDSKURLGroup.m        2025-09-26 16:25:11 UTC (rev 29630)
@@ -229,15 +229,11 @@
 }
 
 - (void)download:(BDSKDownload *)aDownload 
decideDestinationWithSuggestedFilename:(NSString *)destinationName 
completionHandler:(void (^)(NSURL *))completionHandler {
-    completionHandler([[NSFileManager defaultManager] 
temporaryFileURLWithBasename:destinationName]);
+    NSURL *destinationURL = [[NSFileManager defaultManager] 
temporaryFileURLWithBasename:destinationName];
+    fileURL = destinationURL;
+    completionHandler(destinationURL);
 }
 
-- (void)download:(BDSKDownload *)aDownload didCreateDestination:(NSURL 
*)destinationURL {
-    if (destinationURL != fileURL) {
-        fileURL = [destinationURL copy];
-    }
-}
-
 - (void)download:(BDSKDownload *)aDownload didCompleteWithError:(NSError 
*)error
 {
     if (error == nil) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to