From 06908b1c015acd878ec9823c3cc5c6e5c3439a8e Mon Sep 17 00:00:00 2001 From: Jessy Catterwaul Date: Fri, 1 Apr 2022 03:59:27 -0400 Subject: [PATCH 1/3] Update GitHub workflows --- .github/workflows/appstore-upload.yml | 6 +- .github/workflows/run_tests.yml | 6 +- .github/workflows/swiftlint.yml | 2 +- .github/workflows/testflight-beta.yml | 6 +- .github/workflows/testflight-release.yml | 6 +- Emitron/Gemfile | 2 +- Emitron/Gemfile.lock | 170 ++++++++++++----------- 7 files changed, 105 insertions(+), 93 deletions(-) diff --git a/.github/workflows/appstore-upload.yml b/.github/workflows/appstore-upload.yml index 80eb03e1..94b4fb84 100644 --- a/.github/workflows/appstore-upload.yml +++ b/.github/workflows/appstore-upload.yml @@ -7,11 +7,11 @@ on: jobs: build: - runs-on: macos-11 + runs-on: macos-12 steps: - uses: actions/checkout@v1 - - name: Switch to Xcode 13.2.1 - run: sudo xcode-select -s /Applications/Xcode_13.2.1.app + - name: Switch to Xcode 13.3.1 + run: sudo xcode-select -s /Applications/Xcode_13.3.1.app - name: Update fastlane run: | cd Emitron diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index bb34aa6e..8f51a51a 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -6,11 +6,11 @@ on: jobs: build: - runs-on: macos-11 + runs-on: macos-12 steps: - uses: actions/checkout@v1 - - name: Switch to Xcode 13.2.1 - run: sudo xcode-select -s /Applications/Xcode_13.2.1.app + - name: Switch to Xcode 13.3.1 + run: sudo xcode-select -s /Applications/Xcode_13.3.1.app - name: Update fastlane run: | cd Emitron diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml index 934ea9d2..275cf23f 100644 --- a/.github/workflows/swiftlint.yml +++ b/.github/workflows/swiftlint.yml @@ -9,7 +9,7 @@ on: jobs: SwiftLint: - runs-on: macos-11 + runs-on: macos-12 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/testflight-beta.yml b/.github/workflows/testflight-beta.yml index 1d039b72..e3c1916f 100644 --- a/.github/workflows/testflight-beta.yml +++ b/.github/workflows/testflight-beta.yml @@ -7,11 +7,11 @@ on: jobs: build: - runs-on: macos-11 + runs-on: macos-12 steps: - uses: actions/checkout@v1 - - name: Switch to Xcode 13.2.1 - run: sudo xcode-select -s /Applications/Xcode_13.2.1.app + - name: Switch to Xcode 13.3.1 + run: sudo xcode-select -s /Applications/Xcode_13.3.1.app - name: Update fastlane run: | cd Emitron diff --git a/.github/workflows/testflight-release.yml b/.github/workflows/testflight-release.yml index adb84e20..c234e2be 100644 --- a/.github/workflows/testflight-release.yml +++ b/.github/workflows/testflight-release.yml @@ -7,11 +7,11 @@ on: jobs: build: - runs-on: macos-11 + runs-on: macos-12 steps: - uses: actions/checkout@v1 - - name: Switch to Xcode 13.2.1 - run: sudo xcode-select -s /Applications/Xcode_13.2.1.app + - name: Switch to Xcode 13.3.1 + run: sudo xcode-select -s /Applications/Xcode_13.3.1.app - name: Update fastlane run: | cd Emitron diff --git a/Emitron/Gemfile b/Emitron/Gemfile index 8c88f285..7438615f 100644 --- a/Emitron/Gemfile +++ b/Emitron/Gemfile @@ -1,3 +1,3 @@ source 'https://rubygems.org' -gem 'fastlane', '~> 2.139' +gem 'fastlane', '~> 2.205' diff --git a/Emitron/Gemfile.lock b/Emitron/Gemfile.lock index 59136921..47ea40f6 100644 --- a/Emitron/Gemfile.lock +++ b/Emitron/Gemfile.lock @@ -1,65 +1,80 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.3) + CFPropertyList (3.0.5) + rexml addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) artifactory (3.0.15) atomos (0.1.3) - aws-eventstream (1.1.1) - aws-partitions (1.447.0) - aws-sdk-core (3.114.0) + aws-eventstream (1.2.0) + aws-partitions (1.581.0) + aws-sdk-core (3.130.2) aws-eventstream (~> 1, >= 1.0.2) - aws-partitions (~> 1, >= 1.239.0) + aws-partitions (~> 1, >= 1.525.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.43.0) - aws-sdk-core (~> 3, >= 3.112.0) + aws-sdk-kms (1.56.0) + aws-sdk-core (~> 3, >= 3.127.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.93.1) - aws-sdk-core (~> 3, >= 3.112.0) + aws-sdk-s3 (1.113.2) + aws-sdk-core (~> 3, >= 3.127.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.3) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.5.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) - claide (1.0.3) + claide (1.1.0) colored (1.2) colored2 (3.1.2) - commander-fastlane (4.4.6) - highline (~> 1.7.2) + commander (4.6.0) + highline (~> 2.0.0) declarative (0.0.20) - digest-crc (0.6.3) + digest-crc (0.6.4) rake (>= 12.0.0, < 14.0.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dotenv (2.7.6) - emoji_regex (3.2.2) - excon (0.80.1) - faraday (1.4.1) + emoji_regex (3.2.3) + excon (0.92.3) + faraday (1.10.0) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.1) - multipart-post (>= 1.2, < 3) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) ruby2_keywords (>= 0.0.4) faraday-cookie_jar (0.0.7) faraday (>= 0.8.0) http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.3) + multipart-post (>= 1.2, < 3) faraday-net_http (1.0.1) - faraday-net_http_persistent (1.1.0) - faraday_middleware (1.0.0) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.0) faraday (~> 1.0) - fastimage (2.2.3) - fastlane (2.181.0) + fastimage (2.2.6) + fastlane (2.205.2) CFPropertyList (>= 2.3, < 4.0.0) - addressable (>= 2.3, < 3.0.0) + addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) aws-sdk-s3 (~> 1.0) babosa (>= 1.0.3, < 2.0.0) bundler (>= 1.12.0, < 3.0.0) colored - commander-fastlane (>= 4.4.6, < 5.0.0) + commander (~> 4.6) dotenv (>= 2.1.1, < 3.0.0) emoji_regex (>= 0.1, < 4.0) excon (>= 0.71.0, < 1.0.0) @@ -68,19 +83,20 @@ GEM faraday_middleware (~> 1.0) fastimage (>= 2.1.0, < 3.0.0) gh_inspector (>= 1.1.2, < 2.0.0) - google-api-client (>= 0.37.0, < 0.39.0) - google-cloud-storage (>= 1.15.0, < 2.0.0) - highline (>= 1.7.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-storage (~> 1.31) + highline (~> 2.0) json (< 3.0.0) jwt (>= 2.1.0, < 3) mini_magick (>= 4.9.4, < 5.0.0) multipart-post (~> 2.0.0) naturally (~> 2.2) + optparse (~> 0.1.1) plist (>= 3.1.0, < 4.0.0) rubyzip (>= 2.0.0, < 3.0.0) security (= 0.1.3) simctl (~> 1.6.3) - slack-notifier (>= 2.0.0, < 3.0.0) terminal-notifier (>= 2.0.0, < 3.0.0) terminal-table (>= 1.4.5, < 2.0.0) tty-screen (>= 0.6.3, < 1.0.0) @@ -90,67 +106,63 @@ GEM xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) gh_inspector (1.1.3) - google-api-client (0.38.0) - addressable (~> 2.5, >= 2.5.1) - googleauth (~> 0.9) - httpclient (>= 2.8.1, < 3.0) - mini_mime (~> 1.0) - representable (~> 3.0) - retriable (>= 2.0, < 4.0) - signet (~> 0.12) - google-apis-core (0.3.0) + google-apis-androidpublisher_v3 (0.19.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-core (0.4.2) addressable (~> 2.5, >= 2.5.1) - googleauth (~> 0.14) - httpclient (>= 2.8.1, < 3.0) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) mini_mime (~> 1.0) representable (~> 3.0) - retriable (>= 2.0, < 4.0) + retriable (>= 2.0, < 4.a) rexml - signet (~> 0.14) webrick - google-apis-iamcredentials_v1 (0.3.0) - google-apis-core (~> 0.1) - google-apis-storage_v1 (0.3.0) - google-apis-core (~> 0.1) + google-apis-iamcredentials_v1 (0.10.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-playcustomapp_v1 (0.7.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-storage_v1 (0.13.0) + google-apis-core (>= 0.4, < 2.a) google-cloud-core (1.6.0) google-cloud-env (~> 1.0) google-cloud-errors (~> 1.0) - google-cloud-env (1.5.0) - faraday (>= 0.17.3, < 2.0) - google-cloud-errors (1.1.0) - google-cloud-storage (1.31.0) - addressable (~> 2.5) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) + google-cloud-errors (1.2.0) + google-cloud-storage (1.36.2) + addressable (~> 2.8) digest-crc (~> 0.4) google-apis-iamcredentials_v1 (~> 0.1) google-apis-storage_v1 (~> 0.1) - google-cloud-core (~> 1.2) - googleauth (~> 0.9) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (0.16.1) - faraday (>= 0.17.3, < 2.0) + googleauth (1.1.3) + faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) - signet (~> 0.14) - highline (1.7.10) - http-cookie (1.0.3) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.4) domain_name (~> 0.5) httpclient (2.8.3) - jmespath (1.4.0) - json (2.5.1) - jwt (2.2.3) + jmespath (1.6.1) + json (2.6.1) + jwt (2.3.0) memoist (0.16.2) mini_magick (4.11.0) - mini_mime (1.1.0) + mini_mime (1.1.2) multi_json (1.15.0) multipart-post (2.0.0) nanaimo (0.3.0) naturally (2.2.1) - os (1.1.1) + optparse (0.1.1) + os (1.1.4) plist (3.6.0) - public_suffix (4.0.6) - rake (13.0.3) + public_suffix (4.0.7) + rake (13.0.6) representable (3.1.1) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) @@ -158,22 +170,21 @@ GEM retriable (3.1.2) rexml (3.2.5) rouge (2.0.7) - ruby2_keywords (0.0.4) - rubyzip (2.3.0) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) security (0.1.3) - signet (0.15.0) - addressable (~> 2.3) - faraday (>= 0.17.3, < 2.0) + signet (0.16.1) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.0) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) simctl (1.6.8) CFPropertyList naturally - slack-notifier (2.3.2) terminal-notifier (2.0.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - trailblazer-option (0.1.1) + trailblazer-option (0.1.2) tty-cursor (0.7.1) tty-screen (0.8.1) tty-spinner (0.9.3) @@ -181,26 +192,27 @@ GEM uber (0.1.0) unf (0.1.4) unf_ext - unf_ext (0.0.7.7) - unicode-display_width (1.7.0) + unf_ext (0.0.8.1) + unicode-display_width (1.8.0) webrick (1.7.0) word_wrap (1.0.0) - xcodeproj (1.19.0) + xcodeproj (1.21.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) + rexml (~> 3.2.4) xcpretty (0.3.0) rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) PLATFORMS - ruby + universal-darwin-21 DEPENDENCIES - fastlane (~> 2.139) + fastlane (~> 2.205) BUNDLED WITH - 2.1.4 + 2.3.12 From a1a4c4258bb71e90b2be17e67e0bae7adde08ae4 Mon Sep 17 00:00:00 2001 From: Jessy Catterwaul Date: Fri, 1 Apr 2022 14:35:06 -0400 Subject: [PATCH 2/3] Use existential `any` --- Emitron/Emitron/Downloads/DownloadService.swift | 2 +- Emitron/Emitron/Networking/Services/VideosService.swift | 2 +- Emitron/Emitron/Persistence/PersistenceStore.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Emitron/Emitron/Downloads/DownloadService.swift b/Emitron/Emitron/Downloads/DownloadService.swift index 47aa0232..8ca5923d 100644 --- a/Emitron/Emitron/Downloads/DownloadService.swift +++ b/Emitron/Emitron/Downloads/DownloadService.swift @@ -71,7 +71,7 @@ final class DownloadService: ObservableObject { private let userModelController: UserModelController private var userModelControllerSubscription: AnyCancellable? private let videosServiceProvider: VideosService.Provider - private var videosService: VideosServiceProtocol? + private var videosService: (any VideosServiceProtocol)? private let queueManager: DownloadQueueManager private let downloadProcessor: DownloadProcessor private var processingSubscriptions = Set() diff --git a/Emitron/Emitron/Networking/Services/VideosService.swift b/Emitron/Emitron/Networking/Services/VideosService.swift index e0f33adf..d9159664 100644 --- a/Emitron/Emitron/Networking/Services/VideosService.swift +++ b/Emitron/Emitron/Networking/Services/VideosService.swift @@ -29,7 +29,7 @@ import class Foundation.URLSession protocol VideosServiceProtocol { - typealias Provider = (RWAPI) -> VideosServiceProtocol + typealias Provider = (RWAPI) -> any VideosServiceProtocol func videoStream(for id: Int) async throws -> StreamVideoRequest.Response func videoStreamDownload(for id: Int) async throws -> StreamVideoRequest.Response diff --git a/Emitron/Emitron/Persistence/PersistenceStore.swift b/Emitron/Emitron/Persistence/PersistenceStore.swift index fbc1108c..5908cde6 100644 --- a/Emitron/Emitron/Persistence/PersistenceStore.swift +++ b/Emitron/Emitron/Persistence/PersistenceStore.swift @@ -37,7 +37,7 @@ final class PersistenceStore: ObservableObject { case keychainFailure } - let db: DatabaseWriter + let db: any DatabaseWriter init(db: DB) { self.db = db From 77925bd28d44e25a98fcd78f5dae481b5bf3e402 Mon Sep 17 00:00:00 2001 From: Jessy Catterwaul Date: Sun, 3 Apr 2022 23:45:08 -0400 Subject: [PATCH 3/3] Use computed property instead of method --- .../Downloads/DownloadQueueManagerTest.swift | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Emitron/emitronTests/Downloads/DownloadQueueManagerTest.swift b/Emitron/emitronTests/Downloads/DownloadQueueManagerTest.swift index bca9c841..f62ca202 100644 --- a/Emitron/emitronTests/Downloads/DownloadQueueManagerTest.swift +++ b/Emitron/emitronTests/Downloads/DownloadQueueManagerTest.swift @@ -68,7 +68,7 @@ final class DownloadQueueManagerTest: XCTestCase, DatabaseTestCase { func testPendingStreamSendsNewDownloads() async throws { let recorder = queueManager.pendingStream.record() - var download = try await sampleDownload() + var download = try await sampleDownload download = try await database.write { [download] db in try download.saved(db) } @@ -79,7 +79,7 @@ final class DownloadQueueManagerTest: XCTestCase, DatabaseTestCase { } func testPendingStreamSendingPreExistingDownloads() async throws { - var download = try await sampleDownload() + var download = try await sampleDownload download = try await database.write { [download] db in try download.saved(db) } @@ -207,15 +207,17 @@ final class DownloadQueueManagerTest: XCTestCase, DatabaseTestCase { // MARK: - private private extension DownloadQueueManagerTest { - func sampleDownload() async throws -> Download { - let screencast = ContentTest.Mocks.screencast - let result = try await downloadService.requestDownload(contentID: screencast.0.id) { _ in - .init(content: screencast.0, cacheUpdate: screencast.1) - } + var sampleDownload: Download { + get async throws { + let screencast = ContentTest.Mocks.screencast + let result = try await downloadService.requestDownload(contentID: screencast.0.id) { _ in + .init(content: screencast.0, cacheUpdate: screencast.1) + } - XCTAssertEqual(result, .downloadRequestedButQueueInactive) + XCTAssertEqual(result, .downloadRequestedButQueueInactive) - return try XCTUnwrap(allDownloads.first) + return try XCTUnwrap(allDownloads.first) + } } @discardableResult func samplePersistedDownload(state: Download.State = .pending) async throws -> Download {