Skip to content

Commit 4cf46e4

Browse files
committed
Merge branch 'master' of https://github.com/firebase/firebase-ios-sdk into fix-reason-parameter
2 parents 9f6f969 + 642d304 commit 4cf46e4

31 files changed

+448
-155
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ before_install:
1313
- bundle exec pod install --project-directory=Firestore/Example --no-repo-update
1414

1515
script:
16-
- "! git grep ' $'" # Fail on trailing whitespace
16+
- "! git grep -I ' $'" # Fail on trailing whitespace in non-binary files
1717
- ./test.sh
18-
- pod lib lint FirebaseCommunity.podspec --verbose | tail -40
18+
- pod lib lint FirebaseCommunity.podspec
1919

2020
branches:
2121
only:
18.2 KB
Loading

Example/Auth/Sample/Images.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,17 @@
135135
"scale" : "2x"
136136
},
137137
{
138-
"idiom" : "ipad",
139138
"size" : "83.5x83.5",
139+
"idiom" : "ipad",
140+
"filename" : "[email protected]",
140141
"scale" : "2x"
141142
},
143+
{
144+
"size" : "1024x1024",
145+
"idiom" : "ios-marketing",
146+
"filename" : "[email protected]",
147+
"scale" : "1x"
148+
},
142149
{
143150
"idiom" : "mac",
144151
"size" : "16x16",
Loading
Loading

Example/Auth/Sample/MainViewController.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2537,7 +2537,9 @@ - (void)signInWithPhoneNumber:(NSString *_Nullable)phoneNumber
25372537
if (error) {
25382538
[self logFailure:@"failed to send verification code" error:error];
25392539
[self showMessagePrompt:error.localizedDescription];
2540-
completion(error);
2540+
if (completion) {
2541+
completion(error);
2542+
}
25412543
return;
25422544
}
25432545
[self logSuccess:@"Code sent"];

Example/Firebase.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,8 @@
334334
DE26D2561F7040B2004AE1D3 /* UserInfoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = DE26D1F51F70333E004AE1D3 /* UserInfoViewController.xib */; };
335335
DE26D2571F7040E0004AE1D3 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DE26D1DA1F70333E004AE1D3 /* Localizable.strings */; };
336336
DE26D2581F7040E4004AE1D3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DE26D1E41F70333E004AE1D3 /* Images.xcassets */; };
337-
DE26D2671F704A08004AE1D3 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = DE26D1CA1F70330A004AE1D3 /* Info.plist */; };
338337
DE26D2681F704A0C004AE1D3 /* FirebaseAuthApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DE26D1C91F70330A004AE1D3 /* FirebaseAuthApiTests.m */; };
339338
DE26D2771F705CB5004AE1D3 /* FirebaseAuthEarlGreyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DE26D1FA1F70333E004AE1D3 /* FirebaseAuthEarlGreyTests.m */; };
340-
DE26D2781F705CBC004AE1D3 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = DE26D1FB1F70333E004AE1D3 /* Info.plist */; };
341339
DE26D28F1F705F34004AE1D3 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = DE26D2001F70333E004AE1D3 /* GoogleService-Info.plist */; };
342340
DE26D2901F705F39004AE1D3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DE26D2041F70333E004AE1D3 /* Main.storyboard */; };
343341
DE26D2911F705F3E004AE1D3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DE26D2031F70333E004AE1D3 /* LaunchScreen.storyboard */; };
@@ -463,6 +461,8 @@
463461
DEE14D921E84468D006FA992 /* FIRLoggerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DEE14D791E844677006FA992 /* FIRLoggerTest.m */; };
464462
DEE14D931E84468D006FA992 /* FIROptionsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DEE14D7A1E844677006FA992 /* FIROptionsTest.m */; };
465463
DEE14D941E84468D006FA992 /* FIRTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = DEE14D7C1E844677006FA992 /* FIRTestCase.m */; };
464+
DEF288411F9AB6E100D480CF /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = DEF288401F9AB6E100D480CF /* [email protected] */; };
465+
DEF288421F9AB6E100D480CF /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = DEF288401F9AB6E100D480CF /* [email protected] */; };
466466
FFE130CF56C04A4F1F90F58C /* Pods_Core_Example_macOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 491500C8507A3B80D6FE1B61 /* Pods_Core_Example_macOS.framework */; };
467467
/* End PBXBuildFile section */
468468

