diff --git a/admob/testapp/Podfile b/admob/testapp/Podfile index 724dcaab..269cc6be 100644 --- a/admob/testapp/Podfile +++ b/admob/testapp/Podfile @@ -2,5 +2,5 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' # AdMob test application. target 'testapp' do - pod 'Firebase/AdMob', '6.17.0' + pod 'Firebase/AdMob', '6.24.0' end diff --git a/analytics/testapp/Podfile b/analytics/testapp/Podfile index da8d3b53..63db963c 100644 --- a/analytics/testapp/Podfile +++ b/analytics/testapp/Podfile @@ -2,5 +2,5 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' # Analytics test application. target 'testapp' do - pod 'Firebase/Analytics', '6.17.0' + pod 'Firebase/Analytics', '6.24.0' end diff --git a/auth/testapp/Podfile b/auth/testapp/Podfile index 0f2f4278..a71424d3 100644 --- a/auth/testapp/Podfile +++ b/auth/testapp/Podfile @@ -2,5 +2,5 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' # Auth test application. target 'testapp' do - pod 'Firebase/Auth', '6.17.0' + pod 'Firebase/Auth', '6.24.0' end diff --git a/database/testapp/CMakeLists.txt b/database/testapp/CMakeLists.txt index e2aa427b..d505b0c9 100644 --- a/database/testapp/CMakeLists.txt +++ b/database/testapp/CMakeLists.txt @@ -95,7 +95,7 @@ else() "-framework Security" ) elseif(MSVC) - set(ADDITIONAL_LIBS advapi32 ws2_32 crypt32 iphlpapi psapi userenv) + set(ADDITIONAL_LIBS advapi32 ws2_32 crypt32 iphlpapi psapi userenv shell32) else() set(ADDITIONAL_LIBS pthread) endif() diff --git a/database/testapp/Podfile b/database/testapp/Podfile index ca0a839e..3509b28c 100644 --- a/database/testapp/Podfile +++ b/database/testapp/Podfile @@ -2,6 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' # Firebase Realtime Database test application. target 'testapp' do - pod 'Firebase/Database', '6.17.0' - pod 'Firebase/Auth', '6.17.0' + pod 'Firebase/Database', '6.24.0' + pod 'Firebase/Auth', '6.24.0' end diff --git a/demos/TicTacToe/CMakeLists.txt b/demos/TicTacToe/CMakeLists.txt index 630ad65e..b209edcc 100644 --- a/demos/TicTacToe/CMakeLists.txt +++ b/demos/TicTacToe/CMakeLists.txt @@ -10,10 +10,10 @@ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: - + # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. - + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -90,7 +90,6 @@ endif() if(NOT DEFINED BUILD_ENGINE_DONE) # to test install_test into root project set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cocos2d) set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) - include(CocosBuildSet) add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) endif() @@ -105,8 +104,8 @@ if(APPLE OR WINDOWS) endif() # add cross-platforms source files and header files -list(APPEND GAME_SOURCE Classes/AppDelegate.cpp Classes/TicTacToeScene.cpp) -list(APPEND GAME_HEADER Classes/AppDelegate.h Classes/TicTacToeScene.h) +list(APPEND GAME_SOURCE Classes/app_delegate.cc ) +list(APPEND GAME_HEADER Classes/app_delegate.h ) if(ANDROID) # change APP_NAME to the share library name for Android, it's value depend on AndroidManifest.xml diff --git a/demos/TicTacToe/Classes/AppDelegate.cpp b/demos/TicTacToe/Classes/app_delegate.cc similarity index 93% rename from demos/TicTacToe/Classes/AppDelegate.cpp rename to demos/TicTacToe/Classes/app_delegate.cc index 6fd2ab92..8849dcc5 100644 --- a/demos/TicTacToe/Classes/AppDelegate.cpp +++ b/demos/TicTacToe/Classes/app_delegate.cc @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "AppDelegate.h" +#include "app_delegate.h" + +#include "main_menu_scene.h" +#include "tic_tac_toe_scene.h" -#include "MainMenuScene.h" -#include "TicTacToeScene.h" USING_NS_CC; // Set based on the image width. diff --git a/demos/TicTacToe/Classes/AppDelegate.h b/demos/TicTacToe/Classes/app_delegate.h similarity index 100% rename from demos/TicTacToe/Classes/AppDelegate.h rename to demos/TicTacToe/Classes/app_delegate.h diff --git a/demos/TicTacToe/Classes/MainMenuScene.cpp b/demos/TicTacToe/Classes/main_menu_scene.cc similarity index 99% rename from demos/TicTacToe/Classes/MainMenuScene.cpp rename to demos/TicTacToe/Classes/main_menu_scene.cc index 3a3267b0..3ad84af9 100644 --- a/demos/TicTacToe/Classes/MainMenuScene.cpp +++ b/demos/TicTacToe/Classes/main_menu_scene.cc @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "MainMenuScene.h" +#include "main_menu_scene.h" #include #include "cocos2d.h" +#include "firebase/util.h" +#include "tic_tac_toe_scene.h" #include "util.h" -#include "TicTacToeScene.h" static const char* kCreateGameImage = "create_game.png"; static const char* kTextFieldBorderImage = "text_field_border.png"; diff --git a/demos/TicTacToe/Classes/MainMenuScene.h b/demos/TicTacToe/Classes/main_menu_scene.h similarity index 100% rename from demos/TicTacToe/Classes/MainMenuScene.h rename to demos/TicTacToe/Classes/main_menu_scene.h index 2759fbe8..f5181339 100644 --- a/demos/TicTacToe/Classes/MainMenuScene.h +++ b/demos/TicTacToe/Classes/main_menu_scene.h @@ -17,10 +17,10 @@ #include +#include "cocos2d.h" #include "firebase/auth.h" -#include "firebase/future.h" #include "firebase/database.h" -#include "cocos2d.h" +#include "firebase/future.h" using std::to_string; diff --git a/demos/TicTacToe/Classes/TicTacToeLayer.cpp b/demos/TicTacToe/Classes/tic_tac_toe_layer.cc similarity index 99% rename from demos/TicTacToe/Classes/TicTacToeLayer.cpp rename to demos/TicTacToe/Classes/tic_tac_toe_layer.cc index f903966f..45266dc8 100644 --- a/demos/TicTacToe/Classes/TicTacToeLayer.cpp +++ b/demos/TicTacToe/Classes/tic_tac_toe_layer.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "TicTacToeLayer.h" +#include "tic_tac_toe_layer.h" USING_NS_CC; diff --git a/demos/TicTacToe/Classes/TicTacToeLayer.h b/demos/TicTacToe/Classes/tic_tac_toe_layer.h similarity index 99% rename from demos/TicTacToe/Classes/TicTacToeLayer.h rename to demos/TicTacToe/Classes/tic_tac_toe_layer.h index 81581e3e..deb4624f 100644 --- a/demos/TicTacToe/Classes/TicTacToeLayer.h +++ b/demos/TicTacToe/Classes/tic_tac_toe_layer.h @@ -27,8 +27,8 @@ #include #include -#include "TicTacToeScene.h" #include "cocos2d.h" +#include "tic_tac_toe_scene.h" #include "util.h" using cocos2d::Director; diff --git a/demos/TicTacToe/Classes/TicTacToeScene.cpp b/demos/TicTacToe/Classes/tic_tac_toe_scene.cc similarity index 97% rename from demos/TicTacToe/Classes/TicTacToeScene.cpp rename to demos/TicTacToe/Classes/tic_tac_toe_scene.cc index 054b8abf..de3f907d 100644 --- a/demos/TicTacToe/Classes/TicTacToeScene.cpp +++ b/demos/TicTacToe/Classes/tic_tac_toe_scene.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "TicTacToeScene.h" +#include "tic_tac_toe_scene.h" using cocos2d::Scene; diff --git a/demos/TicTacToe/Classes/TicTacToeScene.h b/demos/TicTacToe/Classes/tic_tac_toe_scene.h similarity index 95% rename from demos/TicTacToe/Classes/TicTacToeScene.h rename to demos/TicTacToe/Classes/tic_tac_toe_scene.h index 031e184b..3232b1ca 100644 --- a/demos/TicTacToe/Classes/TicTacToeScene.h +++ b/demos/TicTacToe/Classes/tic_tac_toe_scene.h @@ -15,9 +15,9 @@ #ifndef TICTACTOE_DEMO_CLASSES_TICTACTOE_SCENE_H_ #define TICTACTOE_DEMO_CLASSES_TICTACTOE_SCENE_H_ -#include "MainMenuScene.h" -#include "TicTacToeLayer.h" #include "cocos2d.h" +#include "main_menu_scene.h" +#include "tic_tac_toe_layer.h" #include "util.h" class TicTacToe : public cocos2d::Layer { diff --git a/demos/TicTacToe/Classes/util.cpp b/demos/TicTacToe/Classes/util.cc similarity index 97% rename from demos/TicTacToe/Classes/util.cpp rename to demos/TicTacToe/Classes/util.cc index 32838260..de43d63f 100644 --- a/demos/TicTacToe/Classes/util.cpp +++ b/demos/TicTacToe/Classes/util.cc @@ -14,6 +14,9 @@ #include "util.h" +#include +#include + #include // Logs the message passed in to the console. diff --git a/demos/TicTacToe/Classes/util.h b/demos/TicTacToe/Classes/util.h index 60ea2ccb..c43906ad 100644 --- a/demos/TicTacToe/Classes/util.h +++ b/demos/TicTacToe/Classes/util.h @@ -14,6 +14,8 @@ #ifndef TICTACTOE_DEMO_CLASSES_UTIL_H_ #define TICTACTOE_DEMO_CLASSES_UTIL_H_ +#include + #include "firebase/future.h" // inputs: const char* as the message that will be displayed. diff --git a/dynamic_links/testapp/Podfile b/dynamic_links/testapp/Podfile index 8d4eb2c1..be1c85ab 100644 --- a/dynamic_links/testapp/Podfile +++ b/dynamic_links/testapp/Podfile @@ -2,5 +2,5 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' # Dynamic Links test application. target 'testapp' do - pod 'Firebase/DynamicLinks', '6.17.0' + pod 'Firebase/DynamicLinks', '6.24.0' end diff --git a/firestore/testapp/Podfile b/firestore/testapp/Podfile index 4ded7f10..eb725652 100644 --- a/firestore/testapp/Podfile +++ b/firestore/testapp/Podfile @@ -2,7 +2,7 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' # Firebase Firestore test application. target 'testapp' do - pod 'Firebase/Analytics', '6.18.0' - pod 'Firebase/Firestore', '6.18.0' - pod 'Firebase/Auth', '6.18.0' + pod 'Firebase/Analytics', '6.24.0' + pod 'Firebase/Firestore', '6.24.0' + pod 'Firebase/Auth', '6.24.0' end diff --git a/firestore/testapp/src/common_main.cc b/firestore/testapp/src/common_main.cc index e13abe14..3fd6757e 100644 --- a/firestore/testapp/src/common_main.cc +++ b/firestore/testapp/src/common_main.cc @@ -30,9 +30,9 @@ const int kTimeoutMs = 5000; const int kSleepMs = 100; -// Wait for a Future to be completed. If the Future returns an error, it will -// be logged. -void Await(const firebase::FutureBase& future, const char* name) { +// Waits for a Future to be completed and returns whether the future has +// completed successfully. If the Future returns an error, it will be logged. +bool Await(const firebase::FutureBase& future, const char* name) { int remaining_timeout = kTimeoutMs; while (future.status() == firebase::kFutureStatusPending && remaining_timeout > 0) { @@ -42,10 +42,13 @@ void Await(const firebase::FutureBase& future, const char* name) { if (future.status() != firebase::kFutureStatusComplete) { LogMessage("ERROR: %s returned an invalid result.", name); + return false; } else if (future.error() != 0) { LogMessage("ERROR: %s returned error %d: %s", name, future.error(), future.error_message()); + return false; } + return true; } class Countable { @@ -65,7 +68,7 @@ class TestEventListener : public Countable, void OnEvent(const T& value, const firebase::firestore::Error error) override { event_count_++; - if (error != firebase::firestore::Ok) { + if (error != firebase::firestore::kOk) { LogMessage("ERROR: EventListener %s got %d.", name_.c_str(), error); } } @@ -124,11 +127,11 @@ extern "C" int common_main(int argc, const char* argv[]) { // Auth caches the previously signed-in user, which can be annoying when // trying to test for sign-in failures. auth->SignOut(); - auto future_login = auth->SignInAnonymously(); - Await(future_login, "Auth sign-in"); - auto* future_login_result = future_login.result(); - if (future_login_result && *future_login_result) { - const firebase::auth::User* user = *future_login_result; + auto login_future = auth->SignInAnonymously(); + Await(login_future, "Auth sign-in"); + auto* login_result = login_future.result(); + if (login_result && *login_result) { + const firebase::auth::User* user = *login_result; LogMessage("Signed in as %s user, uid: %s, email: %s.\n", user->is_anonymous() ? "an anonymous" : "a non-anonymous", user->uid().c_str(), user->email().c_str()); @@ -138,7 +141,7 @@ extern "C" int common_main(int argc, const char* argv[]) { // Note: Auth cannot be deleted while any of the futures issued by it are // still valid. - future_login.Release(); + login_future.Release(); LogMessage("Initialize Firebase Firestore."); @@ -170,7 +173,7 @@ extern "C" int common_main(int argc, const char* argv[]) { } LogMessage("Successfully initialized Firebase Firestore."); - firestore->set_logging_enabled(true); + firestore->set_log_level(firebase::kLogLevelDebug); if (firestore->app() != app) { LogMessage("ERROR: failed to get App the Firestore was created with."); @@ -219,28 +222,20 @@ extern "C" int common_main(int argc, const char* argv[]) { } LogMessage("Testing Set()."); - document.Set(firebase::firestore::MapFieldValue{ - {"str", firebase::firestore::FieldValue::FromString("foo")}, - {"int", firebase::firestore::FieldValue::FromInteger(123LL)}}); - Await(document.SetLastResult(), "document.Set"); - if (document.SetLastResult().status() != firebase::kFutureStatusComplete) { - LogMessage("ERROR: failed to write document."); - } + Await(document.Set(firebase::firestore::MapFieldValue{ + {"str", firebase::firestore::FieldValue::String("foo")}, + {"int", firebase::firestore::FieldValue::Integer(123)}}), + "document.Set"); LogMessage("Testing Update()."); - document.Update(firebase::firestore::MapFieldValue{ - {"int", firebase::firestore::FieldValue::FromInteger(321LL)}}); - Await(document.UpdateLastResult(), "document.Update"); - if (document.UpdateLastResult().status() != firebase::kFutureStatusComplete) { - LogMessage("ERROR: failed to write document."); - } + Await(document.Update(firebase::firestore::MapFieldValue{ + {"int", firebase::firestore::FieldValue::Integer(321)}}), + "document.Update"); LogMessage("Testing Get()."); - document.Get(); - Await(document.GetLastResult(), "document.Get"); - if (document.GetLastResult().status() == firebase::kFutureStatusComplete) { - const firebase::firestore::DocumentSnapshot* snapshot = - document.GetLastResult().result(); + auto doc_future = document.Get(); + if (Await(doc_future, "document.Get")) { + const firebase::firestore::DocumentSnapshot* snapshot = doc_future.result(); if (snapshot == nullptr) { LogMessage("ERROR: failed to read document."); } else { @@ -263,11 +258,7 @@ extern "C" int common_main(int argc, const char* argv[]) { } LogMessage("Testing Delete()."); - document.Delete(); - Await(document.DeleteLastResult(), "document.Delete"); - if (document.DeleteLastResult().status() != firebase::kFutureStatusComplete) { - LogMessage("ERROR: failed to delete document."); - } + Await(document.Delete(), "document.Delete"); LogMessage("Tested document operations."); TestEventListener @@ -282,50 +273,41 @@ extern "C" int common_main(int argc, const char* argv[]) { firebase::firestore::WriteBatch batch = firestore->batch(); batch.Set(collection.Document("one"), firebase::firestore::MapFieldValue{ - {"str", firebase::firestore::FieldValue::FromString("foo")}}); + {"str", firebase::firestore::FieldValue::String("foo")}}); batch.Set(collection.Document("two"), firebase::firestore::MapFieldValue{ - {"int", firebase::firestore::FieldValue::FromInteger(123LL)}}); - batch.Commit(); - Await(batch.CommitLastResult(), "batch.Commit"); - if (batch.CommitLastResult().status() != firebase::kFutureStatusComplete) { - LogMessage("ERROR: failed to write batch."); - } + {"int", firebase::firestore::FieldValue::Integer(123)}}); + Await(batch.Commit(), "batch.Commit"); LogMessage("Tested batch write."); LogMessage("Testing transaction."); - firestore->RunTransaction( - [collection](firebase::firestore::Transaction* transaction, - std::string* error_message) -> firebase::firestore::Error { - transaction->Update( - collection.Document("one"), - firebase::firestore::MapFieldValue{ - {"int", firebase::firestore::FieldValue::FromInteger(123LL)}}); - transaction->Delete(collection.Document("two")); - transaction->Set( - collection.Document("three"), - firebase::firestore::MapFieldValue{ - {"int", firebase::firestore::FieldValue::FromInteger(321LL)}}); - return firebase::firestore::Ok; - }); - Await(firestore->RunTransactionLastResult(), "firestore.RunTransaction"); - if (firestore->RunTransactionLastResult().status() != - firebase::kFutureStatusComplete) { - LogMessage("ERROR: failed to run transaction."); - } + Await( + firestore->RunTransaction( + [collection](firebase::firestore::Transaction& transaction, + std::string&) -> firebase::firestore::Error { + transaction.Update( + collection.Document("one"), + firebase::firestore::MapFieldValue{ + {"int", firebase::firestore::FieldValue::Integer(123)}}); + transaction.Delete(collection.Document("two")); + transaction.Set( + collection.Document("three"), + firebase::firestore::MapFieldValue{ + {"int", firebase::firestore::FieldValue::Integer(321)}}); + return firebase::firestore::kOk; + }), + "firestore.RunTransaction"); LogMessage("Tested transaction."); LogMessage("Testing query."); firebase::firestore::Query query = collection .WhereGreaterThan("int", - firebase::firestore::FieldValue::FromBoolean(true)) + firebase::firestore::FieldValue::Boolean(true)) .Limit(3); - query.Get(); - Await(query.GetLastResult(), "query.Get"); - if (query.GetLastResult().status() == firebase::kFutureStatusComplete) { - const firebase::firestore::QuerySnapshot* snapshot = - query.GetLastResult().result(); + auto query_future = query.Get(); + if (Await(query_future, "query.Get")) { + const firebase::firestore::QuerySnapshot* snapshot = query_future.result(); if (snapshot == nullptr) { LogMessage("ERROR: failed to fetch query result."); } else { diff --git a/firestore/testapp/src/desktop/desktop_main.cc b/firestore/testapp/src/desktop/desktop_main.cc index 74f03896..3a027f82 100644 --- a/firestore/testapp/src/desktop/desktop_main.cc +++ b/firestore/testapp/src/desktop/desktop_main.cc @@ -118,6 +118,6 @@ int64_t WinGetCurrentTimeInMicroseconds() { // Windows file time is expressed in 100s of nanoseconds. // To convert to microseconds, multiply x10. - return now.QuadPart * 10LL; + return now.QuadPart * 10; } #endif diff --git a/functions/testapp/Podfile b/functions/testapp/Podfile index 5c0c906a..eb5c0fc8 100644 --- a/functions/testapp/Podfile +++ b/functions/testapp/Podfile @@ -2,6 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' # Cloud Functions for Firebase test application. target 'testapp' do - pod 'Firebase/Functions', '6.17.0' - pod 'Firebase/Auth', '6.17.0' + pod 'Firebase/Functions', '6.24.0' + pod 'Firebase/Auth', '6.24.0' end diff --git a/messaging/testapp/Podfile b/messaging/testapp/Podfile index 425161a9..b0f6333b 100644 --- a/messaging/testapp/Podfile +++ b/messaging/testapp/Podfile @@ -2,5 +2,5 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' # FCM test application. target 'testapp' do - pod 'Firebase/Messaging', '6.17.0' + pod 'Firebase/Messaging', '6.24.0' end diff --git a/remote_config/testapp/Podfile b/remote_config/testapp/Podfile index 14afba59..d44ec81f 100644 --- a/remote_config/testapp/Podfile +++ b/remote_config/testapp/Podfile @@ -2,5 +2,5 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' # Firebase Remote Config test application. target 'testapp' do - pod 'Firebase/RemoteConfig', '6.17.0' + pod 'Firebase/RemoteConfig', '6.24.0' end diff --git a/storage/testapp/Podfile b/storage/testapp/Podfile index d7be90c8..5dca5c0b 100644 --- a/storage/testapp/Podfile +++ b/storage/testapp/Podfile @@ -2,6 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' # Cloud Storage for Firebase test application. target 'testapp' do - pod 'Firebase/Storage', '6.17.0' - pod 'Firebase/Auth', '6.17.0' + pod 'Firebase/Storage', '6.24.0' + pod 'Firebase/Auth', '6.24.0' end