Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/combine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ on:
# - 'FirebaseAuth/**'
# - 'FirebaseFunctions/**'
# - 'Firestore/**'
# - 'FirebaseStorageInternal/**'
# - 'FirebaseStorage/**'

schedule:
Expand Down Expand Up @@ -90,10 +89,10 @@ jobs:
run: gem install xcpretty
- name: Install Secret GoogleService-Info.plist
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/storage-db-plist.gpg \
FirebaseStorageInternal/Tests/Integration/Resources/GoogleService-Info.plist "$plist_secret"
FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist "$plist_secret"
- name: Install Credentials.h
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Storage/Credentials.h.gpg \
FirebaseStorageInternal/Tests/Integration/Credentials.h "$plist_secret"
FirebaseStorage/Tests/ObjCIntegration/Credentials.h "$plist_secret"
- name: Install Credentials.swift
run: |
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Storage/Credentials.swift.gpg \
Expand Down
29 changes: 5 additions & 24 deletions .github/workflows/storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ jobs:
run: gem install xcpretty
- name: Install Secret GoogleService-Info.plist
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/storage-db-plist.gpg \
FirebaseStorageInternal/Tests/Integration/Resources/GoogleService-Info.plist "$plist_secret"
FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist "$plist_secret"
- name: Install Credentials.h
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Storage/Credentials.h.gpg \
FirebaseStorageInternal/Tests/Integration/Credentials.h "$plist_secret"
FirebaseStorage/Tests/ObjCIntegration/Credentials.h "$plist_secret"
- name: Install Credentials.swift
run: |
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Storage/Credentials.swift.gpg \
Expand All @@ -58,8 +58,6 @@ jobs:
cache_key: ${{ matrix.os }}
- name: Initialize xcodebuild
run: scripts/setup_spm_tests.sh
- name: Objective-C Unit Tests
run: scripts/third_party/travis/retry.sh ./scripts/build.sh StorageUnit iOS spm
- name: Swift Unit Tests
run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseStorageUnit iOS spm

Expand All @@ -78,22 +76,7 @@ jobs:
- name: Initialize xcodebuild
run: scripts/setup_spm_tests.sh
- name: Unit Tests
run: scripts/third_party/travis/retry.sh ./scripts/build.sh StorageUnit ${{ matrix.target }} spm

catalyst:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
runs-on: macos-12
steps:
- uses: actions/checkout@v2
- uses: mikehardy/buildcache-action@50738c6c77de7f34e66b870e4f8ede333b69d077
with:
cache_key: ${{ matrix.os }}
- uses: ruby/setup-ruby@v1
- name: Setup Bundler
run: scripts/setup_bundler.sh
- name: Setup project and Build for Catalyst
run: scripts/test_catalyst.sh FirebaseStorageInternal test FirebaseStorageInternal-Unit-unit
run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseStorageUnit ${{ matrix.target }} spm

quickstart:
# Don't run on private repo unless it is a PR.
Expand Down Expand Up @@ -124,15 +107,14 @@ jobs:
strategy:
matrix:
target: [ios, tvos, macos, watchos]
podspec: [FirebaseStorage.podspec, FirebaseStorageInternal.podspec]
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
- name: Setup Bundler
run: scripts/setup_bundler.sh
- name: Build and test
run: |
scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb ${{ matrix.podspec }} --test-specs=unit --platforms=${{ matrix.target }}
scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseStorage.podspec --test-specs=unit --platforms=${{ matrix.target }}

storage-cron-only:
# Don't run on private repo.
Expand All @@ -141,12 +123,11 @@ jobs:
strategy:
matrix:
target: [ios, tvos, macos, watchos]
podspec: [FirebaseStorage.podspec, FirebaseStorageInternal.podspec]
needs: pod-lib-lint
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
- name: Setup Bundler
run: scripts/setup_bundler.sh
- name: PodLibLint Storage Cron
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb ${{ matrix.podspec }} --platforms=${{ matrix.target }} --use-static-frameworks --skip-tests
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseStorage.podspec --platforms=${{ matrix.target }} --use-static-frameworks --skip-tests
2 changes: 1 addition & 1 deletion .github/workflows/watchos-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'FirebaseABTesting/**'
- 'FirebaseDatabase/**'
- 'FirebaseRemoteConfig/**'
- 'FirebaseStorageInternal/**'
- 'FirebaseStorage/**'
# Sample
- 'Example/watchOSSample/**'
# Firebase Podspec
Expand Down
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ FirebaseDatabase/Tests/Resources/GoogleService-Info.plist
FirebaseRemoteConfig/Tests/Sample/GoogleService-Info.plist

