From af2b16ee756cb7475e2ed49e49f8813603a23e6c Mon Sep 17 00:00:00 2001 From: Mark Grimes Date: Wed, 3 Jun 2020 16:23:52 +0100 Subject: [PATCH 1/9] Update for API changes --- firestore/testapp/src/common_main.cc | 78 ++++++++++++++-------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/firestore/testapp/src/common_main.cc b/firestore/testapp/src/common_main.cc index e13abe14..b0dd3d37 100644 --- a/firestore/testapp/src/common_main.cc +++ b/firestore/testapp/src/common_main.cc @@ -65,7 +65,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); } } @@ -170,7 +170,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::LogLevel::kLogLevelVerbose); if (firestore->app() != app) { LogMessage("ERROR: failed to get App the Firestore was created with."); @@ -219,28 +219,28 @@ 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) { + auto setResult=document.Set(firebase::firestore::MapFieldValue{ + {"str", firebase::firestore::FieldValue::String("foo")}, + {"int", firebase::firestore::FieldValue::Integer(123LL)}}); + Await(setResult, "document.Set"); + if (setResult.status() != firebase::kFutureStatusComplete) { LogMessage("ERROR: failed to write document."); } 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) { + auto updateResult=document.Update(firebase::firestore::MapFieldValue{ + {"int", firebase::firestore::FieldValue::Integer(321LL)}}); + Await(updateResult, "document.Update"); + if (updateResult.status() != firebase::kFutureStatusComplete) { LogMessage("ERROR: failed to write document."); } LogMessage("Testing Get()."); - document.Get(); - Await(document.GetLastResult(), "document.Get"); - if (document.GetLastResult().status() == firebase::kFutureStatusComplete) { + auto getDocumentResult=document.Get(); + Await(getDocumentResult, "document.Get"); + if (getDocumentResult.status() == firebase::kFutureStatusComplete) { const firebase::firestore::DocumentSnapshot* snapshot = - document.GetLastResult().result(); + getDocumentResult.result(); if (snapshot == nullptr) { LogMessage("ERROR: failed to read document."); } else { @@ -263,9 +263,9 @@ 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) { + auto deleteResult=document.Delete(); + Await(deleteResult, "document.Delete"); + if (deleteResult.status() != firebase::kFutureStatusComplete) { LogMessage("ERROR: failed to delete document."); } LogMessage("Tested document operations."); @@ -282,34 +282,34 @@ 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) { + {"int", firebase::firestore::FieldValue::Integer(123LL)}}); + auto commitResult=batch.Commit(); + Await(commitResult, "batch.Commit"); + if (commitResult.status() != firebase::kFutureStatusComplete) { LogMessage("ERROR: failed to write batch."); } LogMessage("Tested batch write."); LogMessage("Testing transaction."); - firestore->RunTransaction( - [collection](firebase::firestore::Transaction* transaction, - std::string* error_message) -> firebase::firestore::Error { - transaction->Update( + auto runTransactionResult=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( + {"int", firebase::firestore::FieldValue::Integer(123LL)}}); + transaction.Delete(collection.Document("two")); + transaction.Set( collection.Document("three"), firebase::firestore::MapFieldValue{ - {"int", firebase::firestore::FieldValue::FromInteger(321LL)}}); - return firebase::firestore::Ok; + {"int", firebase::firestore::FieldValue::Integer(321LL)}}); + return firebase::firestore::kOk; }); - Await(firestore->RunTransactionLastResult(), "firestore.RunTransaction"); - if (firestore->RunTransactionLastResult().status() != + Await(runTransactionResult, "firestore.RunTransaction"); + if (runTransactionResult.status() != firebase::kFutureStatusComplete) { LogMessage("ERROR: failed to run transaction."); } @@ -319,13 +319,13 @@ extern "C" int common_main(int argc, const char* argv[]) { 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) { + auto getQueryResult=query.Get(); + Await(getQueryResult, "query.Get"); + if (getQueryResult.status() == firebase::kFutureStatusComplete) { const firebase::firestore::QuerySnapshot* snapshot = - query.GetLastResult().result(); + getQueryResult.result(); if (snapshot == nullptr) { LogMessage("ERROR: failed to fetch query result."); } else { From 7445988c263f5e1701cc7a37ea934dfbe48f78b3 Mon Sep 17 00:00:00 2001 From: Mark Grimes Date: Wed, 3 Jun 2020 18:01:36 +0100 Subject: [PATCH 2/9] Change logging from verbose to warning Otherwise test results get lost in the crowd. --- firestore/testapp/src/common_main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firestore/testapp/src/common_main.cc b/firestore/testapp/src/common_main.cc index b0dd3d37..a613d007 100644 --- a/firestore/testapp/src/common_main.cc +++ b/firestore/testapp/src/common_main.cc @@ -170,7 +170,7 @@ extern "C" int common_main(int argc, const char* argv[]) { } LogMessage("Successfully initialized Firebase Firestore."); - firestore->set_log_level(firebase::LogLevel::kLogLevelVerbose); + firestore->set_log_level(firebase::LogLevel::kLogLevelWarning); if (firestore->app() != app) { LogMessage("ERROR: failed to get App the Firestore was created with."); From c33541f32938977118047e0b03123dc702d75c26 Mon Sep 17 00:00:00 2001 From: Mark Grimes Date: Wed, 3 Jun 2020 20:17:56 +0100 Subject: [PATCH 3/9] Add spaces around equals signs --- firestore/testapp/src/common_main.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/firestore/testapp/src/common_main.cc b/firestore/testapp/src/common_main.cc index a613d007..516614c4 100644 --- a/firestore/testapp/src/common_main.cc +++ b/firestore/testapp/src/common_main.cc @@ -219,7 +219,7 @@ extern "C" int common_main(int argc, const char* argv[]) { } LogMessage("Testing Set()."); - auto setResult=document.Set(firebase::firestore::MapFieldValue{ + auto setResult = document.Set(firebase::firestore::MapFieldValue{ {"str", firebase::firestore::FieldValue::String("foo")}, {"int", firebase::firestore::FieldValue::Integer(123LL)}}); Await(setResult, "document.Set"); @@ -228,7 +228,7 @@ extern "C" int common_main(int argc, const char* argv[]) { } LogMessage("Testing Update()."); - auto updateResult=document.Update(firebase::firestore::MapFieldValue{ + auto updateResult = document.Update(firebase::firestore::MapFieldValue{ {"int", firebase::firestore::FieldValue::Integer(321LL)}}); Await(updateResult, "document.Update"); if (updateResult.status() != firebase::kFutureStatusComplete) { @@ -236,7 +236,7 @@ extern "C" int common_main(int argc, const char* argv[]) { } LogMessage("Testing Get()."); - auto getDocumentResult=document.Get(); + auto getDocumentResult = document.Get(); Await(getDocumentResult, "document.Get"); if (getDocumentResult.status() == firebase::kFutureStatusComplete) { const firebase::firestore::DocumentSnapshot* snapshot = @@ -263,7 +263,7 @@ extern "C" int common_main(int argc, const char* argv[]) { } LogMessage("Testing Delete()."); - auto deleteResult=document.Delete(); + auto deleteResult = document.Delete(); Await(deleteResult, "document.Delete"); if (deleteResult.status() != firebase::kFutureStatusComplete) { LogMessage("ERROR: failed to delete document."); @@ -286,7 +286,7 @@ extern "C" int common_main(int argc, const char* argv[]) { batch.Set(collection.Document("two"), firebase::firestore::MapFieldValue{ {"int", firebase::firestore::FieldValue::Integer(123LL)}}); - auto commitResult=batch.Commit(); + auto commitResult = batch.Commit(); Await(commitResult, "batch.Commit"); if (commitResult.status() != firebase::kFutureStatusComplete) { LogMessage("ERROR: failed to write batch."); @@ -294,7 +294,7 @@ extern "C" int common_main(int argc, const char* argv[]) { LogMessage("Tested batch write."); LogMessage("Testing transaction."); - auto runTransactionResult=firestore->RunTransaction( + auto runTransactionResult = firestore->RunTransaction( [collection](firebase::firestore::Transaction& transaction, std::string& error_message) -> firebase::firestore::Error { transaction.Update( @@ -321,7 +321,7 @@ extern "C" int common_main(int argc, const char* argv[]) { .WhereGreaterThan("int", firebase::firestore::FieldValue::Boolean(true)) .Limit(3); - auto getQueryResult=query.Get(); + auto getQueryResult = query.Get(); Await(getQueryResult, "query.Get"); if (getQueryResult.status() == firebase::kFutureStatusComplete) { const firebase::firestore::QuerySnapshot* snapshot = From b02c6a36d67b41a6bfa02ecbe644b2560d9ccec7 Mon Sep 17 00:00:00 2001 From: Anthony Date: Mon, 8 Jun 2020 13:59:55 -0700 Subject: [PATCH 4/9] Integrate Latest @ 314842997 CL: 314842997 --- admob/testapp/Podfile | 2 +- analytics/testapp/Podfile | 2 +- auth/testapp/Podfile | 2 +- database/testapp/CMakeLists.txt | 2 +- database/testapp/Podfile | 4 +- dynamic_links/testapp/Podfile | 2 +- firestore/testapp/Podfile | 6 +- firestore/testapp/src/common_main.cc | 108 ++++++++---------- firestore/testapp/src/desktop/desktop_main.cc | 2 +- functions/testapp/Podfile | 4 +- messaging/testapp/Podfile | 2 +- remote_config/testapp/Podfile | 2 +- storage/testapp/Podfile | 4 +- 13 files changed, 62 insertions(+), 80 deletions(-) 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/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 516614c4..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 { @@ -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_log_level(firebase::LogLevel::kLogLevelWarning); + 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()."); - auto setResult = document.Set(firebase::firestore::MapFieldValue{ - {"str", firebase::firestore::FieldValue::String("foo")}, - {"int", firebase::firestore::FieldValue::Integer(123LL)}}); - Await(setResult, "document.Set"); - if (setResult.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()."); - auto updateResult = document.Update(firebase::firestore::MapFieldValue{ - {"int", firebase::firestore::FieldValue::Integer(321LL)}}); - Await(updateResult, "document.Update"); - if (updateResult.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()."); - auto getDocumentResult = document.Get(); - Await(getDocumentResult, "document.Get"); - if (getDocumentResult.status() == firebase::kFutureStatusComplete) { - const firebase::firestore::DocumentSnapshot* snapshot = - getDocumentResult.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()."); - auto deleteResult = document.Delete(); - Await(deleteResult, "document.Delete"); - if (deleteResult.status() != firebase::kFutureStatusComplete) { - LogMessage("ERROR: failed to delete document."); - } + Await(document.Delete(), "document.Delete"); LogMessage("Tested document operations."); TestEventListener @@ -285,34 +276,27 @@ extern "C" int common_main(int argc, const char* argv[]) { {"str", firebase::firestore::FieldValue::String("foo")}}); batch.Set(collection.Document("two"), firebase::firestore::MapFieldValue{ - {"int", firebase::firestore::FieldValue::Integer(123LL)}}); - auto commitResult = batch.Commit(); - Await(commitResult, "batch.Commit"); - if (commitResult.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."); - auto runTransactionResult = 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::Integer(123LL)}}); - transaction.Delete(collection.Document("two")); - transaction.Set( - collection.Document("three"), - firebase::firestore::MapFieldValue{ - {"int", firebase::firestore::FieldValue::Integer(321LL)}}); - return firebase::firestore::kOk; - }); - Await(runTransactionResult, "firestore.RunTransaction"); - if (runTransactionResult.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."); @@ -321,11 +305,9 @@ extern "C" int common_main(int argc, const char* argv[]) { .WhereGreaterThan("int", firebase::firestore::FieldValue::Boolean(true)) .Limit(3); - auto getQueryResult = query.Get(); - Await(getQueryResult, "query.Get"); - if (getQueryResult.status() == firebase::kFutureStatusComplete) { - const firebase::firestore::QuerySnapshot* snapshot = - getQueryResult.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 From 12a177e81d9c18256925cefc41f50fd7c6b4bbea Mon Sep 17 00:00:00 2001 From: Grant-Postma Date: Tue, 7 Jul 2020 00:24:32 -0400 Subject: [PATCH 5/9] refactor file names --- demos/TicTacToe/CMakeLists.txt | 14 ++++++-------- .../Classes/{AppDelegate.cpp => app_delegate.cc} | 7 ++++--- .../Classes/{AppDelegate.h => app_delegate.h} | 0 .../{MainMenuScene.cpp => main_menu_scene.cc} | 5 +++-- .../Classes/{MainMenuScene.h => main_menu_scene.h} | 4 ++-- .../{TicTacToeLayer.cpp => tic_tac_toe_layer.cc} | 2 +- .../{TicTacToeLayer.h => tic_tac_toe_layer.h} | 2 +- .../{TicTacToeScene.cpp => tic_tac_toe_scene.cc} | 2 +- .../{TicTacToeScene.h => tic_tac_toe_scene.h} | 4 ++-- demos/TicTacToe/Classes/{util.cpp => util.cc} | 3 +++ demos/TicTacToe/Classes/util.h | 2 ++ 11 files changed, 25 insertions(+), 20 deletions(-) rename demos/TicTacToe/Classes/{AppDelegate.cpp => app_delegate.cc} (93%) rename demos/TicTacToe/Classes/{AppDelegate.h => app_delegate.h} (100%) rename demos/TicTacToe/Classes/{MainMenuScene.cpp => main_menu_scene.cc} (99%) rename demos/TicTacToe/Classes/{MainMenuScene.h => main_menu_scene.h} (100%) rename demos/TicTacToe/Classes/{TicTacToeLayer.cpp => tic_tac_toe_layer.cc} (99%) rename demos/TicTacToe/Classes/{TicTacToeLayer.h => tic_tac_toe_layer.h} (99%) rename demos/TicTacToe/Classes/{TicTacToeScene.cpp => tic_tac_toe_scene.cc} (97%) rename demos/TicTacToe/Classes/{TicTacToeScene.h => tic_tac_toe_scene.h} (95%) rename demos/TicTacToe/Classes/{util.cpp => util.cc} (97%) diff --git a/demos/TicTacToe/CMakeLists.txt b/demos/TicTacToe/CMakeLists.txt index 630ad65e..1f82f907 100644 --- a/demos/TicTacToe/CMakeLists.txt +++ b/demos/TicTacToe/CMakeLists.txt @@ -10,10 +10,8 @@ # 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 @@ -63,8 +61,7 @@ endif() set(FOUND_JSON_FILE FALSE) foreach(config "google-services-desktop.json" "google-services.json") if (EXISTS ${config}) - add_custom_command( - TARGET ${APP_NAME} POST_BUILD + add_custom_command( TARGET ${APP_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${config} $) set(FOUND_JSON_FILE TRUE) @@ -74,6 +71,7 @@ endforeach() if(NOT FOUND_JSON_FILE) message(WARNING "Failed to find either google-services-desktop.json or google-services.json. See the readme.md for more information.") endif() + #Target name change to cocos # Add the Firebase libraries to the target using the function from the SDK. add_subdirectory(${FIREBASE_CPP_SDK_DIR} bin/ EXCLUDE_FROM_ALL) @@ -90,7 +88,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() @@ -99,14 +96,15 @@ endif() set(GAME_HEADER) set(GAME_RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/Resources") +set(GAME_ClASSES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/Classes") if(APPLE OR WINDOWS) cocos_mark_multi_resources(common_res_files RES_TO "Resources" FOLDERS ${GAME_RES_FOLDER}) 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 @@ -148,7 +146,7 @@ endif() target_link_libraries(${APP_NAME} cocos2d "${firebase_libs}" ${ADDITIONAL_LIBS}) target_include_directories(${APP_NAME} PRIVATE Classes - PRIVATE ${COCOS2DX_ROOT_PATH}/cocos/audio/include/) + PRIVATE ${COCOS2DX_ROOT_PATH}/cocos/audio/include/ ) # mark app resources setup_cocos_app_config(${APP_NAME}) 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. From 3731b65593f350ffe972537ce591faf4ebf26687 Mon Sep 17 00:00:00 2001 From: Grant Postma Date: Tue, 7 Jul 2020 10:21:45 -0400 Subject: [PATCH 6/9] Adding util.cpp and util.h files (#54) * Auth full changes (#8) * Moving common functions into header files. Moving database & auth to MainMenuScene. Adding Auth node with fields and listeners. Set up user record management. Set up user sign-up, login and anonymous login. * auth full review by @DellaBitta * Private Class variables. Bug on disbanded room. * Moving common functions to util.h and util.cpp. Adding more comments on util functions. * Added missing period. * removing double new line. modifying includes in util.h and util.cpp --- demos/TicTacToe/Classes/MainMenuScene.cpp | 50 +---------------- demos/TicTacToe/Classes/MainMenuScene.h | 15 ++--- demos/TicTacToe/Classes/TicTacToeLayer.h | 2 +- demos/TicTacToe/Classes/TicTacToeScene.h | 1 + demos/TicTacToe/Classes/util.cpp | 67 +++++++++++++++++++++++ demos/TicTacToe/Classes/util.h | 43 +++++++++++++++ 6 files changed, 119 insertions(+), 59 deletions(-) create mode 100644 demos/TicTacToe/Classes/util.cpp create mode 100644 demos/TicTacToe/Classes/util.h diff --git a/demos/TicTacToe/Classes/MainMenuScene.cpp b/demos/TicTacToe/Classes/MainMenuScene.cpp index 515ea26e..3a3267b0 100644 --- a/demos/TicTacToe/Classes/MainMenuScene.cpp +++ b/demos/TicTacToe/Classes/MainMenuScene.cpp @@ -16,6 +16,8 @@ #include +#include "cocos2d.h" +#include "util.h" #include "TicTacToeScene.h" static const char* kCreateGameImage = "create_game.png"; @@ -29,54 +31,6 @@ static const char* kSignUpButtonImage = "sign_up.png"; const std::regex email_pattern("(\\w+)(\\.|_)?(\\w*)@(\\w+)(\\.(\\w+))+"); USING_NS_CC; -void LogMessage(const char* format, ...) { - va_list list; - va_start(list, format); - vprintf(format, list); - va_end(list); - printf("\n"); - fflush(stdout); -} - -void ProcessEvents(int msec) { -#ifdef _WIN32 - Sleep(msec); -#else - usleep(msec * 1000); -#endif // _WIN32 -} - -// Wait for a Future to be completed. If the Future returns an error, it will -// be logged. -void WaitForCompletion(const firebase::FutureBase& future, const char* name) { - while (future.status() == firebase::kFutureStatusPending) { - ProcessEvents(100); - } - if (future.status() != firebase::kFutureStatusComplete) { - LogMessage("ERROR: %s returned an invalid result.", name); - } else if (future.error() != 0) { - LogMessage("ERROR: %s returned error %d: %s", name, future.error(), - future.error_message()); - } -} - -// Returns a random uid of a specified length. -std::string GenerateUid(std::size_t length) { - const std::string kCharacters = "0123456789abcdefghjkmnpqrstuvwxyz"; - - std::random_device random_device; - std::mt19937 generator(random_device()); - std::uniform_int_distribution<> distribution(0, kCharacters.size() - 1); - - std::string generate_uid; - - for (std::size_t i = 0; i < length; ++i) { - generate_uid += kCharacters[distribution(generator)]; - } - - return generate_uid; -} - Scene* MainMenuScene::createScene() { // Builds a simple scene that uses the bottom left cordinate point as (0,0) // and can have sprites, labels and layers added onto it. diff --git a/demos/TicTacToe/Classes/MainMenuScene.h b/demos/TicTacToe/Classes/MainMenuScene.h index fd411d28..2759fbe8 100644 --- a/demos/TicTacToe/Classes/MainMenuScene.h +++ b/demos/TicTacToe/Classes/MainMenuScene.h @@ -15,19 +15,14 @@ #ifndef TICTACTOE_DEMO_CLASSES_MAINMENU_SCENE_H_ #define TICTACTOE_DEMO_CLASSES_MAINMENU_SCENE_H_ -#include "cocos2d.h" +#include + #include "firebase/auth.h" -#include "firebase/database.h" #include "firebase/future.h" -#include "firebase/util.h" -#include "ui/CocosGUI.h" -using std::to_string; +#include "firebase/database.h" +#include "cocos2d.h" -// TODO(grantpostma): Create a common util.h & util.cpp file. -void LogMessage(const char*, ...); -void ProcessEvents(int); -void WaitForCompletion(const firebase::FutureBase&, const char*); -std::string GenerateUid(std::size_t); +using std::to_string; class MainMenuScene : public cocos2d::Layer, public cocos2d::TextFieldDelegate { public: diff --git a/demos/TicTacToe/Classes/TicTacToeLayer.h b/demos/TicTacToe/Classes/TicTacToeLayer.h index b8b645d2..81581e3e 100644 --- a/demos/TicTacToe/Classes/TicTacToeLayer.h +++ b/demos/TicTacToe/Classes/TicTacToeLayer.h @@ -27,9 +27,9 @@ #include #include -#include "MainMenuScene.h" #include "TicTacToeScene.h" #include "cocos2d.h" +#include "util.h" using cocos2d::Director; using cocos2d::Event; diff --git a/demos/TicTacToe/Classes/TicTacToeScene.h b/demos/TicTacToe/Classes/TicTacToeScene.h index 6593dd3f..031e184b 100644 --- a/demos/TicTacToe/Classes/TicTacToeScene.h +++ b/demos/TicTacToe/Classes/TicTacToeScene.h @@ -18,6 +18,7 @@ #include "MainMenuScene.h" #include "TicTacToeLayer.h" #include "cocos2d.h" +#include "util.h" class TicTacToe : public cocos2d::Layer { public: diff --git a/demos/TicTacToe/Classes/util.cpp b/demos/TicTacToe/Classes/util.cpp new file mode 100644 index 00000000..32838260 --- /dev/null +++ b/demos/TicTacToe/Classes/util.cpp @@ -0,0 +1,67 @@ +// Copyright 2020 Google Inc. All rights reserved. +// +// 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. + +#include "util.h" + +#include + +// Logs the message passed in to the console. +void LogMessage(const char* format, ...) { + va_list list; + va_start(list, format); + vprintf(format, list); + va_end(list); + printf("\n"); + fflush(stdout); +} + +// Based on operating system, waits for the specified amount of miliseconds. +void ProcessEvents(int msec) { +#ifdef _WIN32 + Sleep(msec); +#else + usleep(msec * 1000); +#endif // _WIN32 +} + +// Wait for a Future to be completed. If the Future returns an error, it will +// be logged. +void WaitForCompletion(const firebase::FutureBase& future, const char* name) { + while (future.status() == firebase::kFutureStatusPending) { + ProcessEvents(100); + } + if (future.status() != firebase::kFutureStatusComplete) { + LogMessage("ERROR: %s returned an invalid result.", name); + } else if (future.error() != 0) { + LogMessage("ERROR: %s returned error %d: %s", name, future.error(), + future.error_message()); + } +} + +// Generates a random uid of a specified length. +std::string GenerateUid(std::size_t length) { + const std::string kCharacters = "0123456789abcdefghjkmnpqrstuvwxyz"; + + std::random_device random_device; + std::mt19937 generator(random_device()); + std::uniform_int_distribution<> distribution(0, kCharacters.size() - 1); + + std::string generate_uid; + + for (std::size_t i = 0; i < length; ++i) { + generate_uid += kCharacters[distribution(generator)]; + } + + return generate_uid; +} diff --git a/demos/TicTacToe/Classes/util.h b/demos/TicTacToe/Classes/util.h new file mode 100644 index 00000000..60ea2ccb --- /dev/null +++ b/demos/TicTacToe/Classes/util.h @@ -0,0 +1,43 @@ +// Copyright 2020 Google Inc. All rights reserved. +// +// 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. +#ifndef TICTACTOE_DEMO_CLASSES_UTIL_H_ +#define TICTACTOE_DEMO_CLASSES_UTIL_H_ + +#include "firebase/future.h" + +// inputs: const char* as the message that will be displayed. +// +// Logs the message to the user through the console. +void LogMessage(const char*, ...); + +// inputs: integer for number of miliseconds. +// +// Acts as a blocking statement to wait for the specified time. +void ProcessEvents(int); + +// inputs: FutureBase waiting to be completed and message describing the future +// action. +// +// Spins on ProcessEvents() while the FutureBase's status is pending, which it +// will then break out and LogMessage() notifying the FutureBase's status is +// completed. +void WaitForCompletion(const firebase::FutureBase&, const char*); + +// inputs: size_t integer specifying the length of the uid. +// +// Generates a unique string based on the length passed in, grabbing the allowed +// characters from the character string defined inside the function. +std::string GenerateUid(std::size_t); + +#endif // TICTACTOE_DEMO_CLASSES_UTIL_H_ From 3e662f6e2d93d27a1d564f3d0a8743dc0de70707 Mon Sep 17 00:00:00 2001 From: Grant-Postma Date: Tue, 7 Jul 2020 10:42:10 -0400 Subject: [PATCH 7/9] reverting cmake unnessecary changes. --- demos/TicTacToe/CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/demos/TicTacToe/CMakeLists.txt b/demos/TicTacToe/CMakeLists.txt index 1f82f907..b209edcc 100644 --- a/demos/TicTacToe/CMakeLists.txt +++ b/demos/TicTacToe/CMakeLists.txt @@ -10,8 +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 @@ -61,7 +63,8 @@ endif() set(FOUND_JSON_FILE FALSE) foreach(config "google-services-desktop.json" "google-services.json") if (EXISTS ${config}) - add_custom_command( TARGET ${APP_NAME} POST_BUILD + add_custom_command( + TARGET ${APP_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${config} $) set(FOUND_JSON_FILE TRUE) @@ -71,7 +74,6 @@ endforeach() if(NOT FOUND_JSON_FILE) message(WARNING "Failed to find either google-services-desktop.json or google-services.json. See the readme.md for more information.") endif() - #Target name change to cocos # Add the Firebase libraries to the target using the function from the SDK. add_subdirectory(${FIREBASE_CPP_SDK_DIR} bin/ EXCLUDE_FROM_ALL) @@ -96,7 +98,6 @@ endif() set(GAME_HEADER) set(GAME_RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/Resources") -set(GAME_ClASSES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/Classes") if(APPLE OR WINDOWS) cocos_mark_multi_resources(common_res_files RES_TO "Resources" FOLDERS ${GAME_RES_FOLDER}) @@ -146,7 +147,7 @@ endif() target_link_libraries(${APP_NAME} cocos2d "${firebase_libs}" ${ADDITIONAL_LIBS}) target_include_directories(${APP_NAME} PRIVATE Classes - PRIVATE ${COCOS2DX_ROOT_PATH}/cocos/audio/include/ ) + PRIVATE ${COCOS2DX_ROOT_PATH}/cocos/audio/include/) # mark app resources setup_cocos_app_config(${APP_NAME}) From 5aa4f8629d458adc63eb6af1806356a8938c0268 Mon Sep 17 00:00:00 2001 From: Grant-Postma Date: Tue, 7 Jul 2020 11:48:11 -0400 Subject: [PATCH 8/9] deleteing util.cpp. --- demos/TicTacToe/Classes/util.cpp | 67 -------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 demos/TicTacToe/Classes/util.cpp diff --git a/demos/TicTacToe/Classes/util.cpp b/demos/TicTacToe/Classes/util.cpp deleted file mode 100644 index 32838260..00000000 --- a/demos/TicTacToe/Classes/util.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2020 Google Inc. All rights reserved. -// -// 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. - -#include "util.h" - -#include - -// Logs the message passed in to the console. -void LogMessage(const char* format, ...) { - va_list list; - va_start(list, format); - vprintf(format, list); - va_end(list); - printf("\n"); - fflush(stdout); -} - -// Based on operating system, waits for the specified amount of miliseconds. -void ProcessEvents(int msec) { -#ifdef _WIN32 - Sleep(msec); -#else - usleep(msec * 1000); -#endif // _WIN32 -} - -// Wait for a Future to be completed. If the Future returns an error, it will -// be logged. -void WaitForCompletion(const firebase::FutureBase& future, const char* name) { - while (future.status() == firebase::kFutureStatusPending) { - ProcessEvents(100); - } - if (future.status() != firebase::kFutureStatusComplete) { - LogMessage("ERROR: %s returned an invalid result.", name); - } else if (future.error() != 0) { - LogMessage("ERROR: %s returned error %d: %s", name, future.error(), - future.error_message()); - } -} - -// Generates a random uid of a specified length. -std::string GenerateUid(std::size_t length) { - const std::string kCharacters = "0123456789abcdefghjkmnpqrstuvwxyz"; - - std::random_device random_device; - std::mt19937 generator(random_device()); - std::uniform_int_distribution<> distribution(0, kCharacters.size() - 1); - - std::string generate_uid; - - for (std::size_t i = 0; i < length; ++i) { - generate_uid += kCharacters[distribution(generator)]; - } - - return generate_uid; -} From ccc7283aa4a31f8687721cfbce17a8d107f8e80a Mon Sep 17 00:00:00 2001 From: Grant-Postma Date: Tue, 7 Jul 2020 12:21:55 -0400 Subject: [PATCH 9/9] Removing old include header. --- demos/TicTacToe/Classes/tic_tac_toe_layer.h | 1 - 1 file changed, 1 deletion(-) diff --git a/demos/TicTacToe/Classes/tic_tac_toe_layer.h b/demos/TicTacToe/Classes/tic_tac_toe_layer.h index 9f3992d5..deb4624f 100644 --- a/demos/TicTacToe/Classes/tic_tac_toe_layer.h +++ b/demos/TicTacToe/Classes/tic_tac_toe_layer.h @@ -27,7 +27,6 @@ #include #include -#include "TicTacToeScene.h" #include "cocos2d.h" #include "tic_tac_toe_scene.h" #include "util.h"