From ab3b1652d3632bc4f12fd1ac66e1d3c1c63cec8b Mon Sep 17 00:00:00 2001 From: dkhawk Date: Thu, 9 May 2024 15:15:51 -0600 Subject: [PATCH 1/6] chore: update gradle to 8.4, kotlin to 1.9.22, places SDK to 3.4.0 --- build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- places-ktx/build.gradle | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 7a5b49e..3e66991 100644 --- a/build.gradle +++ b/build.gradle @@ -21,9 +21,9 @@ buildscript { maven { url "https://plugins.gradle.org/m2/" } } dependencies { - classpath 'com.android.tools.build:gradle:8.3.1' + classpath 'com.android.tools.build:gradle:8.4.0' classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.9.10' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24" classpath "com.google.dagger:hilt-android-gradle-plugin:2.51" classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1" classpath 'com.mxalbert.gradle:jacoco-android:0.2.1' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e411586..17655d0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/places-ktx/build.gradle b/places-ktx/build.gradle index ff434ea..59f1000 100644 --- a/places-ktx/build.gradle +++ b/places-ktx/build.gradle @@ -46,13 +46,13 @@ android { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.22" - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") + implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.24' + implementation('org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0') implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0" implementation "com.android.volley:volley:1.2.1" implementation 'androidx.multidex:multidex:2.0.1' api "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.8.0" - api "com.google.android.libraries.places:places:3.3.0" + api 'com.google.android.libraries.places:places:3.4.0' // Tests testImplementation "androidx.test.ext:junit:1.1.5" From bcddcc3ff5d6add2c5c39eb53b3dbb0ada62c303 Mon Sep 17 00:00:00 2001 From: dkhawk Date: Thu, 9 May 2024 15:27:07 -0600 Subject: [PATCH 2/6] Adds awaitSearchByText extension function --- .../places/ktx/api/net/PlacesClient.kt | 26 +++++++++++++- .../places/ktx/api/net/SearchByTextRequest.kt | 36 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt diff --git a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt index d4772b4..ddd190e 100644 --- a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt +++ b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt @@ -30,6 +30,8 @@ import com.google.android.libraries.places.api.net.FindCurrentPlaceRequest import com.google.android.libraries.places.api.net.FindCurrentPlaceResponse import com.google.android.libraries.places.api.net.IsOpenResponse import com.google.android.libraries.places.api.net.PlacesClient +import com.google.android.libraries.places.api.net.SearchByTextRequest +import com.google.android.libraries.places.api.net.SearchByTextResponse import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.tasks.await @@ -135,4 +137,26 @@ public suspend fun PlacesClient.awaitIsOpen( val request = isOpenRequest(placeId, utcTimeMillis) { cancellationToken = cancellationTokenSource.token } return this.isOpen(request).await(cancellationTokenSource) -} \ No newline at end of file +} + +@ExperimentalCoroutinesApi +/** + * Wraps [PlacesClient.searchByText] in a suspending function. + * + * Fetches the place(s) of interest using a text query. If an error occurred, an [ApiException] will + * be thrown. + * + * Only available with Places SDK for Android (New). + */ +public suspend fun PlacesClient.awaitSearchByText( + textQuery: String, + placeFields: List, + actions: SearchByTextRequest.Builder.() -> Unit = {}, +): SearchByTextResponse { + val cancellationTokenSource = CancellationTokenSource() + val request = searchByTextRequest(textQuery, placeFields) { + actions() + cancellationToken = cancellationTokenSource.token + } + return this.searchByText(request).await(cancellationTokenSource) +} diff --git a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt new file mode 100644 index 0000000..48b45bf --- /dev/null +++ b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt @@ -0,0 +1,36 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.android.libraries.places.ktx.api.net + +import com.google.android.libraries.places.api.model.Place +import com.google.android.libraries.places.api.net.SearchByTextRequest + +/** + * Builds a new [SearchByTextRequest]. + * + * @param textQuery the query string to search + * @param placeFields the fields of the place to be requested + * @param actions the actions to apply to the [SearchByTextRequest.Builder] + * @return the constructed [SearchByTextRequest] + */ +public fun searchByTextRequest( + textQuery: String, + placeFields: List, + actions: SearchByTextRequest.Builder.() -> Unit = {}, +): SearchByTextRequest { + return SearchByTextRequest.builder(textQuery, placeFields) + .apply(actions) + .build() +} From 02fdc4b057ff4924bdd817c4ff5ac49132b1eb03 Mon Sep 17 00:00:00 2001 From: dkhawk Date: Tue, 14 May 2024 17:14:37 -0600 Subject: [PATCH 3/6] Adds testing for searchByTextRequest --- places-ktx/build.gradle | 10 +++- .../places/ktx/api/net/PlacesClient.kt | 2 - .../places/ktx/api/net/SearchByTextRequest.kt | 20 +++++++ .../ktx/api/net/SearchByTextRequestTest.kt | 55 +++++++++++++++++++ 4 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 places-ktx/src/test/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequestTest.kt diff --git a/places-ktx/build.gradle b/places-ktx/build.gradle index 59f1000..26be68f 100644 --- a/places-ktx/build.gradle +++ b/places-ktx/build.gradle @@ -42,13 +42,20 @@ android { testOptions { unitTests.returnDefaultValues = true } + + buildTypes { + debug { + testCoverageEnabled = true + } + } + namespace "com.google.android.libraries.places.ktx" } dependencies { implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.24' implementation('org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0') - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0" + implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.0" implementation "com.android.volley:volley:1.2.1" implementation 'androidx.multidex:multidex:2.0.1' api "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.8.0" @@ -60,4 +67,5 @@ dependencies { testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0" testImplementation "junit:junit:4.13.2" testImplementation "org.mockito:mockito-core:5.11.0" + testImplementation "com.google.truth:truth:1.4.2" } \ No newline at end of file diff --git a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt index ddd190e..f24fdc2 100644 --- a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt +++ b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt @@ -145,8 +145,6 @@ public suspend fun PlacesClient.awaitIsOpen( * * Fetches the place(s) of interest using a text query. If an error occurred, an [ApiException] will * be thrown. - * - * Only available with Places SDK for Android (New). */ public suspend fun PlacesClient.awaitSearchByText( textQuery: String, diff --git a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt index 48b45bf..25c2e26 100644 --- a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt +++ b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt @@ -17,6 +17,14 @@ package com.google.android.libraries.places.ktx.api.net import com.google.android.libraries.places.api.model.Place import com.google.android.libraries.places.api.net.SearchByTextRequest +public enum class PriceLevel(public val value: Int) { + FREE(0), // Note: not for use in the API call. + INEXPENSIVE(1), + MODERATE(2), + EXPENSIVE(3), + VERY_EXPENSIVE(4) +} + /** * Builds a new [SearchByTextRequest]. * @@ -34,3 +42,15 @@ public fun searchByTextRequest( .apply(actions) .build() } + +public fun SearchByTextRequest.Builder.setPriceLevels( + priceLevels: Collection +): SearchByTextRequest.Builder { + return this.setPriceLevels(priceLevels.map { it.value }) +} + +public fun SearchByTextRequest.Builder.setPriceLevels( + vararg priceLevels: PriceLevel +): SearchByTextRequest.Builder { + return this.setPriceLevels(priceLevels.map { it.value }) +} diff --git a/places-ktx/src/test/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequestTest.kt b/places-ktx/src/test/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequestTest.kt new file mode 100644 index 0000000..09ae49f --- /dev/null +++ b/places-ktx/src/test/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequestTest.kt @@ -0,0 +1,55 @@ +package com.google.android.libraries.places.ktx.api.net + +import com.google.android.gms.maps.model.LatLng +import com.google.android.gms.tasks.CancellationTokenSource +import com.google.android.libraries.places.api.model.CircularBounds +import com.google.android.libraries.places.api.model.Place +import com.google.android.libraries.places.api.net.SearchByTextRequest +import com.google.common.truth.Truth.assertThat +import org.junit.Test + +internal class SearchByTextRequestTest { + @Test + fun testBuilderNoActions() { + val request = searchByTextRequest( + textQuery = "test query", + placeFields = listOf(Place.Field.NAME) + ) + + assertThat(request.textQuery).isEqualTo("test query") + assertThat(request.placeFields).containsExactly(Place.Field.NAME) + } + + @Test + fun testBuilderWithActions() { + val cancellationToken = CancellationTokenSource().token + val ashland = LatLng(42.193893370553916, -122.7088890892941) + val radiusInMeters = 1500.0 + + val request = searchByTextRequest( + textQuery = "test query", + placeFields = listOf(Place.Field.NAME, Place.Field.ADDRESS), + ) { + setCancellationToken(cancellationToken) + includedType = "national_park" + isOpenNow = true + minRating = 4.0 + setPriceLevels(PriceLevel.MODERATE, PriceLevel.EXPENSIVE) + rankPreference = SearchByTextRequest.RankPreference.RELEVANCE + regionCode = "US" + + locationBias = CircularBounds.newInstance(ashland, radiusInMeters) + } + + assertThat(request.locationBias) + .isEqualTo(CircularBounds.newInstance(ashland, radiusInMeters)) + assertThat(request.isOpenNow).isTrue() + assertThat(request.minRating).isEqualTo(4.0) + assertThat(request.priceLevels) + .containsExactly(PriceLevel.MODERATE.value, PriceLevel.EXPENSIVE.value) + assertThat(request.rankPreference).isEqualTo(SearchByTextRequest.RankPreference.RELEVANCE) + assertThat(request.regionCode).isEqualTo("US") + assertThat(request.includedType).isEqualTo("national_park") + assertThat(request.textQuery).isEqualTo("test query") + } +} \ No newline at end of file From 5fc27ccb05c865851512707c64442176e2284b22 Mon Sep 17 00:00:00 2001 From: dkhawk Date: Thu, 9 May 2024 15:27:07 -0600 Subject: [PATCH 4/6] Adds awaitSearchByText extension function --- .../places/ktx/api/net/PlacesClient.kt | 26 +++++++++++++- .../places/ktx/api/net/SearchByTextRequest.kt | 36 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt diff --git a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt index d4772b4..ddd190e 100644 --- a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt +++ b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt @@ -30,6 +30,8 @@ import com.google.android.libraries.places.api.net.FindCurrentPlaceRequest import com.google.android.libraries.places.api.net.FindCurrentPlaceResponse import com.google.android.libraries.places.api.net.IsOpenResponse import com.google.android.libraries.places.api.net.PlacesClient +import com.google.android.libraries.places.api.net.SearchByTextRequest +import com.google.android.libraries.places.api.net.SearchByTextResponse import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.tasks.await @@ -135,4 +137,26 @@ public suspend fun PlacesClient.awaitIsOpen( val request = isOpenRequest(placeId, utcTimeMillis) { cancellationToken = cancellationTokenSource.token } return this.isOpen(request).await(cancellationTokenSource) -} \ No newline at end of file +} + +@ExperimentalCoroutinesApi +/** + * Wraps [PlacesClient.searchByText] in a suspending function. + * + * Fetches the place(s) of interest using a text query. If an error occurred, an [ApiException] will + * be thrown. + * + * Only available with Places SDK for Android (New). + */ +public suspend fun PlacesClient.awaitSearchByText( + textQuery: String, + placeFields: List, + actions: SearchByTextRequest.Builder.() -> Unit = {}, +): SearchByTextResponse { + val cancellationTokenSource = CancellationTokenSource() + val request = searchByTextRequest(textQuery, placeFields) { + actions() + cancellationToken = cancellationTokenSource.token + } + return this.searchByText(request).await(cancellationTokenSource) +} diff --git a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt new file mode 100644 index 0000000..48b45bf --- /dev/null +++ b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt @@ -0,0 +1,36 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.android.libraries.places.ktx.api.net + +import com.google.android.libraries.places.api.model.Place +import com.google.android.libraries.places.api.net.SearchByTextRequest + +/** + * Builds a new [SearchByTextRequest]. + * + * @param textQuery the query string to search + * @param placeFields the fields of the place to be requested + * @param actions the actions to apply to the [SearchByTextRequest.Builder] + * @return the constructed [SearchByTextRequest] + */ +public fun searchByTextRequest( + textQuery: String, + placeFields: List, + actions: SearchByTextRequest.Builder.() -> Unit = {}, +): SearchByTextRequest { + return SearchByTextRequest.builder(textQuery, placeFields) + .apply(actions) + .build() +} From ae69b058a15b663c00838e222d7a497e1d3f0dc6 Mon Sep 17 00:00:00 2001 From: dkhawk Date: Tue, 14 May 2024 17:14:37 -0600 Subject: [PATCH 5/6] Adds testing for searchByTextRequest --- places-ktx/build.gradle | 12 +++- .../places/ktx/api/net/PlacesClient.kt | 2 - .../places/ktx/api/net/SearchByTextRequest.kt | 20 +++++++ .../ktx/api/net/SearchByTextRequestTest.kt | 55 +++++++++++++++++++ 4 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 places-ktx/src/test/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequestTest.kt diff --git a/places-ktx/build.gradle b/places-ktx/build.gradle index c1faec8..7af1cfa 100644 --- a/places-ktx/build.gradle +++ b/places-ktx/build.gradle @@ -42,13 +42,20 @@ android { testOptions { unitTests.returnDefaultValues = true } + + buildTypes { + debug { + testCoverageEnabled = true + } + } + namespace "com.google.android.libraries.places.ktx" } dependencies { implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.24' implementation('org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1') - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0" + implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.0" implementation "com.android.volley:volley:1.2.1" implementation 'androidx.multidex:multidex:2.0.1' api "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.8.1" @@ -60,4 +67,5 @@ dependencies { testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0" testImplementation "junit:junit:4.13.2" testImplementation "org.mockito:mockito-core:5.11.0" -} \ No newline at end of file + testImplementation "com.google.truth:truth:1.4.2" +} diff --git a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt index ddd190e..f24fdc2 100644 --- a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt +++ b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/PlacesClient.kt @@ -145,8 +145,6 @@ public suspend fun PlacesClient.awaitIsOpen( * * Fetches the place(s) of interest using a text query. If an error occurred, an [ApiException] will * be thrown. - * - * Only available with Places SDK for Android (New). */ public suspend fun PlacesClient.awaitSearchByText( textQuery: String, diff --git a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt index 48b45bf..25c2e26 100644 --- a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt +++ b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequest.kt @@ -17,6 +17,14 @@ package com.google.android.libraries.places.ktx.api.net import com.google.android.libraries.places.api.model.Place import com.google.android.libraries.places.api.net.SearchByTextRequest +public enum class PriceLevel(public val value: Int) { + FREE(0), // Note: not for use in the API call. + INEXPENSIVE(1), + MODERATE(2), + EXPENSIVE(3), + VERY_EXPENSIVE(4) +} + /** * Builds a new [SearchByTextRequest]. * @@ -34,3 +42,15 @@ public fun searchByTextRequest( .apply(actions) .build() } + +public fun SearchByTextRequest.Builder.setPriceLevels( + priceLevels: Collection +): SearchByTextRequest.Builder { + return this.setPriceLevels(priceLevels.map { it.value }) +} + +public fun SearchByTextRequest.Builder.setPriceLevels( + vararg priceLevels: PriceLevel +): SearchByTextRequest.Builder { + return this.setPriceLevels(priceLevels.map { it.value }) +} diff --git a/places-ktx/src/test/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequestTest.kt b/places-ktx/src/test/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequestTest.kt new file mode 100644 index 0000000..09ae49f --- /dev/null +++ b/places-ktx/src/test/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequestTest.kt @@ -0,0 +1,55 @@ +package com.google.android.libraries.places.ktx.api.net + +import com.google.android.gms.maps.model.LatLng +import com.google.android.gms.tasks.CancellationTokenSource +import com.google.android.libraries.places.api.model.CircularBounds +import com.google.android.libraries.places.api.model.Place +import com.google.android.libraries.places.api.net.SearchByTextRequest +import com.google.common.truth.Truth.assertThat +import org.junit.Test + +internal class SearchByTextRequestTest { + @Test + fun testBuilderNoActions() { + val request = searchByTextRequest( + textQuery = "test query", + placeFields = listOf(Place.Field.NAME) + ) + + assertThat(request.textQuery).isEqualTo("test query") + assertThat(request.placeFields).containsExactly(Place.Field.NAME) + } + + @Test + fun testBuilderWithActions() { + val cancellationToken = CancellationTokenSource().token + val ashland = LatLng(42.193893370553916, -122.7088890892941) + val radiusInMeters = 1500.0 + + val request = searchByTextRequest( + textQuery = "test query", + placeFields = listOf(Place.Field.NAME, Place.Field.ADDRESS), + ) { + setCancellationToken(cancellationToken) + includedType = "national_park" + isOpenNow = true + minRating = 4.0 + setPriceLevels(PriceLevel.MODERATE, PriceLevel.EXPENSIVE) + rankPreference = SearchByTextRequest.RankPreference.RELEVANCE + regionCode = "US" + + locationBias = CircularBounds.newInstance(ashland, radiusInMeters) + } + + assertThat(request.locationBias) + .isEqualTo(CircularBounds.newInstance(ashland, radiusInMeters)) + assertThat(request.isOpenNow).isTrue() + assertThat(request.minRating).isEqualTo(4.0) + assertThat(request.priceLevels) + .containsExactly(PriceLevel.MODERATE.value, PriceLevel.EXPENSIVE.value) + assertThat(request.rankPreference).isEqualTo(SearchByTextRequest.RankPreference.RELEVANCE) + assertThat(request.regionCode).isEqualTo("US") + assertThat(request.includedType).isEqualTo("national_park") + assertThat(request.textQuery).isEqualTo("test query") + } +} \ No newline at end of file From 461067a6f41b9b4d12c5fdc2fa9a238f7620a6ea Mon Sep 17 00:00:00 2001 From: dkhawk Date: Wed, 15 May 2024 09:38:24 -0600 Subject: [PATCH 6/6] Adds copyright notices --- .github/dependabot.yml | 14 ++++++++++++++ .github/sync-repo-settings.yaml | 14 ++++++++++++++ .../ktx/api/model/AutocompletePrediction.kt | 16 ++++++++++++++++ .../ktx/api/net/SearchByTextRequestTest.kt | 16 ++++++++++++++++ .../ktx/model/AutocompletePredictionTest.kt | 16 ++++++++++++++++ 5 files changed, 76 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d0af9d0..86fca08 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + version: 2 updates: - package-ecosystem: gradle diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index a1b107f..57a697a 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + rebaseMergeAllowed: true squashMergeAllowed: true mergeCommitAllowed: false diff --git a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/model/AutocompletePrediction.kt b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/model/AutocompletePrediction.kt index cae9245..ec2098b 100644 --- a/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/model/AutocompletePrediction.kt +++ b/places-ktx/src/main/java/com/google/android/libraries/places/ktx/api/model/AutocompletePrediction.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.google.android.libraries.places.ktx.api.model import com.google.android.libraries.places.api.model.AutocompletePrediction diff --git a/places-ktx/src/test/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequestTest.kt b/places-ktx/src/test/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequestTest.kt index 09ae49f..21b73e6 100644 --- a/places-ktx/src/test/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequestTest.kt +++ b/places-ktx/src/test/java/com/google/android/libraries/places/ktx/api/net/SearchByTextRequestTest.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.google.android.libraries.places.ktx.api.net import com.google.android.gms.maps.model.LatLng diff --git a/places-ktx/src/test/java/com/google/android/libraries/places/ktx/model/AutocompletePredictionTest.kt b/places-ktx/src/test/java/com/google/android/libraries/places/ktx/model/AutocompletePredictionTest.kt index 12f004e..d7f7db4 100644 --- a/places-ktx/src/test/java/com/google/android/libraries/places/ktx/model/AutocompletePredictionTest.kt +++ b/places-ktx/src/test/java/com/google/android/libraries/places/ktx/model/AutocompletePredictionTest.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.google.android.libraries.places.ktx.model import com.google.android.libraries.places.api.model.Place