# FirebaseStorage integration tests GoogleService-Info.plist
FirebaseStorageInternal/Tests/Integration/Resources/GoogleService-Info.plist
FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist

# FirebaseInstallations integration tests GoogleService-Info.plist
FirebaseInstallations/Source/Tests/Resources/GoogleService-Info.plist
Expand All @@ -24,8 +24,7 @@ FirebaseMessaging/Apps/AdvancedSample/SampleWatchWatchKitExtension/GoogleService
FirebaseMessaging/Apps/AdvancedSample/AppClips/GoogleService-Info.plist

# Credentials for Firebase Storage Integration Tests
FirebaseStorageInternal/Tests/Integration/Credentials.h
FirebaseStorageInternal/Tests/SwiftIntegration/Credentials.swift
FirebaseStorage/Tests/ObjCIntegration/Credentials.h
FirebaseStorage/Tests/Integration/Credentials.swift

# FirebaseMLModelDownloader integration tests GoogleService-Info.plist
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Alternatively, the script can be work on branch names or filenames.
```

```console
./scripts/style.sh FirebaseStorageInternal/Sources/FIRStorage.m
./scripts/style.sh FirebaseStorage/Sources/Storage.swift
```

<details>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ target 'CocoapodsIntegrationTest' do
pod 'FirebaseMessagingInterop', :path => '../'
pod 'FirebasePerformance', :path => '../'
pod 'FirebaseStorage', :path => '../'
pod 'FirebaseStorageInternal', :path => '../'
end

# Using the new speed-enhancing features available with CocoaPods 1.7+
Expand Down
1 change: 0 additions & 1 deletion CoreOnly/NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ FirebasePerformance
FirebaseRemoteConfig
FirebaseRemoteConfigSwift
FirebaseStorage
FirebaseStorageInternal
GTMSessionFetcher
GoogleDataTransport
PromisesObjC
Expand Down
1 change: 0 additions & 1 deletion CoreOnly/Tests/FirebasePodTest/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ target 'FirebasePodTest' do
pod 'FirebasePerformance', :path => '../../../'
pod 'FirebaseRemoteConfig', :path => '../../../'
pod 'FirebaseStorage', :path => '../../../'
pod 'FirebaseStorageInternal', :path => '../../../'

# Get dependent pods from the repo also
pod 'FirebaseAppCheckInterop', :path => '../../../'
Expand Down
1 change: 0 additions & 1 deletion Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ has_license_changes = didModify(["LICENSE"])
@has_remoteconfig_changes = hasChangesIn("FirebaseRemoteConfig")
@has_remoteconfig_api_changes = hasChangesIn("FirebaseRemoteConfig/Sources/Public/")
@has_storage_changes = hasChangesIn("FirebaseStorage")
@has_storage_api_changes = hasChangesIn("FirebaseStorageInternal/Sources/Public/")

@has_releasetooling_changes = hasChangesIn("ReleaseTooling/")

Expand Down
1 change: 0 additions & 1 deletion Example/watchOSSample/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ target 'SampleWatchAppWatchKitExtension' do

pod 'Firebase/Messaging', :path => '../../'
pod 'Firebase/Storage', :path => '../../'
pod 'FirebaseStorageInternal', :path => '../../'
pod 'Firebase/RemoteConfig', :path => '../../'
pod 'Firebase/ABTesting', :path => '../../'
pod 'Firebase/Database', :path => '../../'
Expand Down
16 changes: 8 additions & 8 deletions FirebaseCombineSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ for internal testing only. It should not be published.
s.osx.framework = 'AppKit'
s.tvos.framework = 'UIKit'

s.dependency 'FirebaseCore', '~> 9.0'
s.dependency 'FirebaseAuth', '~> 9.0'
s.dependency 'FirebaseFunctions', '~> 9.0'
s.dependency 'FirebaseFirestore', '~> 9.0'
s.dependency 'FirebaseStorage', '~> 9.0'
s.dependency 'FirebaseCore', '~> 9.5'
s.dependency 'FirebaseAuth', '~> 9.5'
s.dependency 'FirebaseFunctions', '~> 9.5'
s.dependency 'FirebaseFirestore', '~> 9.5'
s.dependency 'FirebaseStorage', '~> 9.5'

s.pod_target_xcconfig = {
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"',
Expand Down Expand Up @@ -97,9 +97,9 @@ for internal testing only. It should not be published.
]
int_tests.requires_app_host = true
# Resources are shared with FirebaseStorage's integration tests.
int_tests.resources = 'FirebaseStorageInternal/Tests/Integration/Resources/1mb.dat',
'FirebaseStorageInternal/Tests/Integration/Resources/GoogleService-Info.plist',
'FirebaseStorageInternal/Tests/Integration/Resources/HomeImprovement.numbers'
int_tests.resources = 'FirebaseStorage/Tests/Integration/Resources/1mb.dat',
'FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist',
'FirebaseStorage/Tests/Integration/Resources/HomeImprovement.numbers'
int_tests.dependency 'FirebaseAuth', '~> 9.0'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

#if canImport(Combine) && swift(>=5.0)

import Foundation
import Combine
import FirebaseStorage
import FirebaseStorageInternal

@available(swift 5.0)
@available(iOS 13.0, macOS 10.15, macCatalyst 13.0, tvOS 13.0, watchOS 6.0, *)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class StorageIntegration: XCTestCase {
case .finished:
XCTFail("Unexpected success return from putFile)")
case let .failure(error):
XCTAssertEqual(String(describing: error), "unknown")
XCTAssertTrue(String(describing: error).starts(with: "unknown"))
expectation.fulfill()
}
}, receiveValue: { value in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class StorageReferenceTests: XCTestCase {
.sink { completion in
if case let .failure(error) = completion {
putFileExpectation.fulfill()
XCTAssertEqual("unknown", String(describing: error))
XCTAssertTrue(String(describing: error).starts(with: "unknown"))
}
} receiveValue: { metadata in
XCTFail("💥 result unexpected")
Expand Down
15 changes: 15 additions & 0 deletions FirebaseCore/Extension/FIRLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,21 @@ extern void FIRLogInfo(FIRLoggerService service, NSString *messageCode, NSString
extern void FIRLogDebug(FIRLoggerService service, NSString *messageCode, NSString *message, ...)
NS_FORMAT_FUNCTION(3, 4);

// TODO: Come up with a better logging scheme for Swift.
/**
* Logs a message to the Xcode console and the device log. If running from AppStore, will
* not log any messages with a level higher than FirebaseLoggerLevelNotice to avoid log spamming.
* This function is intended to be used by Swift clients that do not support variadic parameters.
* (required) log level (one of the FirebaseLoggerLevel enum values).
* (required) service name of type FirebaseLoggerService.
* (required) message code starting with "I-" which means iOS, followed by a capitalized
* three-character service identifier and a six digit integer message ID that is unique
* within the service.
* An example of the message code is @"I-COR000001".
* (required) message string.
*/
extern void FIRLogDebugSwift(FIRLoggerService service, NSString *messageCode, NSString *message);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
Expand Down
5 changes: 5 additions & 0 deletions FirebaseCore/Sources/FIRLogger.m
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ void FIRLogBasic(FIRLoggerLevel level,
FIR_LOGGING_FUNCTION(Info)
FIR_LOGGING_FUNCTION(Debug)

// Swift does not support variadic function calls
void FIRLogDebugSwift(FIRLoggerService service, NSString *messageCode, NSString *message) {
FIRLogDebug(service, messageCode, @"%@", message);
}

#undef FIR_MAKE_LOGGER

#pragma mark - FIRLoggerWrapper
Expand Down
17 changes: 8 additions & 9 deletions FirebaseStorage.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ Firebase Storage provides robust, secure file uploads and downloads from Firebas
s.prefix_header_file = false

s.source_files = [
'FirebaseStorage/Sources/*.swift',
'FirebaseStorage/Sources/**/*.swift',
'FirebaseStorage/Typedefs/*.h',
]

s.dependency 'FirebaseStorageInternal', '~> 9.0'
s.dependency 'FirebaseAppCheckInterop', '~> 9.0'
s.dependency 'FirebaseAuthInterop', '~> 9.0'
s.dependency 'FirebaseCore', '~> 9.0'
s.dependency 'FirebaseCoreExtension', '~> 9.0'
s.dependency 'FirebaseCoreExtension', '~> 9.5'
s.dependency 'GTMSessionFetcher/Core', '~> 2.1'

s.test_spec 'ObjCIntegration' do |objc_tests|
objc_tests.scheme = { :code_coverage => true }
Expand All @@ -51,12 +51,11 @@ Firebase Storage provides robust, secure file uploads and downloads from Firebas
:tvos => tvos_deployment_target
}
objc_tests.source_files = [
'FirebaseStorageInternal/Tests/Integration/*.[mh]',
'FirebaseStorage/Tests/ObjCIntegration/*.{m,mm}',
]
objc_tests.requires_app_host = true
objc_tests.resources = 'FirebaseStorageInternal/Tests/Integration/Resources/1mb.dat',
'FirebaseStorageInternal/Tests/Integration/Resources/GoogleService-Info.plist'
objc_tests.resources = 'FirebaseStorage/Tests/Integration/Resources/1mb.dat',
'FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist'
objc_tests.dependency 'FirebaseAuth', '~> 9.0'
objc_tests.pod_target_xcconfig = {
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"'
Expand All @@ -82,9 +81,9 @@ Firebase Storage provides robust, secure file uploads and downloads from Firebas
}
int_tests.source_files = 'FirebaseStorage/Tests/Integration/*.swift'
int_tests.requires_app_host = true
int_tests.resources = 'FirebaseStorageInternal/Tests/Integration/Resources/1mb.dat',
'FirebaseStorageInternal/Tests/Integration/Resources/GoogleService-Info.plist',
'FirebaseStorageInternal/Tests/Integration/Resources/HomeImprovement.numbers'
int_tests.resources = 'FirebaseStorage/Tests/Integration/Resources/1mb.dat',
'FirebaseStorage/Tests/Integration/Resources/GoogleService-Info.plist',
'FirebaseStorage/Tests/Integration/Resources/HomeImprovement.numbers'
int_tests.dependency 'FirebaseAuth', '~> 9.0'
end
end
14 changes: 14 additions & 0 deletions FirebaseStorage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 10.0.0
- [changed] FirebaseStorage is now completely implemented in Swift. Swift-specific API improvements
are planned for subsequent releases. (#9963)
- [added] New API `open func reference(for url: URL) throws -> StorageReference` equivalent to
`open func reference(forURL url: String) -> StorageReference` except it throws instead of
erroring. (#6974)
- [changed] The `FirebaseStorageInternal` CocoaPod has been discontinued.
- [changed] Remove the `storageReference` property of `StorageMetadata`. It had never been implemented
and always returned `nil`.
- [changed] Storage APIs that previously threw an Objective-C exception now generate a Swift
`fatalError`.
- [changed] Storage now requires at least version 2.1 of its GTMSessionFetcher dependency.
- [changed] The localized description for `unknown` errors is now more descriptive.

# 9.2.0
- [fixed] Importing FirebaseStorage no longer exposes internal FirebaseCore APIs. (#9884)

Expand Down
4 changes: 0 additions & 4 deletions FirebaseStorage/Sources/AsyncAwait.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import Foundation
/// - Returns: Data object.
func data(maxSize: Int64) async throws -> Data {
return try await withCheckedThrowingContinuation { continuation in
// TODO: Use task to handle progress and cancellation.
_ = self.getData(maxSize: maxSize) { result in
continuation.resume(with: result)
}
Expand All @@ -51,7 +50,6 @@ import Foundation
func putDataAsync(_ uploadData: Data,
metadata: StorageMetadata? = nil) async throws -> StorageMetadata {
return try await withCheckedThrowingContinuation { continuation in
// TODO: Use task to handle progress and cancellation.
_ = self.putData(uploadData, metadata: metadata) { result in
continuation.resume(with: result)
}
Expand All @@ -70,7 +68,6 @@ import Foundation
func putFileAsync(from url: URL,
metadata: StorageMetadata? = nil) async throws -> StorageMetadata {
return try await withCheckedThrowingContinuation { continuation in
// TODO: Use task to handle progress and cancellation.
_ = self.putFile(from: url, metadata: metadata) { result in
continuation.resume(with: result)
}
Expand All @@ -87,7 +84,6 @@ import Foundation
/// - Returns: A `URL` pointing to the file path of the downloaded file.
func writeAsync(toFile fileURL: URL) async throws -> URL {
return try await withCheckedThrowingContinuation { continuation in
// TODO: Use task to handle progress and cancellation.
_ = self.write(toFile: fileURL) { result in
continuation.resume(with: result)
}
Expand Down
Loading