Skip to content

Instantly share code, notes, and snippets.

View karloti's full-sized avatar

Kaloyan Karaivanov karloti

View GitHub Profile
@karloti
karloti / GoogleOneTapAuth.kt
Created August 22, 2021 16:59 — forked from brady-aiello/GoogleOneTapAuth.kt
Setup Google One Tap with Coroutines and Activity Result Contract API
// InvalidFragmentVersionForActivityResult: https://issuetracker.google.com/issues/182388985
@SuppressLint("InvalidFragmentVersionForActivityResult")
@ExperimentalCoroutinesApi
private fun setupGoogleContinueButton() {
activity?.let { fragmentActivity ->
oneTapClient = Identity.getSignInClient(fragmentActivity)
signInRequest = createBeginSignInRequest(fragmentActivity)
val intentSender: ActivityResultLauncher<IntentSenderRequest> =
getGoogleActivityResultLauncher()
@karloti
karloti / GoogleAuth.kt
Created August 22, 2021 16:58 — forked from brady-aiello/GoogleAuth.kt
Google Auth: One Tap with Legacy Auth backup using Coroutines
package com.nbcuni.idm.sdk.debug.ui
import android.annotation.SuppressLint
import android.app.PendingIntent
import android.text.method.LinkMovementMethod
import android.util.Log
import android.view.View
import android.widget.TextView
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.IntentSenderRequest
@karloti
karloti / FacebookAuth.kt
Created August 22, 2021 16:58 — forked from brady-aiello/FacebookAuth.kt
Facebook Login with Coroutines
@ExperimentalCoroutinesApi
private fun setupFacebookContinueButton() {
binding?.buttonContinueFacebook?.setOnClickListener {
beginLoginToFacebook()
finishFacebookLogin { loginResult ->
loginViewModel.loginFacebook(loginResult.accessToken.token)
}
}
}