Class GoogleSignInRepository
- java.lang.Object
-
- edu.cnm.deepdive.interviewprep.service.GoogleSignInRepository
-
public class GoogleSignInRepository extends Object
Uses Google Sign In services to validate and authenticate a User and creates a Bearer token that can be used to validate and authenticate a user to the application.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.reactivex.Single<GoogleSignInAccount>
completeSignIn(androidx.activity.result.ActivityResult result)
Signs a user into the application using a User Google account from Google Sign In services.static GoogleSignInRepository
getInstance()
Loads a GoogleSignInRepository into memory.io.reactivex.Single<GoogleSignInAccount>
refresh()
Refreshes the validation and authentication of the account.io.reactivex.Single<String>
refreshBearerToken()
Refreshes the Bearer Token for this application.static void
setContext(Application context)
Sets the Application context to the local context variable.io.reactivex.Completable
signOut()
Signs the User out of their Google account.void
startSignIn(androidx.activity.result.ActivityResultLauncher<Intent> launcher)
Begins the application sign in process.
-
-
-
Method Detail
-
setContext
public static void setContext(Application context)
Sets the Application context to the local context variable.- Parameters:
context
- an Application context.
-
getInstance
public static GoogleSignInRepository getInstance()
Loads a GoogleSignInRepository into memory.- Returns:
- an Instance of the GoogleSignInRepository.
-
refresh
public io.reactivex.Single<GoogleSignInAccount> refresh()
Refreshes the validation and authentication of the account. It performs this refresh in the background.- Returns:
- a reactivex
Single
of typeGoogleSignInAccount
.
-
refreshBearerToken
public io.reactivex.Single<String> refreshBearerToken()
Refreshes the Bearer Token for this application.- Returns:
- a reactivex
Single
of typeString
.
-
startSignIn
public void startSignIn(androidx.activity.result.ActivityResultLauncher<Intent> launcher)
Begins the application sign in process.- Parameters:
launcher
- anActivityResultLauncher
object of typeIntent
.
-
completeSignIn
public io.reactivex.Single<GoogleSignInAccount> completeSignIn(androidx.activity.result.ActivityResult result)
Signs a user into the application using a User Google account from Google Sign In services.- Parameters:
result
- the result of the SignIn process- Returns:
- a reactivex
Single
of typeGoogleSignInAccount
-
signOut
public io.reactivex.Completable signOut()
Signs the User out of their Google account.- Returns:
- a reactivex
Completable
.
-
-