Skip to content
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

Replace all .toDeferred().await() with .await() in the tutorial #2800

Merged
merged 1 commit into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/tutorial/04-execute-the-query.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Open `LaunchListFragment.kt`, override `onViewCreated` and launch a new coroutin
super.onViewCreated(view, savedInstanceState)

lifecycleScope.launchWhenResumed {
val response = apolloClient.query(LaunchListQuery()).toDeferred().await()
val response = apolloClient.query(LaunchListQuery()).await()

Log.d("LaunchList", "Success ${response?.data}")
}
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial/05-connect-queries-to-your-ui.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Create a new Adapter and pass it to your RecyclerView:
```kotlin:title=app/src/main/java/com/example/rocketreserver/LaunchListFragment.kt
lifecycleScope.launchWhenResumed {
val response = try {
apolloClient.query(LaunchListQuery()).toDeferred().await()
apolloClient.query(LaunchListQuery()).await()
} catch (e: ApolloException) {
Log.d("LaunchList", "Failure", e)
null
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial/07-paginate-results.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Start a coroutine and execute the query. Replace the previous single query with
var cursor: String? = null
for (item in channel) {
val response = try {
apolloClient.query(LaunchListQuery(cursor = Input.fromNullable(cursor))).toDeferred().await()
apolloClient.query(LaunchListQuery(cursor = Input.fromNullable(cursor))).await()
} catch (e: ApolloException) {
Log.d("LaunchList", "Failure", e)
return@launchWhenResumed
Expand Down
4 changes: 2 additions & 2 deletions docs/source/tutorial/08-add-a-details-view.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ This time, display a progressBar while the query executes:
binding.progressBar.visibility = View.VISIBLE
binding.error.visibility = View.GONE

val response = apolloClient.query(LaunchDetailsQuery(id = args.launchId)).toDeferred().await()
val response = apolloClient.query(LaunchDetailsQuery(id = args.launchId)).await()
```

## Handle protocol errors
Expand All @@ -95,7 +95,7 @@ For protocol errors, Apollo Android will throw an `ApolloException`, so you'll n

```
val response = try {
apolloClient.query(LaunchDetailsQuery(id = args.launchId)).toDeferred().await()
apolloClient.query(LaunchDetailsQuery(id = args.launchId)).await()
} catch (e: ApolloException) {
binding.progressBar.visibility = View.GONE
binding.error.text = "Oh no... A protocol error happened"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial/09-write-your-first-mutation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ From the click listener, display the ProgressBar and execute the query with the
binding.submit.visibility = View.GONE
lifecycleScope.launchWhenResumed {
val response = try {
apolloClient.mutate(LoginMutation(email = Input.fromNullable(email))).toDeferred().await()
apolloClient.mutate(LoginMutation(email = Input.fromNullable(email))).await()
} catch (e: Exception) {
null
}
Expand Down
8 changes: 4 additions & 4 deletions docs/source/tutorial/10-authenticate-your-queries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ Replace all usages of `apolloClient` with `apolloClient(context)`. There is one

```kotlin
// LaunchListFragment
apolloClient(requireContext()).query(LaunchListQuery(cursor = Input.fromNullable(cursor))).toDeferred().await()
apolloClient(requireContext()).query(LaunchListQuery(cursor = Input.fromNullable(cursor))).await()

// LaunchDetailsFragment
apolloClient(requireContext()).query(LaunchDetailsQuery(id = args.launchId)).toDeferred().await()
apolloClient(requireContext()).query(LaunchDetailsQuery(id = args.launchId)).await()

// LoginFragment
apolloClient(requireContext()).mutate(LoginMutation(email = Input.fromNullable(email))).toDeferred().await()
apolloClient(requireContext()).mutate(LoginMutation(email = Input.fromNullable(email))).await()

```

Expand Down Expand Up @@ -143,7 +143,7 @@ lifecycleScope.launchWhenResumed {
}

val response = try {
apolloClient(requireContext()).mutate(mutation).toDeferred().await()
apolloClient(requireContext()).mutate(mutation).await()
} catch (e: ApolloException) {
configureButton(isBooked)
return@launchWhenResumed
Expand Down