Skip to content

Commit 01f66a2

Browse files
Merge pull request #13 from apivideo/feature/swift5_progressive_upload_protocol
feat(swift5): Use a protocol for progressive upload session
2 parents a0f60fb + 354c6c5 commit 01f66a2

File tree

7 files changed

+20
-7
lines changed

7 files changed

+20
-7
lines changed

.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Sources/SynchronizedDictionary.swift
3333
Sources/Upload/ChunkInputStream.swift
3434
Sources/Upload/FileChunksBuilder.swift
3535
Sources/Upload/FileReaders.swift
36+
Sources/Upload/ProgressiveUploadSessioning.swift
3637
docs/AccessToken.md
3738
docs/AuthenticatePayload.md
3839
docs/AuthenticationAPI.md

ApiVideoUploader.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Pod::Spec.new do |s|
44
s.osx.deployment_target = '10.12'
55
s.tvos.deployment_target = '10.0'
66
s.watchos.deployment_target = '3.0'
7-
s.version = '0.1.0'
8-
s.source = { :git => 'https://github.com/apivideo/api.video-ios-uploader', :tag => 'v0.1.0' }
7+
s.version = '0.1.1'
8+
s.source = { :git => 'https://github.com/apivideo/api.video-ios-uploader', :tag => 'v0.1.1' }
99
s.authors = { 'Ecosystem Team' => 'ecosystem@api.video' }
1010
s.license = { :type => 'MIT' }
1111
s.homepage = 'https://docs.api.video'

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
All changes to this project will be documented in this file.
33

4+
## [0.1.1] - 2021-12-14
5+
- Add a protocol for progressive upload session
6+
47
## [0.1.0] - 2021-12-06
58
- Initial release of generated version
69

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ It allows you to upload videos in two ways:
3939
Specify it in your `Cartfile`:
4040

4141
```
42-
github "apivideo/api.video-ios-uploader" ~> 0.1.0
42+
github "apivideo/api.video-ios-uploader" ~> 0.1.1
4343
```
4444

4545
Run `carthage update`
4646

4747
### CocoaPods
4848

49-
Add `pod 'ApiVideoUploader', '0.1.0'` in your `Podfile`
49+
Add `pod 'ApiVideoUploader', '0.1.1'` in your `Podfile`
5050

5151
Run `pod install`
5252

Sources/APIs/VideosAPI.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ open class VideosAPI {
7878
return ProgressiveUploadWithUploadTokenSession(token: token)
7979
}
8080

81-
open class ProgressiveUploadWithUploadTokenSession {
81+
open class ProgressiveUploadWithUploadTokenSession: ProgressiveUploadSessioning {
8282
private var partId = 1
8383
private var fileReader = FilePartsReader()
8484
private var videoId: String? = nil
@@ -270,7 +270,7 @@ open class VideosAPI {
270270
return ProgressiveUploadSession(videoId: videoId)
271271
}
272272

273-
open class ProgressiveUploadSession {
273+
open class ProgressiveUploadSession: ProgressiveUploadSessioning {
274274
private var partId = 1
275275
private var fileReader = FilePartsReader()
276276

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// ProgressiveUploadSessioning.swift
2+
//
3+
4+
import Foundation
5+
6+
protocol ProgressiveUploadSessioning {
7+
func uploadPart(file: URL, onProgressReady: ((Progress) -> Void)?, apiResponseQueue: DispatchQueue, completion: @escaping ((_ data: Video?, _ error: Error?) -> Void)) -> URLSessionTask?
8+
func uploadLastPart(file: URL, onProgressReady: ((Progress) -> Void)?, apiResponseQueue: DispatchQueue, completion: @escaping ((_ data: Video?, _ error: Error?) -> Void)) -> URLSessionTask?
9+
}

project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ targets:
77
sources: [Sources]
88
info:
99
path: ./Info.plist
10-
version: 0.1.0
10+
version: 0.1.1
1111
settings:
1212
APPLICATION_EXTENSION_API_ONLY: true
1313
scheme: {}

0 commit comments

Comments
 (0)