Skip to content

Commit

Permalink
Merge pull request #11 from apivideo/feature/swift5_progressive_uploa…
Browse files Browse the repository at this point in the history
…d_protocol

feat(swift5): Use a protocol for progressive upload session
  • Loading branch information
bot-api-video authored Dec 14, 2021
2 parents 1383bf0 + b2bb665 commit e607ce8
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Sources/SynchronizedDictionary.swift
Sources/Upload/ChunkInputStream.swift
Sources/Upload/FileChunksBuilder.swift
Sources/Upload/FileReaders.swift
Sources/Upload/ProgressiveUploadSessioning.swift
docs/AccessToken.md
docs/AuthenticatePayload.md
docs/AuthenticationAPI.md
Expand Down
4 changes: 2 additions & 2 deletions ApiVideoClient.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '10.0'
s.watchos.deployment_target = '3.0'
s.version = '0.1.0'
s.source = { :git => 'https://github.com/apivideo/api.video-ios-client', :tag => 'v0.1.0' }
s.version = '0.1.1'
s.source = { :git => 'https://github.com/apivideo/api.video-ios-client', :tag => 'v0.1.1' }
s.authors = { 'Ecosystem Team' => 'ecosystem@api.video' }
s.license = { :type => 'MIT' }
s.homepage = 'https://docs.api.video'
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog
All changes to this project will be documented in this file.

## [0.1.1] - 2021-12-14
- Add a protocol for progressive upload session

## [0.1.0] - 2021-12-06
- Initial release
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ api.video's iOS client streamlines the coding process. Chunking files is handled
Specify it in your `Cartfile`:

```
github "apivideo/api.video-ios-client" ~> 0.1.0
github "apivideo/api.video-ios-client" ~> 0.1.1
```

Run `carthage update`

### CocoaPods

Add `pod 'ApiVideoClient', '0.1.0'` in your `Podfile`
Add `pod 'ApiVideoClient', '0.1.1'` in your `Podfile`

Run `pod install`

Expand Down
4 changes: 2 additions & 2 deletions Sources/APIs/VideosAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ open class VideosAPI {
return ProgressiveUploadWithUploadTokenSession(token: token)
}

open class ProgressiveUploadWithUploadTokenSession {
open class ProgressiveUploadWithUploadTokenSession: ProgressiveUploadSessioning {
private var partId = 1
private var fileReader = FilePartsReader()
private var videoId: String? = nil
Expand Down Expand Up @@ -659,7 +659,7 @@ open class VideosAPI {
return ProgressiveUploadSession(videoId: videoId)
}

open class ProgressiveUploadSession {
open class ProgressiveUploadSession: ProgressiveUploadSessioning {
private var partId = 1
private var fileReader = FilePartsReader()

Expand Down
9 changes: 9 additions & 0 deletions Sources/Upload/ProgressiveUploadSessioning.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// ProgressiveUploadSessioning.swift
//

import Foundation

protocol ProgressiveUploadSessioning {
func uploadPart(file: URL, onProgressReady: ((Progress) -> Void)?, apiResponseQueue: DispatchQueue, completion: @escaping ((_ data: Video?, _ error: Error?) -> Void)) -> URLSessionTask?
func uploadLastPart(file: URL, onProgressReady: ((Progress) -> Void)?, apiResponseQueue: DispatchQueue, completion: @escaping ((_ data: Video?, _ error: Error?) -> Void)) -> URLSessionTask?
}
2 changes: 1 addition & 1 deletion project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ targets:
sources: [Sources]
info:
path: ./Info.plist
version: 0.1.0
version: 0.1.1
settings:
APPLICATION_EXTENSION_API_ONLY: true
scheme: {}
Expand Down

0 comments on commit e607ce8

Please sign in to comment.