Skip to content

Commit

Permalink
#4 AuthResultContract 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
comye1 committed Feb 23, 2022
1 parent 536fbbb commit e44e246
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import com.google.android.gms.auth.api.signin.GoogleSignInAccount
import com.google.android.gms.tasks.Task

class AuthResultContract: ActivityResultContract<Int, Task<GoogleSignInAccount>?>() {
override fun createIntent(context: Context, input: Int?): Intent =
getGoogleSignInClient(context).signInIntent.putExtra("input", input)

override fun parseResult(resultCode: Int, intent: Intent?): Task<GoogleSignInAccount>? {
return when(resultCode) {
Activity.RESULT_OK -> GoogleSignIn.getSignedInAccountFromIntent(intent)
else -> null
}
}

override fun createIntent(context: Context, input: Int): Intent {
return getGoogleSignInClient(context).signInIntent.putExtra("input", input)
}
}

0 comments on commit e44e246

Please sign in to comment.