Skip to content

Commit

Permalink
Improve progress behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
amr-abdelfattah committed May 3, 2020
1 parent 12b0064 commit 30ffcd5
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Example/FileDownloadingCenter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@
INFOPLIST_FILE = FileDownloadingCenter/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.1.1;
MARKETING_VERSION = 1.1.3;
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "com.amr-abdelfattah.FileDownloadingCenter-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -556,7 +556,7 @@
INFOPLIST_FILE = FileDownloadingCenter/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.1.1;
MARKETING_VERSION = 1.1.3;
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "com.amr-abdelfattah.FileDownloadingCenter-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
4 changes: 3 additions & 1 deletion Example/FileDownloadingCenter/TrackTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class TrackTableViewCell: UITableViewCell {

private func setIsDownloading(_ isDownloading: Bool) {

self.detailTextLabel?.text = isDownloading ? "Downloading ..." : ""
DispatchQueue.main.async {
self.detailTextLabel?.text = isDownloading ? "Downloading ..." : ""
}

}

Expand Down
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- FileDownloadingCenter (1.1.0)
- FileDownloadingCenter (1.1.3)
- ReachabilitySwift (5.0.0)

DEPENDENCIES:
Expand All @@ -15,7 +15,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
FileDownloadingCenter: adfa6ef6b24b97db22c6cdd8906b70536e5ba815
FileDownloadingCenter: c18664d86f0ce60e8739c8a0d8e178bd19f3b219
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825

PODFILE CHECKSUM: c957ad9504adcf9fa2f52fe3ea1e538970a89dd3
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion FileDownloadingCenter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'FileDownloadingCenter'
s.version = '1.1.1'
s.version = '1.1.3'
s.summary = 'File Downloading Center is an iOS downloading library for files.'
s.description = 'File Downloading Center is used for facilitating the files downloading and all its stuff from storing, restoring, displaying, ...'
s.author = { 'Amr Elsayed' => 'amrelsayed.mohamed@gmail.com' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class SafeDictionary<K: Hashable, V> {
set {

print("DOWNLOAD ALL SET BEFORE \(key)")
self.concurrentQueue.async(flags: .barrier) {
// self.concurrentQueue.async(flags: .barrier) {
self.concurrentQueue.sync {

print("DOWNLOAD ALL SET DONE \(key)")
self.dictionary[key] = newValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ public extension ModelDownloaderManager {

DispatchQueue.global(qos: .background).async {

let downloader = notification.object as! FileDownloader
if let downloader = notification.object as? FileDownloader {

for downloaderListener in self.downloaderListeners {

if self.isEnabledListener(downloaderListener, forIdentifier: downloader.identifier) {
Expand All @@ -178,6 +178,7 @@ public extension ModelDownloaderManager {

}

}
print("LISTENER: didUpdateProgress 2")

}
Expand Down

0 comments on commit 30ffcd5

Please sign in to comment.