You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.
In the following video, the feature that redirects the user to an explorer without first checking if the user has a connection fails, so the user gets the default chrome connectivity error view. The correct way to deal with this anti pattern could be to notify the user that he doesn't have a connection and try again when it is back.
This is found in the next path: mobile>java>com.google.samples.apps.iosched>ui>codelabs>CodelabsFragments
We propose the following changes. First, check if there is connectivity. If it is true, it calls the URL. Otherwise, return a message informing the user about the issue.
override fun startCodelab(codelab: Codelab) {
val connectionManager: ConnectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val activeNetwork: NetworkInfo? = connectionManager.activeNetworkInfo
val isConnected: Boolean = activeNetwork?.isConnectedOrConnecting == true
if (isConnected) {
if (codelab.hasUrl()) {
openWebsiteUri(
requireContext(),
addCodelabsAnalyticsQueryParams(codelab.codelabUrl)
)
analyticsHelper.logUiEvent(
"Start codelab "${codelab.title}"",
AnalyticsActions.CLICK
)
}
}
else{
val builder = AlertDialog.Builder(this)
builder.setTitle("Error")
builder.setMessage("There is no network connection. Please check and try again")
builder.setPositiveButton("Accept",null)
val dialog: AlertDialog = builder.create()
dialog.show()
}
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In the following video, the feature that redirects the user to an explorer without first checking if the user has a connection fails, so the user gets the default chrome connectivity error view. The correct way to deal with this anti pattern could be to notify the user that he doesn't have a connection and try again when it is back.
Video of the Anti pattern: https://drive.google.com/file/d/1OfRvDKO8-EyGn39aJtpfk6YfVdCwcVGy/view?usp=sharing
This is found in the next path: mobile>java>com.google.samples.apps.iosched>ui>codelabs>CodelabsFragments
We propose the following changes. First, check if there is connectivity. If it is true, it calls the URL. Otherwise, return a message informing the user about the issue.
The text was updated successfully, but these errors were encountered: