-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Functions Quickstart Kotlin #640
Conversation
@rosariopfernandes regarding the build failure here : You might want to add the constraint-layout dependency explicitly to your module's I bumped into the same issue with the auth quickstart. |
Thank you very much @the-dagger I'll give this a try! |
Here's what I did for the ConstraintLayout fix: I made the |
@the-dagger 's solution doesn't seem to have fixed it. I'll try @samtstern 's solution now. |
There we go. Build fixed. Thanks for the tips guys |
*/ | ||
class MainActivity : AppCompatActivity(), View.OnClickListener { | ||
|
||
// [START define_functions_instance] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samtstern I've noticed those are the java snippets present on the documentation. Shouldn't we move them to the snippets repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rosariopfernandes good question! For now we are going to leave them where they are. But we have stopped writing new snippets in the quickstart repo.
I am making sure that as I merge these PRs I update the doc references to point to the new paths (the auth
PR moved like 50+ snippets)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
99% good just some style nits!
createNotificationChannel() | ||
|
||
// Check if message contains a data payload. | ||
if (remoteMessage!!.data.isNotEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead of !!
just do this above:
if (remoteMessage == null) {
return;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this was my mistake. I had annotated the remoteMessage
argument as nullable. I think there's no reason for that, I'll remove the notation.
showSnackbar("Error signing in.") | ||
|
||
val response = IdpResponse.fromResultIntent(data) | ||
Log.w(TAG, "signIn", response!!.error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
response?.error
maybe?
// Register the channel with the system; you can't change the importance | ||
// or other notification behaviors after this | ||
val notificationManager = getSystemService(NotificationManager::class.java) | ||
notificationManager!!.createNotificationChannel(channel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?.
// [START function_add_numbers] | ||
private fun addNumbers(a: Int, b: Int): Task<Int> { | ||
// Create the arguments to the callable function, which are two integers | ||
val data = HashMap<String, Any>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe use the hashMapOf
syntax:
hashMapOf(
"John" to "Doe",
"Jane" to "Smith"
)
// [START function_add_message] | ||
private fun addMessage(text: String): Task<String> { | ||
// Create the arguments to the callable function. | ||
val data = HashMap<String, Any>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same nit here about the map
Will merge after build |
Fixes #631