@@ -105,10 +105,9 @@ void Engine::InitGooglePlayGameServices() {
105105 *
106106 */
107107void Engine::OnAuthActionStarted (gpg::AuthOperation op) {
108- if (!initialized_resources_) return ;
108+ startup_mutex_. lock () ;
109109 ndk_helper::JNIHelper::GetInstance ()->RunOnUiThread ([this , op]() {
110110 EnableUI (false );
111- authorizing_ = true ;
112111 if (op == gpg::AuthOperation::SIGN_IN ) {
113112 LOGI (" Signing in to GPG" );
114113 status_text_->SetAttribute (" Text" , " Signing In..." );
@@ -136,16 +135,14 @@ void Engine::OnAuthActionFinished(gpg::AuthOperation op,
136135 });
137136 }
138137
139- if (!initialized_resources_) return ;
140-
141138 ndk_helper::JNIHelper::GetInstance ()->RunOnUiThread ([this , status]() {
142139 EnableUI (true );
143- authorizing_ = false ;
144140 button_sign_in_->SetAttribute (
145141 " Text" , gpg::IsSuccess (status) ? " Sign Out" : " Sign In" );
146142
147143 status_text_->SetAttribute (
148144 " Text" , gpg::IsSuccess (status) ? " Signed In" : " Signed Out" );
145+ startup_mutex_.unlock ();
149146 });
150147}
151148
@@ -560,14 +557,12 @@ void Engine::LeaveGame() {
560557 * invoking jui_helper functions to create java UIs
561558 */
562559void Engine::InitUI () {
563- // Show toast with app label
564-
565560 // The window initialization
566561 jui_helper::JUIWindow::Init (app_->activity , JUIHELPER_CLASS_NAME );
567562
563+ // Show toast with app label
568564 ndk_helper::JNIHelper::GetInstance ()->RunOnUiThread ([]() {
569565 if (NULL == jui_helper::JUIWindow::GetInstance ()->GetContext ()) {
570- LOGE (" ====JUIWindow::Context is NULL, not showing Toast" );
571566 return ;
572567 }
573568 jui_helper::JUIToast toast (
@@ -580,9 +575,6 @@ void Engine::InitUI() {
580575 // UIs.
581576 //
582577
583- // The window initialization
584- // jui_helper::JUIWindow::Init(app_->activity, JUIHELPER_CLASS_NAME);
585-
586578 //
587579 // Buttons
588580 //
@@ -655,7 +647,6 @@ void Engine::InitUI() {
655647 // Init play game services
656648 InitGooglePlayGameServices ();
657649
658- if (authorizing_) EnableUI (false );
659650 return ;
660651}
661652
0 commit comments