Skip to content

Commit 2ad8000

Browse files
committed
Integrate Latest @ 238722718
Changes to all ... - Update Firebase iOS and Android dependency versions. - Fix links in documentation. Changes to auth/testapp ... - Add GameCenter support to testapp. - Modify check for invalid provider data. Changes to database/testapp ... - Made the timestamp check more strict. It now checks within 15 minutes instead of 24 hours. CL: 238722718
1 parent ea0437d commit 2ad8000

File tree

23 files changed

+179
-108
lines changed

23 files changed

+179
-108
lines changed

admob/testapp/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git'
22
platform :ios, '8.0'
33
# AdMob test application.
44
target 'testapp' do
5-
pod 'Firebase/Core', '5.15.0'
6-
pod 'Firebase/AdMob', '5.15.0'
5+
pod 'Firebase/Core', '5.18.0'
6+
pod 'Firebase/AdMob', '5.18.0'
77
end

admob/testapp/readme.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Getting Started
3737
- You can use "com.google.ios.admob.testapp" as the iOS Bundle ID
3838
while you're testing. You can omit App Store ID while testing.
3939
- Download the Firebase C++ SDK linked from
40-
[https://firebase.google.com/docs/cpp/setup]() and unzip it to a
41-
directory of your choice.
40+
[https://firebase.google.com/docs/cpp/setup](https://firebase.google.com/docs/cpp/setup)
41+
and unzip it to a directory of your choice.
4242
- Add the following frameworks from the Firebase C++ SDK to the project:
4343
- frameworks/ios/universal/firebase.framework
4444
- frameworks/ios/universal/firebase_admob.framework
@@ -88,8 +88,8 @@ Getting Started
8888
- For further details please refer to the
8989
[general instructions for setting up an Android app with Firebase](https://firebase.google.com/docs/android/setup).
9090
- Download the Firebase C++ SDK linked from
91-
[https://firebase.google.com/docs/cpp/setup]() and unzip it to a
92-
directory of your choice.
91+
[https://firebase.google.com/docs/cpp/setup](https://firebase.google.com/docs/cpp/setup)
92+
and unzip it to a directory of your choice.
9393
- Configure the location of the Firebase C++ SDK by setting the
9494
firebase\_cpp\_sdk.dir Gradle property to the SDK install directory.
9595
For example, in the project directory:
@@ -128,8 +128,8 @@ Getting Started
128128
file into a `google-services-desktop.json` file, which can then be
129129
placed in the root directory of the testapp.
130130
- Download the Firebase C++ SDK linked from
131-
[https://firebase.google.com/docs/cpp/setup]() and unzip it to a
132-
directory of your choice.
131+
[https://firebase.google.com/docs/cpp/setup](https://firebase.google.com/docs/cpp/setup)
132+
and unzip it to a directory of your choice.
133133
- Configure the testapp with the location of the Firebase C++ SDK.
134134
This can be done a couple different ways:
135135
- When invoking cmake, pass in the location with
@@ -162,7 +162,7 @@ Getting Started
162162
Support
163163
-------
164164
165-
[https://firebase.google.com/support/]()
165+
[https://firebase.google.com/support/](https://firebase.google.com/support/)
166166
167167
License
168168
-------

analytics/testapp/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git'
22
platform :ios, '8.0'
33
# Analytics test application.
44
target 'testapp' do
5-
pod 'Firebase/Core', '5.15.0'
6-
pod 'Firebase/Analytics', '5.15.0'
5+
pod 'Firebase/Core', '5.18.0'
6+
pod 'Firebase/Analytics', '5.18.0'
77
end

analytics/testapp/readme.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Building and Running the testapp
3939
console to the testapp root directory. This file identifies your iOS app
4040
to the Firebase backend.
4141
- Download the Firebase C++ SDK linked from
42-
[https://firebase.google.com/docs/cpp/setup]() and unzip it to a
43-
directory of your choice.
42+
[https://firebase.google.com/docs/cpp/setup](https://firebase.google.com/docs/cpp/setup)
43+
and unzip it to a directory of your choice.
4444
- Add the following frameworks from the Firebase C++ SDK to the project:
4545
- frameworks/ios/universal/firebase.framework
4646
- frameworks/ios/universal/firebase\_analytics.framework
@@ -62,7 +62,7 @@ Building and Running the testapp
6262
"View --> Debug Area --> Activate Console" from the menu.
6363
- After 5 hours, data should be visible in the Firebase Console under the
6464
"Analytics" tab accessible from
65-
[https://firebase.google.com/console/]().
65+
[https://firebase.google.com/console/](https://firebase.google.com/console/).
6666
6767
### Android
6868
- Register your Android app with Firebase.
@@ -90,8 +90,8 @@ Building and Running the testapp
9090
- For further details please refer to the
9191
[general instructions for setting up an Android app with Firebase](https://firebase.google.com/docs/android/setup).
9292
- Download the Firebase C++ SDK linked from
93-
[https://firebase.google.com/docs/cpp/setup]() and unzip it to a
94-
directory of your choice.
93+
[https://firebase.google.com/docs/cpp/setup](https://firebase.google.com/docs/cpp/setup)
94+
and unzip it to a directory of your choice.
9595
- Configure the location of the Firebase C++ SDK by setting the
9696
firebase\_cpp\_sdk.dir Gradle property to the SDK install directory.
9797
For example, in the project directory:
@@ -113,7 +113,7 @@ Building and Running the testapp
113113
the command line.
114114
- After 5 hours, data should be visible in the Firebase Console under the
115115
"Analytics" tab accessible from
116-
[https://firebase.google.com/console/]().
116+
[https://firebase.google.com/console/](https://firebase.google.com/console/).
117117
118118
### Desktop
119119
- Register your app with Firebase.
@@ -128,8 +128,8 @@ Building and Running the testapp
128128
file into a `google-services-desktop.json` file, which can then be
129129
placed in the root directory of the testapp.
130130
- Download the Firebase C++ SDK linked from
131-
[https://firebase.google.com/docs/cpp/setup]() and unzip it to a
132-
directory of your choice.
131+
[https://firebase.google.com/docs/cpp/setup](https://firebase.google.com/docs/cpp/setup)
132+
and unzip it to a directory of your choice.
133133
- Configure the testapp with the location of the Firebase C++ SDK.
134134
This can be done a couple different ways (in highest to lowest priority):
135135
- When invoking cmake, pass in the location with
@@ -162,7 +162,7 @@ Building and Running the testapp
162162
Support
163163
-------
164164
165-
[https://firebase.google.com/support/]()
165+
[https://firebase.google.com/support/](https://firebase.google.com/support/)
166166
167167
License
168168
-------

auth/testapp/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git'
22
platform :ios, '8.0'
33
# Auth test application.
44
target 'testapp' do
5-
pod 'Firebase/Core', '5.15.0'
6-
pod 'Firebase/Auth', '5.15.0'
5+
pod 'Firebase/Core', '5.18.0'
6+
pod 'Firebase/Auth', '5.18.0'
77
end

auth/testapp/readme.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ Building and Running the testapp
5858
enable "Anonymous". This will allow the testapp to use email accounts and
5959
anonymous sign-in.
6060
- Download the Firebase C++ SDK linked from
61-
[https://firebase.google.com/docs/cpp/setup]() and unzip it to a
62-
directory of your choice.
61+
[https://firebase.google.com/docs/cpp/setup](https://firebase.google.com/docs/cpp/setup)
62+
and unzip it to a directory of your choice.
6363
- Add the following frameworks from the Firebase C++ SDK to the project:
6464
- frameworks/ios/universal/firebase.framework
6565
- frameworks/ios/universal/firebase_auth.framework
@@ -119,8 +119,8 @@ Building and Running the testapp
119119
- For further details please refer to the
120120
[general instructions for setting up an Android app with Firebase](https://firebase.google.com/docs/android/setup).
121121
- Download the Firebase C++ SDK linked from
122-
[https://firebase.google.com/docs/cpp/setup]() and unzip it to a
123-
directory of your choice.
122+
[https://firebase.google.com/docs/cpp/setup](https://firebase.google.com/docs/cpp/setup)
123+
and unzip it to a directory of your choice.
124124
- Configure the location of the Firebase C++ SDK by setting the
125125
firebase\_cpp\_sdk.dir Gradle property to the SDK install directory.
126126
For example, in the project directory:
@@ -154,8 +154,8 @@ Building and Running the testapp
154154
file into a `google-services-desktop.json` file, which can then be
155155
placed in the root directory of the testapp.
156156
- Download the Firebase C++ SDK linked from
157-
[https://firebase.google.com/docs/cpp/setup]() and unzip it to a
158-
directory of your choice.
157+
[https://firebase.google.com/docs/cpp/setup](https://firebase.google.com/docs/cpp/setup)
158+
and unzip it to a directory of your choice.
159159
- Configure the testapp with the location of the Firebase C++ SDK.
160160
This can be done a couple different ways (in highest to lowest priority):
161161
- When invoking cmake, pass in the location with
@@ -185,7 +185,7 @@ Building and Running the testapp
185185
Support
186186
-------
187187
188-
[https://firebase.google.com/support/]()
188+
[https://firebase.google.com/support/](https://firebase.google.com/support/)
189189
190190
License
191191
-------

auth/testapp/src/common_main.cc

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ using ::firebase::auth::FacebookAuthProvider;
3737
using ::firebase::auth::GitHubAuthProvider;
3838
using ::firebase::auth::GoogleAuthProvider;
3939
using ::firebase::auth::kAuthErrorFailure;
40+
using ::firebase::auth::kAuthErrorInvalidCredential;
41+
using ::firebase::auth::kAuthErrorInvalidProviderId;
4042
using ::firebase::auth::kAuthErrorNone;
4143
using ::firebase::auth::OAuthProvider;
4244
using ::firebase::auth::PhoneAuthProvider;
@@ -47,6 +49,10 @@ using ::firebase::auth::User;
4749
using ::firebase::auth::UserInfoInterface;
4850
using ::firebase::auth::UserMetadata;
4951

52+
#if TARGET_OS_IPHONE
53+
using ::firebase::auth::GameCenterAuthProvider;
54+
#endif
55+
5056
// Set this to true, and set the email/password, to test a custom email address.
5157
static const bool kTestCustomEmail = false;
5258
static const char kCustomEmail[] = "[email protected]";
@@ -874,7 +880,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
874880
WaitForSignInFuture(
875881
facebook_bad,
876882
"Auth::SignInWithCredential() bad Facebook credentials",
877-
::firebase::auth::kAuthErrorOperationNotAllowed, auth);
883+
kAuthErrorInvalidProviderId, auth);
878884
}
879885

880886
// Use bad GitHub credentials. Should fail.
@@ -885,7 +891,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
885891
auth->SignInWithCredential(git_hub_cred_bad);
886892
WaitForSignInFuture(
887893
git_hub_bad, "Auth::SignInWithCredential() bad GitHub credentials",
888-
::firebase::auth::kAuthErrorOperationNotAllowed, auth);
894+
kAuthErrorInvalidProviderId, auth);
889895
}
890896

891897
// Use bad Google credentials. Should fail.
@@ -895,7 +901,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
895901
Future<User*> google_bad = auth->SignInWithCredential(google_cred_bad);
896902
WaitForSignInFuture(
897903
google_bad, "Auth::SignInWithCredential() bad Google credentials",
898-
kAuthErrorFailure, auth);
904+
kAuthErrorInvalidCredential, auth);
899905
}
900906

901907
// Use bad Google credentials, missing an optional parameter. Should fail.
@@ -905,7 +911,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
905911
Future<User*> google_bad = auth->SignInWithCredential(google_cred_bad);
906912
WaitForSignInFuture(
907913
google_bad, "Auth::SignInWithCredential() bad Google credentials",
908-
kAuthErrorFailure, auth);
914+
kAuthErrorInvalidCredential, auth);
909915
}
910916

911917
#if defined(__ANDROID__)
@@ -918,10 +924,51 @@ extern "C" int common_main(int argc, const char* argv[]) {
918924
WaitForSignInFuture(
919925
play_games_bad,
920926
"Auth:SignInWithCredential() bad Play Games credentials",
921-
kAuthErrorFailure, auth);
927+
kAuthErrorInvalidCredential, auth);
922928
}
923929
#endif // defined(__ANDROID__)
924930

931+
#if TARGET_OS_IPHONE
932+
// Test Game Center status/login
933+
{
934+
// Check if the current user is authenticated to GameCenter
935+
bool is_authenticated = GameCenterAuthProvider::IsPlayerAuthenticated();
936+
if (!is_authenticated) {
937+
LogMessage("Not signed into Game Center, skipping test.");
938+
} else {
939+
LogMessage("Signed in, testing Game Center authentication.");
940+
941+
// Get the Game Center credential from the device
942+
Future<Credential> game_center_credential_future =
943+
GameCenterAuthProvider::GetCredential();
944+
WaitForFuture(
945+
game_center_credential_future,
946+
"GameCenterAuthProvider::GetCredential()",
947+
kAuthErrorNone);
948+
949+
const AuthError credential_error =
950+
static_cast<AuthError>(game_center_credential_future.error());
951+
952+
// Only attempt to sign in if we were able to get a credential.
953+
if (credential_error == kAuthErrorNone) {
954+
const Credential* gc_credential_ptr =
955+
game_center_credential_future.result();
956+
957+
if (gc_credential_ptr == nullptr) {
958+
LogMessage("Failed to retrieve Game Center credential.");
959+
} else {
960+
Future<User*> game_center_user =
961+
auth->SignInWithCredential(*gc_credential_ptr);
962+
WaitForFuture(game_center_user,
963+
"Auth::SignInWithCredential() test Game Center "
964+
"credential signin",
965+
kAuthErrorNone);
966+
}
967+
}
968+
}
969+
}
970+
#endif // TARGET_OS_IPHONE
971+
925972
// Use bad Twitter credentials. Should fail.
926973
{
927974
Credential twitter_cred_bad = TwitterAuthProvider::GetCredential(
@@ -930,7 +977,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
930977
auth->SignInWithCredential(twitter_cred_bad);
931978
WaitForSignInFuture(
932979
twitter_bad, "Auth::SignInWithCredential() bad Twitter credentials",
933-
::firebase::auth::kAuthErrorOperationNotAllowed, auth);
980+
kAuthErrorInvalidProviderId, auth);
934981
}
935982

936983
// Use bad OAuth credentials. Should fail.
@@ -940,7 +987,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
940987
Future<User*> oauth_bad = auth->SignInWithCredential(oauth_cred_bad);
941988
WaitForSignInFuture(
942989
oauth_bad, "Auth::SignInWithCredential() bad OAuth credentials",
943-
::firebase::auth::kAuthErrorFailure, auth);
990+
kAuthErrorInvalidProviderId, auth);
944991
}
945992

946993
// Test Auth::SendPasswordResetEmail().
@@ -1029,7 +1076,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
10291076
anonymous_user->LinkWithCredential(twitter_cred_bad);
10301077
WaitForFuture(link_bad_future,
10311078
"User::LinkWithCredential() with bad credential",
1032-
::firebase::auth::kAuthErrorOperationNotAllowed);
1079+
kAuthErrorInvalidProviderId);
10331080
ExpectTrue("Linking maintains user",
10341081
auth->current_user() == pre_link_user);
10351082
}
@@ -1046,7 +1093,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
10461093
auth->SignInWithCredential(twitter_cred_bad);
10471094
WaitForFuture(signin_bad_future,
10481095
"Auth::SignInWithCredential() with bad credential",
1049-
::firebase::auth::kAuthErrorOperationNotAllowed, auth);
1096+
kAuthErrorInvalidProviderId, auth);
10501097
ExpectTrue("Failed sign in maintains user",
10511098
auth->current_user() == pre_signin_user);
10521099
}

auth/testapp/src/ios/ios_main.mm

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#import <GameKit/GameKit.h>
1516
#import <UIKit/UIKit.h>
1617

1718
#include <stdarg.h>
@@ -40,6 +41,29 @@ @interface FTAViewController : UIViewController
4041
static UIView *g_parent_view;
4142
static FTAViewController *g_view_controller;
4243

44+
void initGameCenter(UIViewController* view_controller) {
45+
if (![GKLocalPlayer class])
46+
return;
47+
48+
__weak GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
49+
localPlayer.authenticateHandler = ^(UIViewController *gcAuthViewController, NSError *error) {
50+
if (gcAuthViewController != nil) {
51+
// Pause any activities that require user interaction, then present the
52+
// gcAuthViewController to the player.
53+
[view_controller presentViewController:gcAuthViewController animated:YES completion:nil];
54+
} else if (localPlayer.isAuthenticated) {
55+
// Player is already logged into Game Center
56+
} else {
57+
if (error) {
58+
LogMessage("Unable to initialize GameCenter: %s", error.localizedDescription);
59+
return;
60+
} else {
61+
LogMessage("Unable to initialize GameCenter: Unknown Error");
62+
}
63+
}
64+
};
65+
}
66+
4367
@implementation FTAViewController
4468

4569
- (void)viewDidLoad {
@@ -48,6 +72,7 @@ - (void)viewDidLoad {
4872
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
4973
const char *argv[] = {FIREBASE_TESTAPP_NAME};
5074
[g_shutdown_signal lock];
75+
initGameCenter(self);
5176
g_exit_status = common_main(1, argv);
5277
[g_shutdown_complete signal];
5378
});

database/testapp/Podfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ source 'https://github.com/CocoaPods/Specs.git'
22
platform :ios, '8.0'
33
# Firebase Realtime Database test application.
44
target 'testapp' do
5-
pod 'Firebase/Core', '5.15.0'
6-
pod 'Firebase/Database', '5.15.0'
7-
pod 'Firebase/Auth', '5.15.0'
5+
pod 'Firebase/Core', '5.18.0'
6+
pod 'Firebase/Database', '5.18.0'
7+
pod 'Firebase/Auth', '5.18.0'
88
end

0 commit comments

Comments
 (0)