Skip to content

Commit 27201e2

Browse files
committed
Integrate Latest @ 198905712
Changes to admob/testapp ... - Unpinned sample Cocoapod versions and updated documentation to remove pinning comments. Changes to analytics/testapp ... - Unpinned sample Cocoapod versions and updated documentation to remove pinning comments. Changes to auth/testapp ... - Fix various error handling issues in Auth - Unpinned sample Cocoapod versions and updated documentation to remove pinning comments. Changes to database/testapp ... - Unpinned sample Cocoapod versions and updated documentation to remove pinning comments. Changes to dynamic_links/testapp ... - Unpinned sample Cocoapod versions and updated documentation to remove pinning comments. Changes to invites/testapp ... - Unpinned sample Cocoapod versions and updated documentation to remove pinning comments. Changes to messaging/testapp ... - Unpinned sample Cocoapod versions and updated documentation to remove pinning comments. - Added RequestPermission example in in Messaging testapp and fixed typo. Changes to remote_config/testapp ... - Unpinned sample Cocoapod versions and updated documentation to remove pinning comments. Changes to storage/testapp ... - Unpinned sample Cocoapod versions and updated documentation to remove pinning comments. - Change the Storage testapp to resume only after the pause has completed. CL: 198905712
1 parent a59f763 commit 27201e2

File tree

11 files changed

+49
-25
lines changed

11 files changed

+49
-25
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, '7.0'
33
# AdMob test application.
44
target 'testapp' do
5-
pod 'Firebase/Core', '4.13.0'
6-
pod 'Firebase/AdMob', '4.13.0'
5+
pod 'Firebase/Core'
6+
pod 'Firebase/AdMob'
77
end

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', '4.13.0'
6-
pod 'Firebase/Analytics', '4.13.0'
5+
pod 'Firebase/Core'
6+
pod 'Firebase/Analytics'
77
end

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', '4.13.0'
6-
pod 'Firebase/Auth', '4.13.0'
5+
pod 'Firebase/Core'
6+
pod 'Firebase/Auth'
77
end

auth/testapp/src/common_main.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,8 @@ extern "C" int common_main(int argc, const char* argv[]) {
514514
wait_ms += kWaitIntervalMs;
515515
LogMessage(".");
516516
}
517-
if (wait_ms > kPhoneAuthCodeSendWaitMs) {
517+
if (wait_ms > kPhoneAuthCodeSendWaitMs ||
518+
listener.num_calls_on_verification_failed()) {
518519
LogMessage("ERROR: SMS with verification code not sent.");
519520
} else {
520521
LogMessage("SMS verification code sent.");
@@ -743,7 +744,7 @@ extern "C" int common_main(int argc, const char* argv[]) {
743744
Future<User*> oauth_bad = auth->SignInWithCredential(oauth_cred_bad);
744745
WaitForSignInFuture(
745746
oauth_bad, "Auth::SignInWithCredential() bad OAuth credentials",
746-
::firebase::auth::kAuthErrorNoSuchProvider, auth);
747+
::firebase::auth::kAuthErrorFailure, auth);
747748
}
748749

749750
// Test Auth::SendPasswordResetEmail().

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', '4.13.0'
6-
pod 'Firebase/Database', '4.13.0'
7-
pod 'Firebase/Auth', '4.13.0'
5+
pod 'Firebase/Core'
6+
pod 'Firebase/Database'
7+
pod 'Firebase/Auth'
88
end

dynamic_links/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
# Dynamic Links test application.
44
target 'testapp' do
5-
pod 'Firebase/Core', '4.13.0'
6-
pod 'Firebase/DynamicLinks', '4.13.0'
5+
pod 'Firebase/Core'
6+
pod 'Firebase/DynamicLinks'
77
end

invites/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
# Invites test application.
44
target 'testapp' do
5-
pod 'Firebase/Core', '4.13.0'
6-
pod 'Firebase/Invites', '4.13.0'
5+
pod 'Firebase/Core'
6+
pod 'Firebase/Invites'
77
end

messaging/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
# FCM test application.
44
target 'testapp' do
5-
pod 'Firebase/Core', '4.13.0'
6-
pod 'Firebase/Messaging', '4.13.0'
5+
pod 'Firebase/Core'
6+
pod 'Firebase/Messaging'
77
end

messaging/testapp/src/common_main.cc

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ extern "C" int common_main(int argc, const char* argv[]) {
4040
LogMessage("Try to initialize Firebase Messaging");
4141
::firebase::messaging::PollableListener* listener =
4242
static_cast<::firebase::messaging::PollableListener*>(userdata);
43-
return ::firebase::messaging::Initialize(*app, listener);
43+
firebase::messaging::MessagingOptions options;
44+
// Prevent the app from requesting permission to show notifications
45+
// immediately upon starting up. Since it the prompt is being
46+
// suppressed, we must manually display it with a call to
47+
// RequestPermission() elsewhere.
48+
options.suppress_notification_permission_prompt = true;
49+
50+
return ::firebase::messaging::Initialize(*app, listener, options);
4451
});
4552

4653
while (initializer.InitializeLastResult().status() !=
@@ -56,19 +63,35 @@ extern "C" int common_main(int argc, const char* argv[]) {
5663

5764
LogMessage("Initialized Firebase Cloud Messaging.");
5865

66+
// This will display the prompt to request permission to receive notifications
67+
// if the prompt has not already been displayed before. (If the user already
68+
// responded to the prompt, their decision is cached by the OS and can be
69+
// changed in the OS settings).
70+
::firebase::Future<void> result = ::firebase::messaging::RequestPermission();
71+
LogMessage("Display permission prompt if necessary.");
72+
while (result.status() == ::firebase::kFutureStatusPending) {
73+
ProcessEvents(100);
74+
}
75+
if (result.error() ==
76+
::firebase::messaging::kErrorFailedToRegisterForRemoteNotifications) {
77+
LogMessage("Error registering for remote notifications.");
78+
} else {
79+
LogMessage("Finished checking for permission.");
80+
}
81+
5982
::firebase::messaging::Subscribe("TestTopic");
6083
LogMessage("Subscribed to TestTopic");
6184

6285
bool done = false;
6386
while (!done) {
6487
std::string token;
6588
if (listener.PollRegistrationToken(&token)) {
66-
LogMessage("Recieved Registration Token: %s", token.c_str());
89+
LogMessage("Received Registration Token: %s", token.c_str());
6790
}
6891

6992
::firebase::messaging::Message message;
7093
while (listener.PollMessage(&message)) {
71-
LogMessage("Recieved a new message");
94+
LogMessage("Received a new message");
7295
LogMessage("This message was %s by the user",
7396
message.notification_opened ? "opened" : "not opened");
7497
if (!message.from.empty()) LogMessage("from: %s", message.from.c_str());

remote_config/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
# Firebase Remote Config test application.
44
target 'testapp' do
5-
pod 'Firebase/Core', '4.13.0'
6-
pod 'Firebase/RemoteConfig', '4.13.0'
5+
pod 'Firebase/Core'
6+
pod 'Firebase/RemoteConfig'
77
end

0 commit comments

Comments
 (0)