Skip to content

Commit a5bc536

Browse files
authoredJan 27, 2025··
FENCE-2186 add country code as input param (#428)
* add country code as input param * add migration docs * add link * use link * bump version
1 parent 94eeaea commit a5bc536

File tree

6 files changed

+41
-15
lines changed

6 files changed

+41
-15
lines changed
 

‎MIGRATION.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Migration guides
22

3+
## 3.20.x to 3.21.x
4+
- The `Radar.searchPlaces(near, radius, chain, chainMetadata, groups, limit, callback)` is now `Radar.searchPlaces(near, radius, chain, chainMetadata, groups, countryCodes, limit, callback)`. See [documentation](https://radar.com/documentation/sdk/android#search).
5+
36
## 3.12.x to 3.13.x
47
- The `Radar.trackVerified()` method now returns `token: RadarVerifiedLocationToken`, which includes `user`, `events`, `token,`, `expiresAt`, `expiresIn`, and `passed`. The `Radar.trackVerifiedToken()` method has been removed, since `Radar.trackVerified()` now returns a signed JWT.
58

‎example/src/main/java/io/radar/example/MainActivity.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ import io.radar.sdk.Radar
1515
import io.radar.sdk.RadarTrackingOptions
1616
import io.radar.sdk.RadarTripOptions
1717
import io.radar.sdk.RadarVerifiedReceiver
18+
import io.radar.sdk.model.RadarAddress
19+
import io.radar.sdk.model.RadarCoordinate
1820
import io.radar.sdk.model.RadarVerifiedLocationToken
1921
import org.json.JSONObject
22+
import java.util.Date
2023
import java.util.EnumSet
21-
import androidx.core.content.edit
22-
import io.radar.sdk.model.RadarAddress
23-
import io.radar.sdk.model.RadarCoordinate
24-
import java.util.*
2524

2625
class MainActivity : AppCompatActivity() {
2726

@@ -167,6 +166,7 @@ class MainActivity : AppCompatActivity() {
167166
mapOf("orderActive" to "true"),
168167
null,
169168
null,
169+
arrayOf("US", "SG"),
170170
10
171171
) { status, location, places ->
172172
Log.v(

‎sdk/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ apply plugin: "org.jetbrains.dokka"
1010
apply plugin: 'io.radar.mvnpublish'
1111

1212
ext {
13-
radarVersion = '3.20.0'
13+
radarVersion = '3.21.0'
1414
}
1515

1616
String buildNumber = ".${System.currentTimeMillis()}"

‎sdk/src/main/java/io/radar/sdk/Radar.kt

+24-6
Original file line numberDiff line numberDiff line change
@@ -1869,6 +1869,7 @@ object Radar {
18691869
* @param[chains] An array of chain slugs to filter. See [](https://radar.com/documentation/places/chains)
18701870
* @param[categories] An array of categories to filter. See [](https://radar.com/documentation/places/categories)
18711871
* @param[groups] An array of groups to filter. See [](https://radar.com/documentation/places/groups)
1872+
* @param[countryCodes] An array of country codes to filter. See [](https://radar.com/documentation/regions/countries)
18721873
* @param[limit] The max number of places to return. A number between 1 and 100.
18731874
* @param[callback] A callback.
18741875
*/
@@ -1878,10 +1879,11 @@ object Radar {
18781879
chains: Array<String>?,
18791880
categories: Array<String>?,
18801881
groups: Array<String>?,
1882+
countryCodes: Array<String>?,
18811883
limit: Int?,
18821884
callback: RadarSearchPlacesCallback
18831885
) {
1884-
searchPlaces(radius, chains, null, categories, groups, limit, callback)
1886+
searchPlaces(radius, chains, null, categories, groups, countryCodes, limit, callback)
18851887
}
18861888

18871889
/**
@@ -1895,6 +1897,7 @@ object Radar {
18951897
* @param[chainMetadata] A map of metadata keys and values. Values can be strings, numerics, or booleans.
18961898
* @param[categories] An array of categories to filter. See [](https://radar.io/documentation/places/categories)
18971899
* @param[groups] An array of groups to filter. See [](https://radar.io/documentation/places/groups)
1900+
* @param[countryCodes] An array of country codes to filter. See [](https://radar.com/documentation/regions/countries)
18981901
* @param[limit] The max number of places to return. A number between 1 and 100.
18991902
* @param[callback] A callback.
19001903
*/
@@ -1905,6 +1908,7 @@ object Radar {
19051908
chainMetadata: Map<String, String>?,
19061909
categories: Array<String>?,
19071910
groups: Array<String>?,
1911+
countryCodes: Array<String>?,
19081912
limit: Int?,
19091913
callback: RadarSearchPlacesCallback
19101914
) {
@@ -1925,7 +1929,7 @@ object Radar {
19251929
return
19261930
}
19271931

1928-
apiClient.searchPlaces(location, radius, chains, chainMetadata, categories, groups, limit, object : RadarApiClient.RadarSearchPlacesApiCallback {
1932+
apiClient.searchPlaces(location, radius, chains, chainMetadata, categories, groups, countryCodes, limit, object : RadarApiClient.RadarSearchPlacesApiCallback {
19291933
override fun onComplete(status: RadarStatus, res: JSONObject?, places: Array<RadarPlace>?) {
19301934
handler.post {
19311935
callback.onComplete(status, location, places)
@@ -1945,6 +1949,7 @@ object Radar {
19451949
* @param[chains] An array of chain slugs to filter. See [](https://radar.com/documentation/places/chains)
19461950
* @param[categories] An array of categories to filter. See [](https://radar.com/documentation/places/categories)
19471951
* @param[groups] An array of groups to filter. See [](https://radar.com/documentation/places/groups)
1952+
* @param[countryCodes] An array of country codes to filter. See [](https://radar.com/documentation/regions/countries)
19481953
* @param[limit] The max number of places to return. A number between 1 and 100.
19491954
* @param[block] A block callback.
19501955
*/
@@ -1953,10 +1958,11 @@ object Radar {
19531958
chains: Array<String>?,
19541959
categories: Array<String>?,
19551960
groups: Array<String>?,
1961+
countryCodes: Array<String>?,
19561962
limit: Int?,
19571963
block: (status: RadarStatus, location: Location?, places: Array<RadarPlace>?) -> Unit
19581964
) {
1959-
searchPlaces(radius, chains, null, categories, groups, limit, block)
1965+
searchPlaces(radius, chains, null, categories, groups, countryCodes, limit, block)
19601966
}
19611967

19621968
/**
@@ -1970,6 +1976,7 @@ object Radar {
19701976
* @param[chainMetadata] A map of metadata keys and values. Values can be strings, numerics, or booleans.
19711977
* @param[categories] An array of categories to filter. See [](https://radar.io/documentation/places/categories)
19721978
* @param[groups] An array of groups to filter. See [](https://radar.io/documentation/places/groups)
1979+
* @param[countryCodes] An array of country codes to filter. See [](https://radar.com/documentation/regions/countries)
19731980
* @param[limit] The max number of places to return. A number between 1 and 100.
19741981
* @param[block] A block callback.
19751982
*/
@@ -1979,6 +1986,7 @@ object Radar {
19791986
chainMetadata: Map<String, String>?,
19801987
categories: Array<String>?,
19811988
groups: Array<String>?,
1989+
countryCodes: Array<String>?,
19821990
limit: Int?,
19831991
block: (status: RadarStatus, location: Location?, places: Array<RadarPlace>?) -> Unit
19841992
) {
@@ -1988,6 +1996,7 @@ object Radar {
19881996
chainMetadata,
19891997
categories,
19901998
groups,
1999+
countryCodes,
19912000
limit,
19922001
object : RadarSearchPlacesCallback {
19932002
override fun onComplete(status: RadarStatus, location: Location?, places: Array<RadarPlace>?) {
@@ -2007,6 +2016,7 @@ object Radar {
20072016
* @param[chains] An array of chain slugs to filter. See [](https://radar.com/documentation/places/chains)
20082017
* @param[categories] An array of categories to filter. See [](https://radar.com/documentation/places/categories)
20092018
* @param[groups] An array of groups to filter. See [](https://radar.com/documentation/places/groups)
2019+
* @param[countryCodes] An array of country codes to filter. See [](https://radar.com/documentation/regions/countries)
20102020
* @param[limit] The max number of places to return. A number between 1 and 100.
20112021
* @param[callback] A callback.
20122022
*/
@@ -2017,10 +2027,11 @@ object Radar {
20172027
chains: Array<String>?,
20182028
categories: Array<String>?,
20192029
groups: Array<String>?,
2030+
countryCodes: Array<String>?,
20202031
limit: Int?,
20212032
callback: RadarSearchPlacesCallback
20222033
) {
2023-
searchPlaces(near, radius, chains, null, categories, groups, limit, callback)
2034+
searchPlaces(near, radius, chains, null, categories, groups, countryCodes, limit, callback)
20242035
}
20252036

20262037
/**
@@ -2035,6 +2046,7 @@ object Radar {
20352046
* @param[chainMetadata] A map of metadata keys and values. Values can be strings, numerics, or booleans.
20362047
* @param[categories] An array of categories to filter. See [](https://radar.io/documentation/places/categories)
20372048
* @param[groups] An array of groups to filter. See [](https://radar.io/documentation/places/groups)
2049+
* @param[countryCodes] An array of country codes to filter. See [](https://radar.com/documentation/regions/countries)
20382050
* @param[limit] The max number of places to return. A number between 1 and 100.
20392051
* @param[callback] A callback.
20402052
*/
@@ -2046,6 +2058,7 @@ object Radar {
20462058
chainMetadata: Map<String, String>?,
20472059
categories: Array<String>?,
20482060
groups: Array<String>?,
2061+
countryCodes: Array<String>?,
20492062
limit: Int?,
20502063
callback: RadarSearchPlacesCallback
20512064
) {
@@ -2056,7 +2069,7 @@ object Radar {
20562069
}
20572070
this.logger.i("searchPlaces()", RadarLogType.SDK_CALL)
20582071

2059-
apiClient.searchPlaces(near, radius, chains, chainMetadata, categories, groups, limit, object : RadarApiClient.RadarSearchPlacesApiCallback {
2072+
apiClient.searchPlaces(near, radius, chains, chainMetadata, categories, groups, countryCodes, limit, object : RadarApiClient.RadarSearchPlacesApiCallback {
20602073
override fun onComplete(status: RadarStatus, res: JSONObject?, places: Array<RadarPlace>?) {
20612074
handler.post {
20622075
callback.onComplete(status, near, places)
@@ -2075,6 +2088,7 @@ object Radar {
20752088
* @param[chains] An array of chain slugs to filter. See [](https://radar.com/documentation/places/chains)
20762089
* @param[categories] An array of categories to filter. See [](https://radar.com/documentation/places/categories)
20772090
* @param[groups] An array of groups to filter. See [](https://radar.com/documentation/places/groups)
2091+
* @param[countryCodes] An array of country codes to filter. See [](https://radar.com/documentation/regions/countries)
20782092
* @param[limit] The max number of places to return. A number between 1 and 100.
20792093
* @param[block] A block callback.
20802094
*/
@@ -2084,10 +2098,11 @@ object Radar {
20842098
chains: Array<String>?,
20852099
categories: Array<String>?,
20862100
groups: Array<String>?,
2101+
countryCodes: Array<String>?,
20872102
limit: Int?,
20882103
block: (status: RadarStatus, location: Location?, places: Array<RadarPlace>?) -> Unit
20892104
) {
2090-
searchPlaces(near, radius, chains, null, categories, groups, limit, block)
2105+
searchPlaces(near, radius, chains, null, categories, groups, countryCodes, limit, block)
20912106
}
20922107

20932108
/**
@@ -2102,6 +2117,7 @@ object Radar {
21022117
* @param[chainMetadata] A map of metadata keys and values. Values can be strings, numerics, or booleans.
21032118
* @param[categories] An array of categories to filter. See [](https://radar.io/documentation/places/categories)
21042119
* @param[groups] An array of groups to filter. See [](https://radar.io/documentation/places/groups)
2120+
* @param[countryCodes] An array of country codes to filter. See [](https://radar.com/documentation/regions/countries)
21052121
* @param[limit] The max number of places to return. A number between 1 and 100.
21062122
* @param[block] A block callback.
21072123
*/
@@ -2112,6 +2128,7 @@ object Radar {
21122128
chainMetadata: Map<String, String>?,
21132129
categories: Array<String>?,
21142130
groups: Array<String>?,
2131+
countryCodes: Array<String>?,
21152132
limit: Int?,
21162133
block: (status: RadarStatus, location: Location?, places: Array<RadarPlace>?) -> Unit
21172134
) {
@@ -2122,6 +2139,7 @@ object Radar {
21222139
chainMetadata,
21232140
categories,
21242141
groups,
2142+
countryCodes,
21252143
limit,
21262144
object : RadarSearchPlacesCallback {
21272145
override fun onComplete(status: RadarStatus, location: Location?, places: Array<RadarPlace>?) {

‎sdk/src/main/java/io/radar/sdk/RadarApiClient.kt

+5
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ internal class RadarApiClient(
702702
chainMetadata: Map<String, String>?,
703703
categories: Array<String>?,
704704
groups: Array<String>?,
705+
countryCodes: Array<String>?,
705706
limit: Int?,
706707
callback: RadarSearchPlacesApiCallback
707708
) {
@@ -726,6 +727,10 @@ internal class RadarApiClient(
726727
queryParams.append("&groups=${groups.joinToString(separator = ",")}")
727728
}
728729

730+
if (countryCodes?.isNotEmpty() == true) {
731+
queryParams.append("&country=${countryCodes.joinToString(separator = ",")}")
732+
}
733+
729734
chainMetadata?.entries?.forEach {
730735
queryParams.append("&chainMetadata[${it.key}]=\"${it.value}\"");
731736
}

‎sdk/src/test/java/io/radar/sdk/RadarTest.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ class RadarTest {
893893
val latch = CountDownLatch(1)
894894
var callbackStatus: Radar.RadarStatus? = null
895895

896-
Radar.searchPlaces(1000, arrayOf("walmart"), null, null, null, 100) { status, _, _ ->
896+
Radar.searchPlaces(1000, arrayOf("walmart"), null, null, null, null, 100) { status, _, _ ->
897897
callbackStatus = status
898898
latch.countDown()
899899
}
@@ -912,7 +912,7 @@ class RadarTest {
912912
val latch = CountDownLatch(1)
913913
var callbackStatus: Radar.RadarStatus? = null
914914

915-
Radar.searchPlaces(1000, arrayOf("walmart"), null, null, null, 100) { status, _, _ ->
915+
Radar.searchPlaces(1000, arrayOf("walmart"), null, null, null, null, 100) { status, _, _ ->
916916
callbackStatus = status
917917
latch.countDown()
918918
}
@@ -940,7 +940,7 @@ class RadarTest {
940940
var callbackLocation: Location? = null
941941
var callbackPlaces: Array<RadarPlace>? = null
942942

943-
Radar.searchPlaces(1000, arrayOf("walmart"), null, null, 100) { status, location, places ->
943+
Radar.searchPlaces(1000, arrayOf("walmart"), null, null, null, null, 100) { status, location, places ->
944944
callbackStatus = status
945945
callbackLocation = location
946946
callbackPlaces = places
@@ -973,7 +973,7 @@ class RadarTest {
973973
var callbackPlaces: Array<RadarPlace>? = null
974974
val chainMetadata = mapOf("orderActive" to "true")
975975

976-
Radar.searchPlaces(1000, arrayOf("walmart"), chainMetadata, null, null, 100) { status, location, places ->
976+
Radar.searchPlaces(1000, arrayOf("walmart"), chainMetadata, null, null, null, 100) { status, location, places ->
977977
callbackStatus = status
978978
callbackLocation = location
979979
callbackPlaces = places

0 commit comments

Comments
 (0)
Please sign in to comment.