Skip to content

Commit

Permalink
fix life updates creation time crash (#4210)
Browse files Browse the repository at this point in the history
  • Loading branch information
nnngrach authored Dec 17, 2024
1 parent 9bf9a63 commit e79f800
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Sources/DownloadsManager/OADownloadTask_AFURLSessionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions Sources/Helpers/OAResourcesUIHelper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,6 @@ + (void) startDownloadOfCustomItem:(OACustomResourceItem *)item

task.title = taskTitle;
task.resourceItem = item;
task.creationTime = [NSDate now];

if (onTaskCreated)
onTaskCreated(task);
Expand Down Expand Up @@ -1682,7 +1681,6 @@ + (void)startDownloadOfItem:(OARepositoryResourceItem *)item
task = item.downloadTask;

item.downloadTask.resourceItem = item;
item.downloadTask.creationTime = [NSDate now];

if (onTaskCreated)
onTaskCreated(task);
Expand Down Expand Up @@ -1743,7 +1741,6 @@ + (void) startDownloadOf:(const std::shared_ptr<const OsmAnd::ResourcesManager::
andName:name
andHidden:NO];
task.resourceItem = resourceItem;
task.creationTime = [NSDate now];

if (onTaskCreated)
onTaskCreated(task);
Expand Down

0 comments on commit e79f800

Please sign in to comment.