This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This UiState model addresses the problems associated with treating Loading as its own state. | |
Loading in general is not an exclusive state. | |
You may be showing data, and fetching (Success + Loading). | |
You might show an error, and try to fetch the data again (Error + Loading) | |
The only time Loading is kind of its own thing is when the screen is first opened, and nothing is displayed yet. | |
So that case, InitialBlankLoading should be a separate state. | |
Here's what a flow in this would look like, fetching a list of messages: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExperimentalCoroutinesApi | |
private fun setupFacebookContinueButton() { | |
binding?.buttonContinueFacebook?.setOnClickListener { | |
beginLoginToFacebook() | |
finishFacebookLogin { loginResult -> | |
loginViewModel.loginFacebook(loginResult.accessToken.token) | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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() |