Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a4d2614
Remove prerelease abseil code (#558)
wilhuff Dec 12, 2017
87d88eb
Add leveldb to the Firestore cmake build (#559)
wilhuff Dec 12, 2017
e16c386
Update component versions for Firebase 4.8.0 (#561)
Dec 12, 2017
163eeee
Revert changes introduced in #546 to fix build breakage. (#562)
ryanwilson Dec 13, 2017
3530e81
Update CHANGELOG.md
schmidt-sebastian Dec 13, 2017
df6ae1b
Update CHANGELOG.md
schmidt-sebastian Dec 13, 2017
7d97fd5
Update CHANGELOG.md
schmidt-sebastian Dec 13, 2017
4d56478
Merge pull request #564 from firebase/schmidt-sebastian-patch-2
schmidt-sebastian Dec 13, 2017
fd96841
Update CHANGELOG.md
schmidt-sebastian Dec 13, 2017
3b97d50
Merge pull request #563 from firebase/schmidt-sebastian-patch-1
schmidt-sebastian Dec 13, 2017
6839851
Add nil check for completion handlers (#568)
protocol86 Dec 15, 2017
ea3369c
Use angle brackets for nonlocal #includes in Firestore (#580)
wilhuff Dec 19, 2017
c7f8d7f
Merge pull request #576 from firebase/release-4.8.0
Dec 19, 2017
60fa693
Internal code clean up (#584)
protocol86 Dec 19, 2017
3ff3f9f
implement C++ logger (#575)
zxu123 Dec 20, 2017
08704a6
Add changelog for Core. (#585)
ryanwilson Dec 20, 2017
f851af5
Run FIRSetLoggerLevel and FIRIsLoggableLevel on the same thread (#592)
wilhuff Dec 22, 2017
1ede1c9
Use the log_apple.mm logger from C++ on iOS (#593)
wilhuff Jan 2, 2018
412e759
Expose library version, move it out of options (#588)
Jan 2, 2018
13da48d
Build FirebaseCore from CMake (#594)
wilhuff Jan 2, 2018
87ae4f3
Fix scripts/style.sh diffs relative to branch name (#608)
wilhuff Jan 2, 2018
c4dcfaa
Add Private path to FIRVersion.h import (#607)
paulb777 Jan 2, 2018
7ab9c3c
Remove FIRAppEnvironmentUtil's sharedApplication (#603)
ryanwilson Jan 2, 2018
727edce
Adds new API tests for Firebase Auth (#610)
protocol86 Jan 3, 2018
5a6155f
Build and test both C++ loggers where possible (#595)
wilhuff Jan 3, 2018
9179dd8
Update CHANGELOG for macOS AppKit dependency. (#609)
ryanwilson Jan 3, 2018
f08b504
Add Community Supported tvOS (#590)
paulb777 Jan 3, 2018
4ec8b41
Adds API Test for Email Update (#613)
protocol86 Jan 4, 2018
639cbcc
update Gemfile for Travis (#620)
ulukaya Jan 5, 2018
9d15d0d
update Travis to Xcode 9.2 (#619)
ulukaya Jan 5, 2018
a84704f
Removing an obsolete setting from plist files (#617)
davidair Jan 8, 2018
bc74670
Fully qualify protoc-generated outputs (#626)
wilhuff Jan 8, 2018
0f6103e
Port StringPrintf from //base (#624)
wilhuff Jan 8, 2018
9172e6e
Adds AdditionalUserInfo to Phone Auth (#623)
protocol86 Jan 8, 2018
64d1e6b
implement C++ assert (stdio, apple) (#612)
zxu123 Jan 9, 2018
ad97695
Actually exclude leveldb on Windows (#630)
wilhuff Jan 9, 2018
e7347dc
Delete unused private FIRCreateError (#631)
paulb777 Jan 9, 2018
c18af34
Amends phone auth unit tests (#632)
protocol86 Jan 9, 2018
aa00c74
Merge branch 'master' into mikelehen/merge-master-to-firestore-api-ch…
Jan 9, 2018
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ DerivedData
*.hmap
*.ipa

# IntelliJ
.idea

# Vim
*.swo
*.swp
Expand All @@ -57,4 +60,5 @@ Podfile.lock

# CMake
.downloads
.idea/
Debug
Release
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
osx_image: xcode9.1
osx_image: xcode9.2
language: objective-c
cache:
- bundler
Expand All @@ -16,7 +16,9 @@ before_install:
script:
- "! git grep -I ' $'" # Fail on trailing whitespace in non-binary files
- ./test.sh
- bundle exec pod lib lint FirebaseCore.podspec

# TODO fix os_log deprecation warning in FIRLogger to remove --allow-warnings
- bundle exec pod lib lint FirebaseCore.podspec --allow-warnings

# TODO - Uncomment subsequent lines once FirebaseCore source repo is in public Specs repo
# - bundle exec pod lib lint FirebaseAuth.podspec
Expand Down
22 changes: 17 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,27 @@
cmake_minimum_required(VERSION 2.8.11)
project(firebase C CXX)

# If no build type is specified, make it a debug build
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()

if(APPLE)
# When building on the apple platform certain Objective-C++ classes bridge
# back into other Firebase Cocoapods. This requires shelling out to xcodebuild
# to verify the built frameworks are up-to-date. You can disable this to speed
# up the build.
option(BUILD_PODS, "Always build dependent cocoapods." ON)
endif(APPLE)

list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake)

# External Projects install into this prefix and download into the source tree
# to avoid re-downloading repeatedly during development.
set(FIREBASE_INSTALL_DIR "${PROJECT_BINARY_DIR}/usr")
set(FIREBASE_DOWNLOAD_DIR "${PROJECT_SOURCE_DIR}/.downloads")
set(FIREBASE_INSTALL_DIR ${PROJECT_BINARY_DIR})

enable_testing()

include(external/FirebaseCore)

include(external/googletest)
include(external/abseil-cpp)
include(external/leveldb)
include(external/firestore)
4 changes: 4 additions & 0 deletions Example/Auth/ApiTests/AuthCredentialsTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ The name of the test user for Facebook Login.
$KCUSTOM_AUTH_TOKEN_URL
A URL to return a Custom Auth token.

$KCUSTOM_AUTH_TOKEN_EXPIRED_URL
A URL to return an expired Custom Auth token.

$KCUSTOM_AUTH_USER_ID
The ID of the test user in the Custom Auth token.
*/
Expand All @@ -61,4 +64,5 @@ The ID of the test user in the Custom Auth token.
#define KFACEBOOK_APP_ACCESS_TOKEN $KFACEBOOK_APP_ACCESS_TOKEN
#define KFACEBOOK_USER_NAME $KFACEBOOK_USER_NAME
#define KCUSTOM_AUTH_TOKEN_URL $KCUSTOM_AUTH_TOKEN_URL
#define KCUSTOM_AUTH_TOKEN_EXPIRED_URL $KCUSTOM_AUTH_TOKEN_EXPIRED_URL
#define KCUSTOM_AUTH_USER_ID $KCUSTOM_AUTH_USER_ID
141 changes: 140 additions & 1 deletion Example/Auth/ApiTests/FirebaseAuthApiTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
/** The url for obtaining a valid custom token string used to test Custom Auth. */
static NSString *const kCustomTokenUrl = KCUSTOM_AUTH_TOKEN_URL;

/** The url for obtaining an expired but valid custom token string used to test Custom Auth failure.
*/
static NSString *const kExpiredCustomTokenUrl = KCUSTOM_AUTH_TOKEN_EXPIRED_URL;

/** Facebook app access token that will be used for Facebook Graph API, which is different from
* account access token.
*/
Expand All @@ -59,6 +63,12 @@
/** The testing email address for testSignInExistingUserWithEmailAndPassword. */
static NSString *const kExistingTestingEmailToSignIn = @"[email protected]";

/** The testing email address for testUpdatingUsersEmail. */
static NSString *const kNewTestingEmail = @"[email protected]";

/** The testing password for testSignInExistingUserWithModifiedEmailAndPassword. */
static NSString *const kNewTestingPasswordToSignIn = @"password_new";

/** Error message for invalid custom token sign in. */
NSString *kInvalidTokenErrorMessage =
@"The custom token format is incorrect. Please check the documentation.";
Expand All @@ -71,7 +81,7 @@
*/
NSString *kGoogleTestAccountRefreshToken = KGOOGLE_TEST_ACCOUNT_REFRESH_TOKEN;

static NSTimeInterval const kExpectationsTimeout = 30;
static NSTimeInterval const kExpectationsTimeout = 10;

#ifdef NO_NETWORK
#define SKIP_IF_ON_MOBILE_HARNESS \
Expand Down Expand Up @@ -141,6 +151,38 @@ - (void)testCreateAccountWithEmailAndPassword {
[self deleteCurrentFirebaseUser];
}

- (void)testUpdatingUsersEmail {
SKIP_IF_ON_MOBILE_HARNESS
FIRAuth *auth = [FIRAuth auth];
if (!auth) {
XCTFail(@"Could not obtain auth object.");
}

__block NSError *apiError;
XCTestExpectation *expectation =
[self expectationWithDescription:@"Created account with email and password."];
[auth createUserWithEmail:kTestingEmailToCreateUser
password:@"password"
completion:^(FIRUser *user, NSError *error) {
apiError = error;
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:kExpectationsTimeout handler:nil];
expectation = [self expectationWithDescription:@"Created account with email and password."];
XCTAssertEqualObjects(auth.currentUser.email, kTestingEmailToCreateUser);
XCTAssertNil(apiError);
[auth.currentUser updateEmail:kNewTestingEmail
completion:^(NSError *_Nullable error) {
apiError = error;
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:kExpectationsTimeout handler:nil];
XCTAssertNil(apiError);
XCTAssertEqualObjects(auth.currentUser.email, kNewTestingEmail);
// Clean up the created Firebase user for future runs.
[self deleteCurrentFirebaseUser];
}

- (void)testLinkAnonymousAccountToFacebookAccount {
FIRAuth *auth = [FIRAuth auth];
if (!auth) {
Expand Down Expand Up @@ -253,6 +295,92 @@ - (void)testSignInWithValidCustomAuthToken {
XCTAssertEqualObjects(auth.currentUser.uid, kCustomAuthTestingAccountUserID);
}

- (void)testSignInWithValidCustomAuthExpiredToken {
FIRAuth *auth = [FIRAuth auth];
if (!auth) {
XCTFail(@"Could not obtain auth object.");
}

NSError *error;
NSString *customToken =
[NSString stringWithContentsOfURL:[NSURL URLWithString:kExpiredCustomTokenUrl]
encoding:NSUTF8StringEncoding
error:&error];
if (!customToken) {
XCTFail(@"There was an error retrieving the custom token: %@", error);
}
XCTestExpectation *expectation =
[self expectationWithDescription:@"CustomAuthToken sign-in finished."];

__block NSError *apiError;
[auth signInWithCustomToken:customToken
completion:^(FIRUser *_Nullable user, NSError *_Nullable error) {
if (error) {
apiError = error;
}
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:kExpectationsTimeout
handler:^(NSError *error) {
if (error != nil) {
XCTFail(@"Failed to wait for expectations "
@"in CustomAuthToken sign in. Error: %@",
error.localizedDescription);
}
}];

XCTAssertNil(auth.currentUser);
XCTAssertEqual(apiError.code, FIRAuthErrorCodeInvalidCustomToken);
}

- (void)testInMemoryUserAfterSignOut {
FIRAuth *auth = [FIRAuth auth];
if (!auth) {
XCTFail(@"Could not obtain auth object.");
}
NSError *error;
NSString *customToken = [NSString stringWithContentsOfURL:[NSURL URLWithString:kCustomTokenUrl]
encoding:NSUTF8StringEncoding
error:&error];
if (!customToken) {
XCTFail(@"There was an error retrieving the custom token: %@", error);
}
XCTestExpectation *expectation =
[self expectationWithDescription:@"CustomAuthToken sign-in finished."];
__block NSError *rpcError;
[auth signInWithCustomToken:customToken
completion:^(FIRUser *_Nullable user, NSError *_Nullable error) {
if (error) {
rpcError = error;
}
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:kExpectationsTimeout
handler:^(NSError *error) {
if (error != nil) {
XCTFail(@"Failed to wait for expectations "
@"in CustomAuthToken sign in. Error: %@",
error.localizedDescription);
}
}];
XCTAssertEqualObjects(auth.currentUser.uid, kCustomAuthTestingAccountUserID);
XCTAssertNil(rpcError);
FIRUser *inMemoryUser = auth.currentUser;
XCTestExpectation *expectation1 = [self expectationWithDescription:@"Profile data change."];
[auth signOut:NULL];
rpcError = nil;
NSString *newEmailAddress = [self fakeRandomEmail];
XCTAssertNotEqualObjects(newEmailAddress, inMemoryUser.email);
[inMemoryUser updateEmail:newEmailAddress completion:^(NSError *_Nullable error) {
rpcError = error;
[expectation1 fulfill];
}];
[self waitForExpectationsWithTimeout:kExpectationsTimeout handler:nil];
XCTAssertEqualObjects(inMemoryUser.email, newEmailAddress);
XCTAssertNil(rpcError);
XCTAssertNil(auth.currentUser);
}

- (void)testSignInWithInvalidCustomAuthToken {
FIRAuth *auth = [FIRAuth auth];
if (!auth) {
Expand Down Expand Up @@ -354,6 +482,17 @@ - (void)testSignInWithGoogle {

#pragma mark - Helpers

/** Generate fake random email address */
- (NSString *)fakeRandomEmail {
NSMutableString *fakeEmail = [[NSMutableString alloc] init];
for (int i=0; i<10; i++) {
[fakeEmail appendString:
[NSString stringWithFormat:@"%c", 'a' + arc4random_uniform('z' - 'a' + 1)]];
}
[fakeEmail appendString:@"@gmail.com"];
return fakeEmail;
}

/** Sign out current account. */
- (void)signOut {
NSError *signOutError;
Expand Down
2 changes: 0 additions & 2 deletions Example/Auth/App/GoogleService-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
<string>correct_client_id</string>
<key>REVERSED_CLIENT_ID</key>
<string>correct_reversed_client_id</string>
<key>ANDROID_CLIENT_ID</key>
<string>correct_android_client_id</string>
<key>GOOGLE_APP_ID</key>
<string>1:123:ios:123abc</string>
<key>GCM_SENDER_ID</key>
Expand Down
21 changes: 21 additions & 0 deletions Example/Auth/App/tvOS/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2017 Google
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property(strong, nonatomic) UIWindow *window;

@end
63 changes: 63 additions & 0 deletions Example/Auth/App/tvOS/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2017 Google
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

@import FirebaseCore;
@import FirebaseAuth;

#import "AppDelegate.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[FIRApp configure];
return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for
// certain types of temporary interruptions (such as an incoming phone call or SMS message) or
// when the user quits the application and it begins the transition to the background state. Use
// this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates.
// Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store
// enough application state information to restore your application to its current state in case
// it is terminated later. If your application supports background execution, this method is
// called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the active state; here you can undo
// many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If
// the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also
// applicationDidEnterBackground:.
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading