Skip to content

Commit 50e7316

Browse files
author
Stewart Miles
committed
Integrate Latest @ 125780774
- Switch the default compiler to Clang for samples. - Update testapps to retry creating firebase::App when it fails. CL: 125780774
1 parent cd92f76 commit 50e7316

File tree

11 files changed

+52
-57
lines changed

11 files changed

+52
-57
lines changed

admob/testapp/jni/Application.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
APP_PLATFORM:=android-14
16-
NDK_TOOLCHAIN_VERSION=4.9
16+
NDK_TOOLCHAIN_VERSION=clang
1717
APP_ABI:=armeabi armeabi-v7a arm64-v8a x86 x86_64 mips mips64
1818
APP_STL:=c++_static
1919
APP_MODULES:=android_main

admob/testapp/src/common_main.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,20 @@ extern "C" int common_main(int argc, const char* argv[]) {
9797
namespace admob = ::firebase::admob;
9898
::firebase::App* app;
9999
LogMessage("Initializing the AdMob library.");
100+
do {
100101
#if defined(__ANDROID__)
101-
app = ::firebase::App::Create(::firebase::AppOptions(), GetJniEnv(),
102-
GetActivity());
102+
app = ::firebase::App::Create(::firebase::AppOptions(), GetJniEnv(),
103+
GetActivity());
103104
#else
104-
app = ::firebase::App::Create(::firebase::AppOptions());
105+
app = ::firebase::App::Create(::firebase::AppOptions());
105106
#endif // defined(__ANDROID__)
106107

107-
if (app == nullptr) {
108-
LogMessage("Couldn't create firebase app, aborting.");
109-
// Wait until the user wants to quit the app.
110-
while (!ProcessEvents(1000)) {
108+
if (app == nullptr) {
109+
LogMessage("Couldn't create firebase app, try again.");
110+
// Wait a few moments, and try to create app again.
111+
ProcessEvents(1000);
111112
}
112-
return 1;
113-
}
113+
} while (app == nullptr);
114114

115115
LogMessage("Created the Firebase App %x.",
116116
static_cast<int>(reinterpret_cast<intptr_t>(app)));

analytics/testapp/jni/Application.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
APP_PLATFORM:=android-14
16-
NDK_TOOLCHAIN_VERSION=4.9
16+
NDK_TOOLCHAIN_VERSION=clang
1717
APP_ABI:=armeabi armeabi-v7a arm64-v8a x86 x86_64 mips mips64
1818
APP_STL:=c++_static
1919
APP_MODULES:=android_main

auth/testapp/jni/Application.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
APP_PLATFORM:=android-14
16-
NDK_TOOLCHAIN_VERSION=4.9
16+
NDK_TOOLCHAIN_VERSION=clang
1717
APP_ABI:=armeabi armeabi-v7a arm64-v8a x86 x86_64 mips mips64
1818
APP_STL:=c++_static
1919
APP_MODULES:=android_main

auth/testapp/src/common_main.cc

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ static const char kTestPasswordBad[] = "badTestPassword";
5353
static const char kTestIdTokenBad[] = "bad id token for testing";
5454
static const char kTestAccessTokenBad[] = "bad access token for testing";
5555
static const char kTestPasswordUpdated[] = "testpasswordupdated";
56-
static const char kTestDisplayName[] = "my display name";
57-
static const char kTestPhotoUri[] = "myphotos.example.com";
5856

5957
static const char kFirebaseProviderId[] =
6058
#if defined(__ANDROID__)
@@ -221,21 +219,20 @@ class UserLogin {
221219
extern "C" int common_main(int argc, const char* argv[]) {
222220
App* app;
223221
LogMessage("Starting Auth tests.");
224-
222+
do {
225223
// Create the App wrapper.
226224
#if defined(__ANDROID__)
227-
app = App::Create(AppOptions(), GetJniEnv(), GetActivity());
225+
app = App::Create(AppOptions(), GetJniEnv(), GetActivity());
228226
#else
229-
app = App::Create(AppOptions());
227+
app = App::Create(AppOptions());
230228
#endif // defined(__ANDROID__)
231229

232-
if (app == nullptr) {
233-
LogMessage("Couldn't create firebase app, aborting.");
234-
// Wait until the user wants to quit the app.
235-
while (!ProcessEvents(1000)) {
230+
if (app == nullptr) {
231+
LogMessage("Couldn't create firebase app, try again.");
232+
// Wait a few moments, and try to create app again.
233+
ProcessEvents(1000);
236234
}
237-
return 1;
238-
}
235+
} while (app == nullptr);
239236

240237
LogMessage("Created the Firebase app %x.",
241238
static_cast<int>(reinterpret_cast<intptr_t>(app)));

invites/testapp/jni/Application.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
APP_PLATFORM:=android-14
16-
NDK_TOOLCHAIN_VERSION=4.9
16+
NDK_TOOLCHAIN_VERSION=clang
1717
APP_ABI:=armeabi armeabi-v7a arm64-v8a x86 x86_64 mips mips64
1818
APP_STL:=c++_static
1919
APP_MODULES:=android_main

invites/testapp/src/common_main.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ extern "C" int common_main(int argc, const char* argv[]) {
2727

2828
LogMessage("Initializing Firebase App");
2929

30+
do {
3031
#if defined(__ANDROID__)
31-
app = ::firebase::App::Create(::firebase::AppOptions(), GetJniEnv(),
32-
GetActivity());
32+
app = ::firebase::App::Create(::firebase::AppOptions(), GetJniEnv(),
33+
GetActivity());
3334
#else
34-
app = ::firebase::App::Create(::firebase::AppOptions());
35+
app = ::firebase::App::Create(::firebase::AppOptions());
3536
#endif // defined(__ANDROID__)
3637

37-
if (app == nullptr) {
38-
LogMessage("Couldn't create firebase app, aborting.");
39-
// Wait until the user wants to quit the app.
40-
while (!ProcessEvents(1000)) {
38+
if (app == nullptr) {
39+
LogMessage("Couldn't create firebase app, try again.");
40+
// Wait a few moments, and try to create app again.
41+
ProcessEvents(1000);
4142
}
42-
return 1;
43-
}
43+
} while (app == nullptr);
4444

4545
LogMessage("Created the Firebase App %x",
4646
static_cast<int>(reinterpret_cast<intptr_t>(app)));

messaging/testapp/jni/Application.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
APP_PLATFORM:=android-14
16-
NDK_TOOLCHAIN_VERSION=4.9
16+
NDK_TOOLCHAIN_VERSION=clang
1717
APP_ABI:=armeabi armeabi-v7a arm64-v8a x86 x86_64 mips mips64
1818
APP_STL:=c++_static
1919
APP_MODULES:=android_main

messaging/testapp/src/common_main.cc

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ class MessageListener : public firebase::messaging::Listener {
2626
// this OnMessage function is called once for each queued message.
2727
LogMessage("Recieved a new message");
2828
if (!message.from.empty()) LogMessage("from: %s", message.from.c_str());
29-
if (!message.error.empty()) LogMessage("error: %s", message.error.c_str());
30-
if (!message.message_id.empty()) {
31-
LogMessage("message_id: %s", message.message_id.c_str());
32-
}
3329
if (!message.data.empty()) {
3430
LogMessage("data:");
3531
typedef std::map<std::string, std::string>::const_iterator MapIter;
@@ -58,20 +54,22 @@ MessageListener g_listener;
5854
// Execute all methods of the C++ Firebase Cloud Messaging API.
5955
extern "C" int common_main(int argc, const char* argv[]) {
6056
::firebase::App* app;
57+
58+
LogMessage("Initialize the Messaging library");
59+
do {
6160
#if defined(__ANDROID__)
62-
app = ::firebase::App::Create(::firebase::AppOptions(), GetJniEnv(),
63-
GetActivity());
61+
app = ::firebase::App::Create(::firebase::AppOptions(), GetJniEnv(),
62+
GetActivity());
6463
#else
65-
app = ::firebase::App::Create(::firebase::AppOptions());
64+
app = ::firebase::App::Create(::firebase::AppOptions());
6665
#endif // defined(__ANDROID__)
6766

68-
if (app == nullptr) {
69-
LogMessage("Couldn't create firebase app, aborting.");
70-
// Wait until the user wants to quit the app.
71-
while (!ProcessEvents(1000)) {
67+
if (app == nullptr) {
68+
LogMessage("Couldn't create firebase app, try again.");
69+
// Wait a few moments, and try to create app again.
70+
ProcessEvents(1000);
7271
}
73-
return 1;
74-
}
72+
} while (app == nullptr);
7573

7674
LogMessage("Initialized Firebase App.");
7775

remote_config/testapp/jni/Application.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
APP_PLATFORM:=android-14
16-
NDK_TOOLCHAIN_VERSION=4.9
16+
NDK_TOOLCHAIN_VERSION=clang
1717
APP_ABI:=armeabi armeabi-v7a arm64-v8a x86 x86_64 mips mips64
1818
APP_STL:=c++_static
1919
APP_MODULES:=android_main

0 commit comments

Comments
 (0)