From e79f8000c97e1f1cc1a7c47f58844b8c3ec63bf3 Mon Sep 17 00:00:00 2001 From: Max Kojin Date: Tue, 17 Dec 2024 20:04:02 +0500 Subject: [PATCH] fix life updates creation time crash (#4210) --- Sources/DownloadsManager/OADownloadTask_AFURLSessionManager.m | 3 +++ Sources/Helpers/OAResourcesUIHelper.mm | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/DownloadsManager/OADownloadTask_AFURLSessionManager.m b/Sources/DownloadsManager/OADownloadTask_AFURLSessionManager.m index c3f7f3f9e7..2427f6f8d4 100644 --- a/Sources/DownloadsManager/OADownloadTask_AFURLSessionManager.m +++ b/Sources/DownloadsManager/OADownloadTask_AFURLSessionManager.m @@ -48,6 +48,8 @@ - (instancetype)initUsingManager:(AFURLSessionManager*)manager [self onCompletedWith:response andStoredAt:filePath withError:error]; }]; + _creationTime = [NSDate now]; + _progress = progress; [_progress addObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted)) @@ -74,6 +76,7 @@ - (instancetype)initUsingManager:(AFURLSessionManager*)manager _key = [key copy]; _name = [name copy]; _hidden = hidden; + _creationTime = [NSDate now]; NSProgress* progress; NSURLSessionDownloadTask* task = [manager downloadTaskWithResumeData:resumeData diff --git a/Sources/Helpers/OAResourcesUIHelper.mm b/Sources/Helpers/OAResourcesUIHelper.mm index f1a37b9f13..e72836fdfd 100644 --- a/Sources/Helpers/OAResourcesUIHelper.mm +++ b/Sources/Helpers/OAResourcesUIHelper.mm @@ -1347,7 +1347,6 @@ + (void) startDownloadOfCustomItem:(OACustomResourceItem *)item task.title = taskTitle; task.resourceItem = item; - task.creationTime = [NSDate now]; if (onTaskCreated) onTaskCreated(task); @@ -1682,7 +1681,6 @@ + (void)startDownloadOfItem:(OARepositoryResourceItem *)item task = item.downloadTask; item.downloadTask.resourceItem = item; - item.downloadTask.creationTime = [NSDate now]; if (onTaskCreated) onTaskCreated(task); @@ -1743,7 +1741,6 @@ + (void) startDownloadOf:(const std::shared_ptr