From 495105e7dcd4e891720779fc49c31f0066ddb86f Mon Sep 17 00:00:00 2001 From: Juma Allan Date: Tue, 16 May 2023 14:23:42 +0300 Subject: [PATCH] fixed a few things --- app/src/main/java/com/hover/stax/home/MainActivity.kt | 5 ++--- .../java/com/hover/stax/login/AbstractGoogleAuthActivity.kt | 3 +++ .../stax/presentation/bounties/BountyApplicationFragment.kt | 2 +- .../main/java/com/hover/stax/settings/SettingsFragment.kt | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/hover/stax/home/MainActivity.kt b/app/src/main/java/com/hover/stax/home/MainActivity.kt index 57dbe6dcb..f50c3a554 100644 --- a/app/src/main/java/com/hover/stax/home/MainActivity.kt +++ b/app/src/main/java/com/hover/stax/home/MainActivity.kt @@ -61,9 +61,8 @@ class MainActivity : AbstractGoogleAuthActivity(), BiometricChecker.AuthListener val loginViewModel: LoginViewModel by viewModels() return loginViewModel } - lateinit var navHelper: NavHelper - private val loginViewModel : LoginViewModel by viewModels() + lateinit var navHelper: NavHelper private val transferViewModel: TransferViewModel by viewModels() private val requestViewModel: NewRequestViewModel by viewModels() @@ -143,7 +142,7 @@ class MainActivity : AbstractGoogleAuthActivity(), BiometricChecker.AuthListener } } - fun signIn() = loginForResult.launch(loginViewModel.signInClient.signInIntent) + fun signInUser() = loginForResult.launch(loginViewModel.signInClient.signInIntent) private val loginForResult = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> diff --git a/app/src/main/java/com/hover/stax/login/AbstractGoogleAuthActivity.kt b/app/src/main/java/com/hover/stax/login/AbstractGoogleAuthActivity.kt index 56728834d..5bdcd370c 100644 --- a/app/src/main/java/com/hover/stax/login/AbstractGoogleAuthActivity.kt +++ b/app/src/main/java/com/hover/stax/login/AbstractGoogleAuthActivity.kt @@ -17,8 +17,11 @@ package com.hover.stax.login import android.content.Intent import android.os.Bundle +import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat +import com.google.android.gms.auth.api.signin.GoogleSignIn +import com.google.android.gms.auth.api.signin.GoogleSignInOptions import com.google.android.material.snackbar.Snackbar import com.google.android.play.core.appupdate.AppUpdateInfo import com.google.android.play.core.appupdate.AppUpdateManager diff --git a/app/src/main/java/com/hover/stax/presentation/bounties/BountyApplicationFragment.kt b/app/src/main/java/com/hover/stax/presentation/bounties/BountyApplicationFragment.kt index 09cb33c6a..863d91794 100644 --- a/app/src/main/java/com/hover/stax/presentation/bounties/BountyApplicationFragment.kt +++ b/app/src/main/java/com/hover/stax/presentation/bounties/BountyApplicationFragment.kt @@ -122,7 +122,7 @@ class BountyApplicationFragment : Fragment(), View.OnClickListener { private fun startGoogleSignIn() { logAnalyticsEvent(getString(R.string.clicked_bounty_email_continue_btn), requireContext()) updateProgress(0) - (activity as MainActivity).signIn() + (activity as MainActivity).signInUser() } // TODO - delete me diff --git a/app/src/main/java/com/hover/stax/settings/SettingsFragment.kt b/app/src/main/java/com/hover/stax/settings/SettingsFragment.kt index c9c87e475..864ec954d 100644 --- a/app/src/main/java/com/hover/stax/settings/SettingsFragment.kt +++ b/app/src/main/java/com/hover/stax/settings/SettingsFragment.kt @@ -376,7 +376,7 @@ class SettingsFragment : Fragment() { private fun startGoogleLogin() { binding.staxSupport.contactCard.showProgressIndicator() optInMarketing = true - (requireActivity() as MainActivity).signIn() + (requireActivity() as MainActivity).signInUser() } private fun marketingOptIn(optedIn: Boolean) {