Skip to content

Commit 280e8ae

Browse files
committed
Merge remote-tracking branch 'origin/master' into snappy2
2 parents cc3b51a + 1793deb commit 280e8ae

File tree

21 files changed

+388
-14
lines changed

21 files changed

+388
-14
lines changed

.github/workflows/functions.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ jobs:
3030
runs-on: macos-11
3131
strategy:
3232
matrix:
33-
# TODO: The --skip-tests might be removable with Xcode 13.2+
34-
target: [ios, tvos, macos --skip-tests, watchos]
33+
target: [ios, tvos, macos, watchos]
3534
steps:
3635
- uses: actions/checkout@v2
3736
- name: Setup Bundler

CoreOnly/Sources/Firebase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#endif
5252
5353
#if __has_include("FirebaseFunctions-umbrella.h")
54-
@import FirebaseFunctions;
54+
#import <FirebaseFunctions/FirebaseFunctions-Swift.h>
5555
#endif
5656
5757
#if __has_include(<FirebaseInAppMessaging/FirebaseInAppMessaging.h>)
@@ -75,7 +75,7 @@
7575
#endif
7676
7777
#if __has_include("FirebaseStorage-umbrella.h")
78-
@import FirebaseStorage;
78+
#import <FirebaseStorage/FirebaseStorage-Swift.h>
7979
#endif
8080
8181
#endif // defined(__has_include)

CoreOnly/Tests/FirebasePodTest/FirebasePodTest/AppDelegate.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import Firebase
1818
import FirebaseAnalyticsSwift
1919
import FirebaseFirestoreSwift
2020
import FirebaseInAppMessagingSwift
21-
import FirebaseStorage
2221

2322
class CoreExists: FirebaseApp {}
2423
class AnalyticsExists: Analytics {}