@@ -1162,6 +1162,7 @@
11621162
DEE14D7B1E844677006FA992 /* FIRTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FIRTestCase.h; sourceTree = "<group>"; };
11631163
DEE14D7C1E844677006FA992 /* FIRTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FIRTestCase.m; sourceTree = "<group>"; };
11641164
DEE14D7D1E844677006FA992 /* Tests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = "<group>"; };
1165+
DEF288401F9AB6E100D480CF /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
11651166
DF22AB406738B8C54A49A248 /* Pods-Auth_Tests_iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Auth_Tests_iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-Auth_Tests_iOS/Pods-Auth_Tests_iOS.release.xcconfig"; sourceTree = "<group>"; };
11661167
E1DB278AD387CAB5D57BF135 /* Pods_Storage_IntegrationTests_macOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Storage_IntegrationTests_macOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
11671168
E27502AAA61906D3F236AD2C /* Pods-Storage_Tests_macOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Storage_Tests_macOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Storage_Tests_macOS/Pods-Storage_Tests_macOS.debug.xcconfig"; sourceTree = "<group>"; };
@@ -1796,6 +1797,7 @@
17961797
DE26D1CD1F70333E004AE1D3 /* Sample */ = {
17971798
isa = PBXGroup;
17981799
children = (
1800+
DEF288401F9AB6E100D480CF /* [email protected] */,
17991801
DE26D1EA1F70333E004AE1D3 /* Sample.entitlements */,
18001802
DE26D1EB1F70333E004AE1D3 /* SampleTemplate.entitlements */,
18011803
DE26D1CF1F70333E004AE1D3 /* ApplicationDelegate.h */,
@@ -3018,6 +3020,7 @@
30183020
DE26D2561F7040B2004AE1D3 /* UserInfoViewController.xib in Resources */,
30193021
DE26D2541F7040B2004AE1D3 /* MainViewController.xib in Resources */,
30203022
DE26D2571F7040E0004AE1D3 /* Localizable.strings in Resources */,
3023+
DEF288411F9AB6E100D480CF /* [email protected] in Resources */,
30213024
DE26D2551F7040B2004AE1D3 /* SettingsViewController.xib in Resources */,
30223025
DE26D2581F7040E4004AE1D3 /* Images.xcassets in Resources */,
30233026
);
@@ -3027,15 +3030,13 @@
30273030
isa = PBXResourcesBuildPhase;
30283031
buildActionMask = 2147483647;
30293032
files = (
3030-
DE26D2671F704A08004AE1D3 /* Info.plist in Resources */,
30313033
);
30323034
runOnlyForDeploymentPostprocessing = 0;
30333035
};
30343036
DE26D26B1F705C35004AE1D3 /* Resources */ = {
30353037
isa = PBXResourcesBuildPhase;
30363038
buildActionMask = 2147483647;
30373039
files = (
3038-
DE26D2781F705CBC004AE1D3 /* Info.plist in Resources */,
30393040
);
30403041
runOnlyForDeploymentPostprocessing = 0;
30413042
};
@@ -3044,6 +3045,7 @@
30443045
buildActionMask = 2147483647;
30453046
files = (
30463047
DE26D28F1F705F34004AE1D3 /* GoogleService-Info.plist in Resources */,
3048+
DEF288421F9AB6E100D480CF /* [email protected] in Resources */,
30473049
DE26D2901F705F39004AE1D3 /* Main.storyboard in Resources */,
30483050
DE26D2911F705F3E004AE1D3 /* LaunchScreen.storyboard in Resources */,
30493051
);

