From ae348c7c897f7128d8ab38d076dc5631498ae0e0 Mon Sep 17 00:00:00 2001 From: "Mark R. Masterson" Date: Sun, 21 Mar 2021 17:01:24 -0700 Subject: [PATCH 1/4] TUSKit version bump, tweaked example response a bit --- Example/Podfile.lock | 10 +++++----- Example/Transloadit/ViewController.swift | 7 ++++++- Transloadit.podspec | 4 ++-- Transloadit/Classes/Assembly.swift | 5 +---- Transloadit/Classes/TransloaditExecutor.swift | 12 ++++++------ 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 4b8ee94..3582d2a 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -11,9 +11,9 @@ PODS: - FBSnapshotTestCase (~> 2.0) - Nimble (~> 7.0) - Quick (1.2.0) - - Transloadit (2.1.1.alpha): - - TUSKit (~> 2.1.5.alpha) - - TUSKit (2.1.5.alpha) + - Transloadit (2.1.0): + - TUSKit (~> 2.1.0) + - TUSKit (2.1.0) DEPENDENCIES: - FBSnapshotTestCase (~> 2.1.4) @@ -39,8 +39,8 @@ SPEC CHECKSUMS: Nimble: 051e3d8912d40138fa5591c78594f95fb172af37 Nimble-Snapshots: f5459b5b091678dc942d03ec4741cacb58ba4a52 Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08 - Transloadit: 04579bc6c47e394226ad990dcd1f50988c8cf2cd - TUSKit: 848e7da5efd00aedb649e838ff968fb11dd664d5 + Transloadit: 37ec9471fb4d82119bcd788e6a0305995642fd9f + TUSKit: 2fe53b42c248596a219c991096ca785997e72eb2 PODFILE CHECKSUM: c54fe98a78e285d7620018f91160940d9909bc2a diff --git a/Example/Transloadit/ViewController.swift b/Example/Transloadit/ViewController.swift index 46baf41..875bbd3 100644 --- a/Example/Transloadit/ViewController.swift +++ b/Example/Transloadit/ViewController.swift @@ -94,7 +94,12 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig func transloaditProcessing(forObject: APIObject, withResult: TransloaditResponse) { if (withResult.success) { - print("We did it!") + if(withResult.processing) { + print("Processing") + } else { + var assembly: Assembly = forObject as! Assembly + print("Processed") + } } else { print(withResult.error) } diff --git a/Transloadit.podspec b/Transloadit.podspec index 329cee4..a292e78 100644 --- a/Transloadit.podspec +++ b/Transloadit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'Transloadit' - s.version = '2.0.1' + s.version = '2.1.0' s.summary = 'A short description of Transloadit.' s.swift_version = '5.0' @@ -40,5 +40,5 @@ TODO: Add long description of the pod here. # s.public_header_files = 'Pod/Classes/**/*.h' # s.frameworks = 'UIKit', 'MapKit' # s.dependency 'AFNetworking', '~> 2.3' - s.dependency 'TUSKit', '~> 2.0.0' + s.dependency 'TUSKit', '~> 2.1.0' end diff --git a/Transloadit/Classes/Assembly.swift b/Transloadit/Classes/Assembly.swift index a7c3b69..5a7448f 100644 --- a/Transloadit/Classes/Assembly.swift +++ b/Transloadit/Classes/Assembly.swift @@ -13,7 +13,7 @@ public class Assembly: APIObject { var numberOfFiles: Int? internal var tusUpload: TUSUpload? - internal var assemblyURL: String? + public var assemblyURL: String? internal var steps: NSMutableDictionary = [:] @@ -25,9 +25,6 @@ public class Assembly: APIObject { } - public func addFile(withData: Data) { - - } public func addFile(withPathURL: URL) { tusUpload = TUSUpload(withId: withPathURL.lastPathComponent, andFilePathURL: withPathURL, andFileType: withPathURL.pathExtension) diff --git a/Transloadit/Classes/TransloaditExecutor.swift b/Transloadit/Classes/TransloaditExecutor.swift index 27bb805..062ff61 100644 --- a/Transloadit/Classes/TransloaditExecutor.swift +++ b/Transloadit/Classes/TransloaditExecutor.swift @@ -56,8 +56,8 @@ class TransloaditExecutor: TUSDelegate { self.urlRequest(withMethod: "POST", andObject: object, callback: { response in if (response.success) { if object.isKind(of: Assembly.self) { - print(response.tusURL) - TUSClient.shared.uploadURL = URL(string: response.tusURL) + Transloadit.shared.delegate?.transloaditCreation(forObject: object as! Assembly, withResult: response) + TUSClient.shared.uploadURL = URL(string: response.tusURL)! //TUSClient.shared.startOrResume(forUpload: (object as! Assembly).tusUpload!, withExisitingURL: "") (object as! Assembly).tusUpload?.metadata = ["fieldname": "file-input", "assembly_url": response.assemblyURL, @@ -72,7 +72,7 @@ class TransloaditExecutor: TUSDelegate { } else { if object.isKind(of: Assembly.self) { -// Transloadit.shared.delegate?.transloaditCreationResult(forObject: object) + Transloadit.shared.delegate?.transloaditCreation(forObject: object as! Assembly, withResult: response) } if object.isKind(of: Template.self) { // Transloadit.shared.delegate?.transloaditTemplateCreationError() @@ -238,10 +238,10 @@ class TransloaditExecutor: TUSDelegate { } } catch let error as NSError { print(error) + transloaditResponse.error = error.debugDescription + callback(transloaditResponse) + } - //let outputStr = String(data: data!, encoding: String.Encoding.utf8) as String! - // print(outputStr) - } From 9bc05ee2450c049dda5a95681792bad0030853d9 Mon Sep 17 00:00:00 2001 From: "Mark R. Masterson" Date: Sun, 21 Mar 2021 17:02:15 -0700 Subject: [PATCH 2/4] Revert "TUSKit version bump, tweaked example response a bit" This reverts commit ae348c7c897f7128d8ab38d076dc5631498ae0e0. --- Example/Podfile.lock | 10 +++++----- Example/Transloadit/ViewController.swift | 7 +------ Transloadit.podspec | 4 ++-- Transloadit/Classes/Assembly.swift | 5 ++++- Transloadit/Classes/TransloaditExecutor.swift | 12 ++++++------ 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 3582d2a..4b8ee94 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -11,9 +11,9 @@ PODS: - FBSnapshotTestCase (~> 2.0) - Nimble (~> 7.0) - Quick (1.2.0) - - Transloadit (2.1.0): - - TUSKit (~> 2.1.0) - - TUSKit (2.1.0) + - Transloadit (2.1.1.alpha): + - TUSKit (~> 2.1.5.alpha) + - TUSKit (2.1.5.alpha) DEPENDENCIES: - FBSnapshotTestCase (~> 2.1.4) @@ -39,8 +39,8 @@ SPEC CHECKSUMS: Nimble: 051e3d8912d40138fa5591c78594f95fb172af37 Nimble-Snapshots: f5459b5b091678dc942d03ec4741cacb58ba4a52 Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08 - Transloadit: 37ec9471fb4d82119bcd788e6a0305995642fd9f - TUSKit: 2fe53b42c248596a219c991096ca785997e72eb2 + Transloadit: 04579bc6c47e394226ad990dcd1f50988c8cf2cd + TUSKit: 848e7da5efd00aedb649e838ff968fb11dd664d5 PODFILE CHECKSUM: c54fe98a78e285d7620018f91160940d9909bc2a diff --git a/Example/Transloadit/ViewController.swift b/Example/Transloadit/ViewController.swift index 875bbd3..46baf41 100644 --- a/Example/Transloadit/ViewController.swift +++ b/Example/Transloadit/ViewController.swift @@ -94,12 +94,7 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig func transloaditProcessing(forObject: APIObject, withResult: TransloaditResponse) { if (withResult.success) { - if(withResult.processing) { - print("Processing") - } else { - var assembly: Assembly = forObject as! Assembly - print("Processed") - } + print("We did it!") } else { print(withResult.error) } diff --git a/Transloadit.podspec b/Transloadit.podspec index a292e78..329cee4 100644 --- a/Transloadit.podspec +++ b/Transloadit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'Transloadit' - s.version = '2.1.0' + s.version = '2.0.1' s.summary = 'A short description of Transloadit.' s.swift_version = '5.0' @@ -40,5 +40,5 @@ TODO: Add long description of the pod here. # s.public_header_files = 'Pod/Classes/**/*.h' # s.frameworks = 'UIKit', 'MapKit' # s.dependency 'AFNetworking', '~> 2.3' - s.dependency 'TUSKit', '~> 2.1.0' + s.dependency 'TUSKit', '~> 2.0.0' end diff --git a/Transloadit/Classes/Assembly.swift b/Transloadit/Classes/Assembly.swift index 5a7448f..a7c3b69 100644 --- a/Transloadit/Classes/Assembly.swift +++ b/Transloadit/Classes/Assembly.swift @@ -13,7 +13,7 @@ public class Assembly: APIObject { var numberOfFiles: Int? internal var tusUpload: TUSUpload? - public var assemblyURL: String? + internal var assemblyURL: String? internal var steps: NSMutableDictionary = [:] @@ -25,6 +25,9 @@ public class Assembly: APIObject { } + public func addFile(withData: Data) { + + } public func addFile(withPathURL: URL) { tusUpload = TUSUpload(withId: withPathURL.lastPathComponent, andFilePathURL: withPathURL, andFileType: withPathURL.pathExtension) diff --git a/Transloadit/Classes/TransloaditExecutor.swift b/Transloadit/Classes/TransloaditExecutor.swift index 062ff61..27bb805 100644 --- a/Transloadit/Classes/TransloaditExecutor.swift +++ b/Transloadit/Classes/TransloaditExecutor.swift @@ -56,8 +56,8 @@ class TransloaditExecutor: TUSDelegate { self.urlRequest(withMethod: "POST", andObject: object, callback: { response in if (response.success) { if object.isKind(of: Assembly.self) { - Transloadit.shared.delegate?.transloaditCreation(forObject: object as! Assembly, withResult: response) - TUSClient.shared.uploadURL = URL(string: response.tusURL)! + print(response.tusURL) + TUSClient.shared.uploadURL = URL(string: response.tusURL) //TUSClient.shared.startOrResume(forUpload: (object as! Assembly).tusUpload!, withExisitingURL: "") (object as! Assembly).tusUpload?.metadata = ["fieldname": "file-input", "assembly_url": response.assemblyURL, @@ -72,7 +72,7 @@ class TransloaditExecutor: TUSDelegate { } else { if object.isKind(of: Assembly.self) { - Transloadit.shared.delegate?.transloaditCreation(forObject: object as! Assembly, withResult: response) +// Transloadit.shared.delegate?.transloaditCreationResult(forObject: object) } if object.isKind(of: Template.self) { // Transloadit.shared.delegate?.transloaditTemplateCreationError() @@ -238,10 +238,10 @@ class TransloaditExecutor: TUSDelegate { } } catch let error as NSError { print(error) - transloaditResponse.error = error.debugDescription - callback(transloaditResponse) - } + //let outputStr = String(data: data!, encoding: String.Encoding.utf8) as String! + // print(outputStr) + } From d98a7c94cb2fbfcd77bd7cb99db7abcceac148ca Mon Sep 17 00:00:00 2001 From: "Mark R. Masterson" Date: Sun, 21 Mar 2021 17:02:21 -0700 Subject: [PATCH 3/4] Revert "Revert "TUSKit version bump, tweaked example response a bit"" This reverts commit 9bc05ee2450c049dda5a95681792bad0030853d9. --- Example/Podfile.lock | 10 +++++----- Example/Transloadit/ViewController.swift | 7 ++++++- Transloadit.podspec | 4 ++-- Transloadit/Classes/Assembly.swift | 5 +---- Transloadit/Classes/TransloaditExecutor.swift | 12 ++++++------ 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 4b8ee94..3582d2a 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -11,9 +11,9 @@ PODS: - FBSnapshotTestCase (~> 2.0) - Nimble (~> 7.0) - Quick (1.2.0) - - Transloadit (2.1.1.alpha): - - TUSKit (~> 2.1.5.alpha) - - TUSKit (2.1.5.alpha) + - Transloadit (2.1.0): + - TUSKit (~> 2.1.0) + - TUSKit (2.1.0) DEPENDENCIES: - FBSnapshotTestCase (~> 2.1.4) @@ -39,8 +39,8 @@ SPEC CHECKSUMS: Nimble: 051e3d8912d40138fa5591c78594f95fb172af37 Nimble-Snapshots: f5459b5b091678dc942d03ec4741cacb58ba4a52 Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08 - Transloadit: 04579bc6c47e394226ad990dcd1f50988c8cf2cd - TUSKit: 848e7da5efd00aedb649e838ff968fb11dd664d5 + Transloadit: 37ec9471fb4d82119bcd788e6a0305995642fd9f + TUSKit: 2fe53b42c248596a219c991096ca785997e72eb2 PODFILE CHECKSUM: c54fe98a78e285d7620018f91160940d9909bc2a diff --git a/Example/Transloadit/ViewController.swift b/Example/Transloadit/ViewController.swift index 46baf41..875bbd3 100644 --- a/Example/Transloadit/ViewController.swift +++ b/Example/Transloadit/ViewController.swift @@ -94,7 +94,12 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig func transloaditProcessing(forObject: APIObject, withResult: TransloaditResponse) { if (withResult.success) { - print("We did it!") + if(withResult.processing) { + print("Processing") + } else { + var assembly: Assembly = forObject as! Assembly + print("Processed") + } } else { print(withResult.error) } diff --git a/Transloadit.podspec b/Transloadit.podspec index 329cee4..a292e78 100644 --- a/Transloadit.podspec +++ b/Transloadit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'Transloadit' - s.version = '2.0.1' + s.version = '2.1.0' s.summary = 'A short description of Transloadit.' s.swift_version = '5.0' @@ -40,5 +40,5 @@ TODO: Add long description of the pod here. # s.public_header_files = 'Pod/Classes/**/*.h' # s.frameworks = 'UIKit', 'MapKit' # s.dependency 'AFNetworking', '~> 2.3' - s.dependency 'TUSKit', '~> 2.0.0' + s.dependency 'TUSKit', '~> 2.1.0' end diff --git a/Transloadit/Classes/Assembly.swift b/Transloadit/Classes/Assembly.swift index a7c3b69..5a7448f 100644 --- a/Transloadit/Classes/Assembly.swift +++ b/Transloadit/Classes/Assembly.swift @@ -13,7 +13,7 @@ public class Assembly: APIObject { var numberOfFiles: Int? internal var tusUpload: TUSUpload? - internal var assemblyURL: String? + public var assemblyURL: String? internal var steps: NSMutableDictionary = [:] @@ -25,9 +25,6 @@ public class Assembly: APIObject { } - public func addFile(withData: Data) { - - } public func addFile(withPathURL: URL) { tusUpload = TUSUpload(withId: withPathURL.lastPathComponent, andFilePathURL: withPathURL, andFileType: withPathURL.pathExtension) diff --git a/Transloadit/Classes/TransloaditExecutor.swift b/Transloadit/Classes/TransloaditExecutor.swift index 27bb805..062ff61 100644 --- a/Transloadit/Classes/TransloaditExecutor.swift +++ b/Transloadit/Classes/TransloaditExecutor.swift @@ -56,8 +56,8 @@ class TransloaditExecutor: TUSDelegate { self.urlRequest(withMethod: "POST", andObject: object, callback: { response in if (response.success) { if object.isKind(of: Assembly.self) { - print(response.tusURL) - TUSClient.shared.uploadURL = URL(string: response.tusURL) + Transloadit.shared.delegate?.transloaditCreation(forObject: object as! Assembly, withResult: response) + TUSClient.shared.uploadURL = URL(string: response.tusURL)! //TUSClient.shared.startOrResume(forUpload: (object as! Assembly).tusUpload!, withExisitingURL: "") (object as! Assembly).tusUpload?.metadata = ["fieldname": "file-input", "assembly_url": response.assemblyURL, @@ -72,7 +72,7 @@ class TransloaditExecutor: TUSDelegate { } else { if object.isKind(of: Assembly.self) { -// Transloadit.shared.delegate?.transloaditCreationResult(forObject: object) + Transloadit.shared.delegate?.transloaditCreation(forObject: object as! Assembly, withResult: response) } if object.isKind(of: Template.self) { // Transloadit.shared.delegate?.transloaditTemplateCreationError() @@ -238,10 +238,10 @@ class TransloaditExecutor: TUSDelegate { } } catch let error as NSError { print(error) + transloaditResponse.error = error.debugDescription + callback(transloaditResponse) + } - //let outputStr = String(data: data!, encoding: String.Encoding.utf8) as String! - // print(outputStr) - } From 412c7519dba436383632a4677378837558dd2c0b Mon Sep 17 00:00:00 2001 From: "Mark R. Masterson" Date: Sun, 21 Mar 2021 17:02:58 -0700 Subject: [PATCH 4/4] Update Transloadit.podspec --- Transloadit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Transloadit.podspec b/Transloadit.podspec index a292e78..55756d8 100644 --- a/Transloadit.podspec +++ b/Transloadit.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'Transloadit' - s.version = '2.1.0' + s.version = '2.0.2' s.summary = 'A short description of Transloadit.' s.swift_version = '5.0'