Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed code related to google sign in. #3332

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .idea/.name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert that change, we need this file so the project name is correct

This file was deleted.

36 changes: 0 additions & 36 deletions app/src/main/java/com/ivy/wallet/RootActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class RootActivity : AppCompatActivity(), RootScreen {
@Inject
lateinit var customerJourneyLogic: CustomerJourneyCardsProvider

private lateinit var googleSignInLauncher: ActivityResultLauncher<GoogleSignInClient>
private lateinit var onGoogleSignInIdTokenResult: (idToken: String?) -> Unit

private lateinit var createFileLauncher: ActivityResultLauncher<String>
Expand Down Expand Up @@ -209,47 +208,12 @@ class RootActivity : AppCompatActivity(), RootScreen {
}

private fun setupActivityForResultLaunchers() {
googleSignInLauncher()

createFileLauncher()

openFileLauncher()
}

private fun googleSignInLauncher() {
googleSignInLauncher = activityForResultLauncher(
createIntent = { _, client ->
client.signInIntent
}
) { _, intent ->
try {
val task: Task<GoogleSignInAccount> =
GoogleSignIn.getSignedInAccountFromIntent(intent)
val account: GoogleSignInAccount = task.getResult(ApiException::class.java)
val idToken = account.idToken
Timber.d("idToken = $idToken")

onGoogleSignInIdTokenResult(idToken)
} catch (e: ApiException) {
e.sendToCrashlytics("GOOGLE_SIGN_IN - registerGoogleSignInContract(): ApiException")
e.printStackTrace()
onGoogleSignInIdTokenResult(null)
}
}

ivyContext.googleSignIn = { idTokenResult: (String?) -> Unit ->
onGoogleSignInIdTokenResult = idTokenResult

val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestProfile()
.requestIdToken("364763737033-t1d2qe7s0s8597k7anu3sb2nq79ot5tp.apps.googleusercontent.com")
.build()
val googleSignInClient = GoogleSignIn.getClient(this, gso)
googleSignInLauncher.launch(googleSignInClient)
}
}

private fun createFileLauncher() {
createFileLauncher = activityForResultLauncher(
createIntent = { _, fileName ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.ivy.wallet.domain.deprecated.logic.model.CreateCategoryData

sealed interface OnboardingEvent {

data object LoginWithGoogle : OnboardingEvent
data object LoginOfflineAccount : OnboardingEvent
data object StartImport : OnboardingEvent
data object ImportSkip : OnboardingEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,42 +292,6 @@ private fun LoginSection(
}
}

@Composable
private fun LoginWithGoogleExplanation() {
Row(
verticalAlignment = Alignment.CenterVertically
) {
Spacer(Modifier.width(24.dp))

IvyIcon(
icon = R.drawable.ic_secure,
tint = Green
)

Spacer(Modifier.width(4.dp))

Column {
Text(
text = stringResource(R.string.sync_data_ivy_cloud),
style = UI.typo.c.style(
color = Green,
fontWeight = FontWeight.ExtraBold
)
)

Spacer(Modifier.height(2.dp))

Text(
text = stringResource(R.string.data_integrity_protection_warning),
style = UI.typo.c.style(
color = UI.colors.pureInverse,
fontWeight = FontWeight.Medium
)
)
}
}
}

@Composable
private fun LocalAccountExplanation() {
Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ class OnboardingViewModel @Inject constructor(
is OnboardingEvent.ImportFinished -> importFinished(event.success)
OnboardingEvent.ImportSkip -> importSkip()
OnboardingEvent.LoginOfflineAccount -> loginOfflineAccount()
OnboardingEvent.LoginWithGoogle -> loginWithGoogle()
OnboardingEvent.OnAddAccountsDone -> onAddAccountsDone()
OnboardingEvent.OnAddAccountsSkip -> onAddAccountsSkip()
OnboardingEvent.OnAddCategoriesDone -> onAddCategoriesDone()
Expand All @@ -162,30 +161,6 @@ class OnboardingViewModel @Inject constructor(
}
}

// Step 1 ---------------------------------------------------------------------------------------
private suspend fun loginWithGoogle() {
ivyContext.googleSignIn { idToken ->
if (idToken != null) {
_opGoogleSignIn.value = OpResult.loading()
viewModelScope.launch {
try {
router.googleLoginNext()
_opGoogleSignIn.value = null // reset login with Google operation state
} catch (e: Exception) {
e.sendToCrashlytics("GOOGLE_SIGN_IN ERROR: generic exception when logging with GOOGLE")
e.printStackTrace()
Timber.e("Login with Google failed on Ivy server - ${e.message}")
_opGoogleSignIn.value = OpResult.failure(e)
}
}
} else {
sendToCrashlytics("GOOGLE_SIGN_IN ERROR: idToken is null!!")
Timber.e("Login with Google failed while getting idToken")
_opGoogleSignIn.value = OpResult.faliure("Login with Google failed, try again.")
}
}
}

private suspend fun loginOfflineAccount() {
router.offlineAccountNext()
}
Expand Down
Loading