Example/Shared/Shared.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@
103103
"scale" : "2x"
104104
},
105105
{
106-
"idiom" : "ios-marketing",
107106
"size" : "1024x1024",
107+
"idiom" : "ios-marketing",
108+
"filename" : "[email protected]",
108109
"scale" : "1x"
109110
},
110111
{
Loading

Firebase/Auth/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v4.3.1
2+
- Internal clean up.
3+
14
# v4.3.0
25
- Provides account creation and last sign-in dates as metadata to the user
36
object.

Firebase/Auth/FirebaseAuth.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Pod::Spec.new do |s|
66
s.name = 'FirebaseAuth'
7-
s.version = '4.3.0'
7+
s.version = '4.3.1'
88
s.summary = 'Firebase Open Source Libraries for iOS.'
99

1010
s.description = <<-DESC

Firebase/Auth/Source/FIRAuthAppDelegateProxy.m

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ static id noop(id object, SEL cmd, ...) {
4040
}
4141
#endif
4242

43+
/** @fn isIOS9orLater
44+
@brief Checks whether the iOS version is 9 or later.
45+
@returns Whether the iOS version is 9 or later.
46+
*/
47+
static BOOL isIOS9orLater() {
48+
#if defined(__IPHONE_11_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0)
49+
if (@available(iOS 9.0, *)) {
50+
return YES;
51+
}
52+
return NO;
53+
#else
54+
// UIApplicationOpenURLOptionsAnnotationKey is only available on iOS 9+.
55+
return &UIApplicationOpenURLOptionsAnnotationKey != NULL;
56+
#endif
57+
}
58+
4359
@implementation FIRAuthAppDelegateProxy {
4460
/** @var _appDelegate
4561
@brief The application delegate whose method is being swizzled.
@@ -119,7 +135,7 @@ - (nullable instancetype)initWithApplication:(nullable UIApplication *)applicati
119135
SEL openURLOptionsSelector = @selector(application:openURL:options:);
120136
SEL openURLAnnotationSelector = @selector(application:openURL:sourceApplication:annotation:);
121137
SEL handleOpenURLSelector = @selector(application:handleOpenURL:);
122-
if (&UIApplicationOpenURLOptionsAnnotationKey && // the constant is only available on iOS 9+
138+
if (isIOS9orLater() &&
123139
([_appDelegate respondsToSelector:openURLOptionsSelector] ||
124140
(![_appDelegate respondsToSelector:openURLAnnotationSelector] &&
125141
![_appDelegate respondsToSelector:handleOpenURLSelector]))) {

Firebase/Auth/Source/FIRAuthURLPresenter.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ @interface FIRAuthURLPresenter () <SFSafariViewControllerDelegate,
3030
FIRAuthWebViewControllerDelegate>
3131
@end
3232

33+
// Disable unguarded availability warnings because SFSafariViewController is been used throughout
34+
// the code, including as an iVar, which cannot be simply excluded by @available check.
35+
#pragma clang diagnostic push
36+
#pragma clang diagnostic ignored "-Wunguarded-availability"
37+
3338
@implementation FIRAuthURLPresenter {
3439
/** @var _isPresenting
3540
@brief Whether or not some web-based content is being presented.
@@ -176,6 +181,8 @@ - (void)finishPresentationWithURL:(nullable NSURL *)URL
176181
}
177182
}
178183

184+
#pragma clang diagnostic pop // ignored "-Wunguarded-availability"
185+
179186
@end
180187

181188
NS_ASSUME_NONNULL_END

Firebase/Core/FIRApp.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
NSString *const kFIRServiceCrash = @"Crash";
2828
NSString *const kFIRServiceDatabase = @"Database";
2929
NSString *const kFIRServiceDynamicLinks = @"DynamicLinks";
30+
NSString *const kFIRServiceFirestore = @"Firestore";
3031
NSString *const kFIRServiceInstanceID = @"InstanceID";
3132
NSString *const kFIRServiceInvites = @"Invites";
3233
NSString *const kFIRServiceMessaging = @"Messaging";
3334
NSString *const kFIRServiceMeasurement = @"Measurement";
35+
NSString *const kFIRServicePerformance = @"Performance";
3436
NSString *const kFIRServiceRemoteConfig = @"RemoteConfig";
3537
NSString *const kFIRServiceStorage = @"Storage";
3638
NSString *const kGGLServiceAnalytics = @"Analytics";

Firebase/Core/FIROptions.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
NSString *const kFIRLibraryVersionID =
4343
@"4" // Major version (one or more digits)
4444
@"00" // Minor version (exactly 2 digits)
45-
@"09" // Build number (exactly 2 digits)
45+
@"10" // Build number (exactly 2 digits)
4646
@"000"; // Fixed "000"
4747
// Plist file name.
4848
NSString *const kServiceInfoFileName = @"GoogleService-Info";

FirebaseCommunity.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'FirebaseCommunity'
3-
s.version = '0.1.4'
3+
s.version = '0.1.5'
44
s.summary = 'Firebase Open Source Libraries for iOS.'
55

66
s.description = <<-DESC

Firestore/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Unreleased
2+
3+
# v0.9.1
24
- [fixed] Fixed validation of nested arrays to allow indirect nesting
35

46
# v0.9.0

Firestore/Example/Tests/Integration/API/FIRDatabaseTests.m

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,40 @@ - (void)testCanMergeServerTimestamps {
176176
XCTAssertTrue([document[@"time"] isKindOfClass:[NSDate class]]);
177177
}
178178

179+
- (void)testCanDeleteFieldUsingMerge {
180+
FIRDocumentReference *doc = [[self.db collectionWithPath:@"rooms"] documentWithAutoID];
181+
182+
NSDictionary<NSString *, id> *initialData = @{
183+
@"untouched" : @YES,
184+
@"foo" : @"bar",
185+
@"nested" : @{@"untouched" : @YES, @"foo" : @"bar"}
186+
};
187+
NSDictionary<NSString *, id> *mergeData = @{
188+
@"foo" : [FIRFieldValue fieldValueForDelete],
189+
@"nested" : @{@"foo" : [FIRFieldValue fieldValueForDelete]}
190+
};
191+
192+
[self writeDocumentRef:doc data:initialData];
193+
194+
XCTestExpectation *completed =
195+
[self expectationWithDescription:@"testCanMergeDataWithAnExistingDocumentUsingSet"];
196+
197+
[doc setData:mergeData
198+
options:[FIRSetOptions merge]
199+
completion:^(NSError *error) {
200+
XCTAssertNil(error);
201+
[completed fulfill];
202+
}];
203+
204+
[self awaitExpectations];
205+
206+
FIRDocumentSnapshot *document = [self readDocumentForRef:doc];
207+
XCTAssertEqual(document[@"untouched"], @YES);
208+
XCTAssertNil(document[@"foo"]);
209+
XCTAssertEqual(document[@"nested.untouched"], @YES);
210+
XCTAssertNil(document[@"nested.foo"]);
211+
}
212+
179213
- (void)testMergeReplacesArrays {
180214
FIRDocumentReference *doc = [[self.db collectionWithPath:@"rooms"] documentWithAutoID];
181215

@@ -680,6 +714,40 @@ - (void)testExposesFirestoreOnQueries {
680714
XCTAssertEqual(q.firestore, self.db);
681715
}
682716

717+
- (void)testDocumentReferenceEquality {
718+
FIRFirestore *firestore = self.db;
719+
FIRDocumentReference *docRef = [firestore documentWithPath:@"foo/bar"];
720+
XCTAssertEqualObjects([firestore documentWithPath:@"foo/bar"], docRef);
721+
XCTAssertEqualObjects([docRef collectionWithPath:@"blah"].parent, docRef);
722+
723+
XCTAssertNotEqualObjects([firestore documentWithPath:@"foo/BAR"], docRef);
724+
725+
FIRFirestore *otherFirestore = [self firestore];
726+
XCTAssertNotEqualObjects([otherFirestore documentWithPath:@"foo/bar"], docRef);
727+
}
728+
729+
- (void)testQueryReferenceEquality {
730+
FIRFirestore *firestore = self.db;
731+
FIRQuery *query =
732+
[[[firestore collectionWithPath:@"foo"] queryOrderedByField:@"bar"] queryWhereField:@"baz"
733+
isEqualTo:@42];
734+
FIRQuery *query2 =
735+
[[[firestore collectionWithPath:@"foo"] queryOrderedByField:@"bar"] queryWhereField:@"baz"
736+
isEqualTo:@42];
737+
XCTAssertEqualObjects(query, query2);
738+
739+
FIRQuery *query3 =
740+
[[[firestore collectionWithPath:@"foo"] queryOrderedByField:@"BAR"] queryWhereField:@"baz"
741+
isEqualTo:@42];
742+
XCTAssertNotEqualObjects(query, query3);
743+
744+
FIRFirestore *otherFirestore = [self firestore];
745+
FIRQuery *query4 = [[[otherFirestore collectionWithPath:@"foo"] queryOrderedByField:@"bar"]
746+
queryWhereField:@"baz"
747+
isEqualTo:@42];
748+
XCTAssertNotEqualObjects(query, query4);
749+
}
750+
683751
- (void)testCanTraverseCollectionsAndDocuments {
684752
NSString *expected = @"a/b/c/d";
685753
// doc path from root Firestore.

Firestore/Example/Tests/Integration/API/FIRTypeTests.m

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,13 @@ - (void)testCanReadAndWriteTimestampFields {
6262
}
6363

6464
- (void)testCanReadAndWriteDocumentReferences {
65-
// We can't use assertSuccessfulRoundtrip since FIRDocumentReference doesn't implement isEqual.
66-
FIRDocumentReference *docRef = [self.db documentWithPath:@"rooms/eros"];
67-
id data = @{ @"a" : @42, @"ref" : docRef };
68-
[self writeDocumentRef:docRef data:data];
69-
70-
FIRDocumentSnapshot *readDoc = [self readDocumentForRef:docRef];
71-
XCTAssertTrue(readDoc.exists);
65+
FIRDocumentReference *docRef = [self documentRef];
66+
[self assertSuccessfulRoundtrip:@{ @"a" : @42, @"ref" : docRef }];
67+
}
7268

73-
XCTAssertEqualObjects(readDoc[@"a"], data[@"a"]);
74-
FIRDocumentReference *readDocRef = readDoc[@"ref"];
75-
XCTAssertTrue([readDocRef isKindOfClass:[FIRDocumentReference class]]);
76-
XCTAssertEqualObjects(readDocRef.path, docRef.path);
69+
- (void)testCanReadAndWriteDocumentReferencesInArrays {
70+
FIRDocumentReference *docRef = [self documentRef];
71+
[self assertSuccessfulRoundtrip:@{ @"a" : @42, @"refs" : @[ docRef ] }];
7772
}
7873

7974
@end

Firestore/Example/Tests/Integration/API/FIRValidationTests.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ - (void)testWritesWithReservedFieldsFail {
280280

281281
- (void)testSetsWithFieldValueDeleteFail {
282282
[self expectSet:@{@"foo" : [FIRFieldValue fieldValueForDelete]}
283-
toFailWithReason:@"FieldValue.delete() can only be used with updateData()."];
283+
toFailWithReason:
284+
@"FieldValue.delete() can only be used with updateData() and setData() with "
285+
@"SetOptions.merge()."];
284286
}
285287

286288
- (void)testUpdatesWithNestedFieldValueDeleteFail {

Firestore/Example/Tests/SpecTests/FSTSyncEngineTestDriver.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,10 @@ - (void)receiveWatchStreamError:(int)errorCode userInfo:(NSDictionary<NSString *
263263
[NSError errorWithDomain:FIRFirestoreErrorDomain code:errorCode userInfo:userInfo];
264264

265265
[self.datastore failWatchStreamWithError:error];
266-
// Unlike web, stream should re-open synchronously
267-
FSTAssert(self.datastore.isWatchStreamOpen, @"Watch stream is open");
266+
// Unlike web, stream should re-open synchronously (if we have any listeners)
267+
if (self.queryListeners.count > 0) {
268+
FSTAssert(self.datastore.isWatchStreamOpen, @"Watch stream is open");
269+
}
268270
}
269271

270272
- (NSDictionary<FSTDocumentKey *, FSTBoxedTargetID *> *)currentLimboDocuments {

0 commit comments

Comments
 (0)