FirebaseCore/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
- [added] The zip and Carthage distibutions now include the Swift extension frameworks. (#7819)
44
- [changed] **Breaking change**: Update the minimum supported versions for the zip and Carthage
55
distributions to iOS 11.0, tvOS 11.0 and macOS 10.13. (#9633)
6+
- [changed] **Breaking change**: CocoaPods Podfiles must include `use_frameworks!` or
7+
`use_frameworks! :linkage => :static`.
8+
- [deprecated] Usage of the Firebase pod, the Firebase module (`import Firebase`), and `Firebase.h`
9+
is deprecated. Use the specific Firebase product instead like: `pod 'FirebaseMessaging'` and
10+
`import FirebaseMessaging`.
11+
- [changed] For Swift Package Manager installations, `import Firebase` will no longer implicitly
12+
import Firebase Storage and Firebase Functions APIs. Use `import FirebaseStorage` and
13+
`import FirebaseFunctions`.
14+
- [changed] C++/Objective C++ clients should use `#import <FirebaseFunctions/FirebaseFunctions-Swift.h>`
15+
and `#import <FirebaseStorage/FirebaseStorage-Swift.h>` to access Functions and Storage APIs,
16+
respectively. C++/Objective C++ clients using Swift Package Manager should find alternative
17+
workarounds at https://forums.swift.org/t/importing-swift-libraries-from-objective-c/56730.
618

719
# Firebase 8.10.0
820
- [fixed] Fixed platform availability checks in Swift Package Manager that may prevent code

FirebaseFunctions.podspec

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ Cloud Functions for Firebase.
4545
s.dependency 'FirebaseSharedSwift', '~> 9.0'
4646
s.dependency 'GTMSessionFetcher/Core', '~> 1.5'
4747

48+
s.test_spec 'objc' do |objc_tests|
49+
objc_tests.platforms = {
50+
:ios => ios_deployment_target,
51+
:osx => '10.15',
52+
:tvos => tvos_deployment_target
53+
}
54+
objc_tests.source_files = [
55+
'FirebaseFunctions/Tests/ObjCIntegration/ObjC*'
56+
]
57+
end
58+
4859
s.test_spec 'integration' do |int_tests|
4960
int_tests.platforms = {
5061
:ios => ios_deployment_target,

FirebaseFunctions/Tests/ObjCIntegration/ObjCAPITests.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ - (void)apis {
3535

3636
FIRHTTPSCallable *callable = [func HTTPSCallableWithName:@"name"];
3737

38-
[func useEmulatorWithHost:@"host" port:@"port"];
38+
[func useEmulatorWithHost:@"host" port:123];
3939

4040
#pragma mark - HTTPSCallable and HTTPSCallableResult
4141
[callable
@@ -73,5 +73,6 @@ - (FIRFunctionsErrorCode)errorCodes:(NSError *)error {
7373
case FIRFunctionsErrorCodeUnauthenticated:
7474
return error.code;
7575
}
76+
return error.code;
7677
}
7778
@end
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#import <XCTest/XCTest.h>
16+
17+
#import <FirebaseFunctions/FirebaseFunctions-Swift.h>
18+
#import "FirebaseCore/FirebaseCore.h"
19+
20+
@interface ObjCPPAPICoverage : XCTestCase
21+
@end
22+
23+
@implementation ObjCPPAPICoverage
24+
25+
- (void)apis {
26+
#pragma mark - Functions
27+
28+
FIRApp *app = [FIRApp defaultApp];
29+
FIRFunctions *func = [FIRFunctions functions];
30+
func = [FIRFunctions functionsForApp:app];
31+
func = [FIRFunctions functionsForRegion:@"my-region"];
32+
func = [FIRFunctions functionsForCustomDomain:@"my-domain"];
33+
func = [FIRFunctions functionsForApp:app region:@"my-region"];
34+
func = [FIRFunctions functionsForApp:app customDomain:@"my-domain"];
35+
36+
FIRHTTPSCallable *callable = [func HTTPSCallableWithName:@"name"];
37+
38+
[func useEmulatorWithHost:@"host" port:123];
39+
40+
#pragma mark - HTTPSCallable and HTTPSCallableResult
41+
[callable
42+
callWithCompletion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
43+
__unused id data = result.data;
44+
}];
45+
[callable callWithObject:nil
46+
completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
47+
[result data];
48+
}];
49+
callable.timeoutInterval = 60;
50+
[callable timeoutInterval];
51+
}
52+
53+
#pragma mark - FunctionsError
54+
55+
- (FIRFunctionsErrorCode)errorCodes:(NSError *)error {
56+
switch (error.code) {
57+
case FIRFunctionsErrorCodeOK:
58+
case FIRFunctionsErrorCodeCancelled:
59+
case FIRFunctionsErrorCodeUnknown:
60+
case FIRFunctionsErrorCodeInvalidArgument:
61+
case FIRFunctionsErrorCodeDeadlineExceeded:
62+
case FIRFunctionsErrorCodeNotFound:
63+
case FIRFunctionsErrorCodeAlreadyExists:
64+
case FIRFunctionsErrorCodePermissionDenied:
65+
case FIRFunctionsErrorCodeResourceExhausted:
66+
case FIRFunctionsErrorCodeFailedPrecondition:
67+
case FIRFunctionsErrorCodeAborted:
68+
case FIRFunctionsErrorCodeOutOfRange:
69+
case FIRFunctionsErrorCodeUnimplemented:
70+
case FIRFunctionsErrorCodeInternal:
71+
case FIRFunctionsErrorCodeUnavailable:
72+
case FIRFunctionsErrorCodeDataLoss:
73+
case FIRFunctionsErrorCodeUnauthenticated:
74+
return (FIRFunctionsErrorCode)error.code;
75+
}
76+
return (FIRFunctionsErrorCode)error.code;
77+
}
78+
@end

FirebaseStorage.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Firebase Storage provides robust, secure file uploads and downloads from Firebas
5454
}
5555
objc_tests.source_files = [
5656
'FirebaseStorageInternal/Tests/Integration/*.[mh]',
57-
'FirebaseStorage/Tests/ObjCIntegration/*.m',
57+
'FirebaseStorage/Tests/ObjCIntegration/*.{m,mm}',
5858
]
5959
objc_tests.requires_app_host = true
6060
objc_tests.resources = 'FirebaseStorageInternal/Tests/Integration/Resources/1mb.dat',

FirebaseStorage/Sources/StorageMetadata.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ import FirebaseStorageInternal
9191
}
9292
}
9393

