app / sg.edu.ntu.scse.cz2006.gymbuddies / LoginChooserActivity

LoginChooserActivity

class LoginChooserActivity : AppCompatActivity

This is the main launcher activity that shows up to handle the login page of the application There are some flags in this activity

On top of that we have a listener mAuthStateListener that handles the state changes during authentication For sg.edu.ntu.scse.cz2006.gymbuddies in Gym Buddies!

Author
Kenneth Soh

Since
2019-09-03

Constructors

<init>

This is the main launcher activity that shows up to handle the login page of the application There are some flags in this activity

LoginChooserActivity()

Properties

checkingFurther

Boolean Flag that is toggled when we are currently handling further authentication checks

var checkingFurther: Boolean

mAuthStateListener

AuthStateListener Auuthentication State Change Listener for Firebase Authentication

val mAuthStateListener: AuthStateListener

signInFlow

Boolean Flag that is toggled when we are running the FirebaseUI Sign In Flow

var signInFlow: Boolean

Functions

autoLogin

Handling auto logging in of previously logged in user if any

fun autoLogin(fbUser: FirebaseUser?): Unit

furtherChecks

Any further checks with the authentication provider This is mainly used to handle further authentication check for email login such as handling if you completed email authentication

fun furtherChecks(provider: String, userObj: FirebaseUser?): Unit

login

Login method that invokes FirebaseUI's Login Flow

fun login(): Unit

logout

Logs a user out. If you wish for no Toast messages to appear, set silent to true

fun logout(silent: Boolean = false): Unit

onActivityResult

This handles the result of the FirebaseUI Login flow

fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Unit

onCreate

Function that is called when an activity is created

fun onCreate(savedInstanceState: Bundle?): Unit

Companion Object Properties

RC_SIGN_IN

Intent to request to enter Sign In Flow for Firebase UI

const val RC_SIGN_IN: Int