94+
/**
95+
* Custom-Time of the object data.
96+
*/
97+
@objc public var customTime: Date? {
98+
get {
99+
return impl.customTime
100+
}
101+
set(newValue) {
102+
impl.customTime = newValue
103+
}
104+
}
105+
94106
/**
95107
* MD5 hash of the data; encoded using base64.
96108
*/

FirebaseStorage/Tests/Integration/StorageAsyncAwait.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,14 @@ import XCTest
276276

277277
private func assertMetadata(actualMetadata: StorageMetadata,
278278
expectedContentType: String,
279+
expectedCustomTime: Date,
279280
expectedCustomMetadata: [String: String]) {
280281
XCTAssertEqual(actualMetadata.cacheControl, "cache-control")
281282
XCTAssertEqual(actualMetadata.contentDisposition, "content-disposition")
282283
XCTAssertEqual(actualMetadata.contentEncoding, "gzip")
283284
XCTAssertEqual(actualMetadata.contentLanguage, "de")
284285
XCTAssertEqual(actualMetadata.contentType, expectedContentType)
286+
XCTAssertEqual(actualMetadata.customTime, expectedCustomTime)
285287
XCTAssertEqual(actualMetadata.md5Hash?.count, 24)
286288
for (key, value) in expectedCustomMetadata {
287289
XCTAssertEqual(actualMetadata.customMetadata![key], value)
@@ -294,6 +296,7 @@ import XCTest
294296
XCTAssertEqual(actualMetadata.contentEncoding, "identity")
295297
XCTAssertNil(actualMetadata.contentLanguage)
296298
XCTAssertNil(actualMetadata.contentType)
299+
XCTAssertNil(actualMetadata.customTime)
297300
XCTAssertEqual(actualMetadata.md5Hash?.count, 24)
298301
XCTAssertNil(actualMetadata.customMetadata)
299302
}
@@ -307,26 +310,31 @@ import XCTest
307310
metadata.contentEncoding = "gzip"
308311
metadata.contentLanguage = "de"
309312
metadata.contentType = "content-type-a"
313+
metadata.customTime = Date(timeIntervalSince1970: 0)
310314
metadata.customMetadata = ["a": "b"]
311315

312316
let updatedMetadata = try await ref.updateMetadata(metadata)
313317
assertMetadata(actualMetadata: updatedMetadata,
314318
expectedContentType: "content-type-a",
319+
expectedCustomTime: Date(timeIntervalSince1970: 0),
315320
expectedCustomMetadata: ["a": "b"])
316321

317322
let metadata2 = updatedMetadata
318323
metadata2.contentType = "content-type-b"
324+
metadata.customTime = Date(timeIntervalSince1970: 100)
319325
metadata2.customMetadata = ["a": "b", "c": "d"]
320326

321327
let metadata3 = try await ref.updateMetadata(metadata2)
322328
assertMetadata(actualMetadata: metadata3,
323329
expectedContentType: "content-type-b",
330+
expectedCustomTime: Date(timeIntervalSince1970: 100),
324331
expectedCustomMetadata: ["a": "b", "c": "d"])
325332
metadata.cacheControl = nil
326333
metadata.contentDisposition = nil
327334
metadata.contentEncoding = nil
328335
metadata.contentLanguage = nil
329336
metadata.contentType = nil
337+
metadata.customTime = nil
330338
metadata.customMetadata = nil
331339
let metadata4 = try await ref.updateMetadata(metadata)
332340
XCTAssertNotNil(metadata4)

FirebaseStorage/Tests/Integration/StorageIntegration.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,14 @@ class StorageResultTests: StorageIntegrationCommon {
417417

418418
private func assertMetadata(actualMetadata: StorageMetadata,
419419
expectedContentType: String,
420+
expectedCustomTime: Date,
420421
expectedCustomMetadata: [String: String]) {
421422
XCTAssertEqual(actualMetadata.cacheControl, "cache-control")
422423
XCTAssertEqual(actualMetadata.contentDisposition, "content-disposition")
423424
XCTAssertEqual(actualMetadata.contentEncoding, "gzip")
424425
XCTAssertEqual(actualMetadata.contentLanguage, "de")
425426
XCTAssertEqual(actualMetadata.contentType, expectedContentType)
427+
XCTAssertEqual(actualMetadata.customTime, expectedCustomTime)
426428
XCTAssertEqual(actualMetadata.md5Hash?.count, 24)
427429
for (key, value) in expectedCustomMetadata {
428430
XCTAssertEqual(actualMetadata.customMetadata![key], value)
@@ -435,6 +437,7 @@ class StorageResultTests: StorageIntegrationCommon {
435437
XCTAssertEqual(actualMetadata.contentEncoding, "identity")
436438
XCTAssertNil(actualMetadata.contentLanguage)
437439
XCTAssertNil(actualMetadata.contentType)
440+
XCTAssertNil(actualMetadata.customTime)
438441
XCTAssertEqual(actualMetadata.md5Hash?.count, 24)
439442
XCTAssertNil(actualMetadata.customMetadata)
440443
}
@@ -449,6 +452,7 @@ class StorageResultTests: StorageIntegrationCommon {
449452
metadata.contentEncoding = "gzip"
450453
metadata.contentLanguage = "de"
451454
metadata.contentType = "content-type-a"
455+
metadata.customTime = Date(timeIntervalSince1970: 0)
452456
metadata.customMetadata = ["a": "b"]
453457

454458
ref.updateMetadata(metadata) { updatedMetadata, error in
@@ -460,23 +464,27 @@ class StorageResultTests: StorageIntegrationCommon {
460464
}
461465
self.assertMetadata(actualMetadata: updatedMetadata,
462466
expectedContentType: "content-type-a",
467+
expectedCustomTime: Date(timeIntervalSince1970: 0),
463468
expectedCustomMetadata: ["a": "b"])
464469

465470
let metadata = updatedMetadata
466471
metadata.contentType = "content-type-b"
472+
metadata.customTime = Date(timeIntervalSince1970: 100)
467473
metadata.customMetadata = ["a": "b", "c": "d"]
468474

469475
ref.updateMetadata(metadata) { result in
470476
switch result {
471477
case let .success(updatedMetadata):
472478
self.assertMetadata(actualMetadata: updatedMetadata,
473479
expectedContentType: "content-type-b",
480+
expectedCustomTime: Date(timeIntervalSince1970: 100),
474481
expectedCustomMetadata: ["a": "b", "c": "d"])
475482
metadata.cacheControl = nil
476483
metadata.contentDisposition = nil
477484
metadata.contentEncoding = nil
478485
metadata.contentLanguage = nil
479486
metadata.contentType = nil
487+
metadata.customTime = nil
480488
metadata.customMetadata = nil
481489
ref.updateMetadata(metadata) { result in
482490
self.assertResultSuccess(result)

FirebaseStorage/Tests/ObjCIntegration/ObjCAPITests.m

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,6 @@ - (void)FIRStorageConstantsTypedefs {
115115
}
116116
#endif
117117

118-
#ifdef Firebase9Breaking
119-
- (NSString *)FIRStorageConstantsGlobal {
120-
return FIRStorageErrorDomain;
121-
}
122-
#endif
123-
124118
- (void)FIRStorageListResultApis:(FIRStorageListResult *)result {
125119
NSArray<FIRStorageReference *> __unused *prefixes = [result prefixes];
126120
NSArray<FIRStorageReference *> __unused *items = [result items];

0 commit comments

Comments
 (0)