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

Details API, Bump search native; Search 2.6.1 release #295

Merged
merged 4 commits into from
Nov 21, 2024
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog for the Mapbox Search SDK for Android

## 2.6.1

### New features
- Added experimental Details API that provides access to POI metadata, boundary details, addresses and places. See `DetailsApi` type.

### Bug fixes
- Fixed `OpenHours` parsing for the Search Box Api type.

### Mapbox dependencies
- Search Native SDK `2.6.2`
- Common SDK `24.8.0`



## 2.6.0

### Mapbox dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.mapbox.search.base

/**
* This annotation marks the experimental state of the Mapbox Search SDK API.
* This API is stable in nature, but it's likely that properties might be added or removed in the
* future.
* Any usage of a declaration annotated with `@ExperimentalMapboxSearchAPI` must be accepted
* either by annotating that usage with the [OptIn] annotation,
* e.g. `@OptIn(ExperimentalMapboxSearchAPI::class)`, or by using the compiler argument
* `-Xopt-in=com.mapbox.search.base.ExperimentalMapboxSearchAPI`.
*/
@Retention(value = AnnotationRetention.BINARY)
@RequiresOptIn(level = RequiresOptIn.Level.ERROR)
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY,
)
annotation class ExperimentalMapboxSearchAPI
2 changes: 1 addition & 1 deletion MapboxSearch/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android.enableJetifier=false
kotlin.code.style=official

# SDK version attributes
VERSION_NAME=2.6.0
VERSION_NAME=2.6.1

# Artifact attributes
mapboxArtifactUserOrg=mapbox
Expand Down
2 changes: 1 addition & 1 deletion MapboxSearch/gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ext {
common_sdk_version = '24.8.0'
mapbox_base_version = '0.8.0'

search_native_version = '2.6.0'
search_native_version = '2.6.2'

detekt_version = '1.19.0'

Expand Down
1 change: 1 addition & 0 deletions MapboxSearch/sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<activity android:name=".api.JapanSearchJavaExampleActivity" />
<activity android:name=".api.JapanSearchKotlinExampleActivity" />
<activity android:name=".api.OfflineSearchAlongRouteExampleActivity" />
<activity android:name=".api.DetailsApiKotlinExampleActivity" />

</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import com.mapbox.search.sample.api.CategorySearchJavaExampleActivity
import com.mapbox.search.sample.api.CategorySearchKotlinExampleActivity
import com.mapbox.search.sample.api.CustomIndexableDataProviderJavaExample
import com.mapbox.search.sample.api.CustomIndexableDataProviderKotlinExample
import com.mapbox.search.sample.api.DetailsApiKotlinExampleActivity
import com.mapbox.search.sample.api.DiscoverJavaExampleActivity
import com.mapbox.search.sample.api.DiscoverKotlinExampleActivity
import com.mapbox.search.sample.api.FavoritesDataProviderJavaExample
Expand Down Expand Up @@ -477,6 +478,10 @@ class MainActivity : AppCompatActivity() {
startActivity(Intent(this, JapanSearchKotlinExampleActivity::class.java))
true
}
R.id.open_details_api_kt_example -> {
startActivity(Intent(this, DetailsApiKotlinExampleActivity::class.java))
true
}
R.id.open_japan_search_java_example -> {
startActivity(Intent(this, JapanSearchJavaExampleActivity::class.java))
true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.mapbox.search.sample.api

import android.os.Bundle
import com.mapbox.search.AttributeSet
import com.mapbox.search.ResponseInfo
import com.mapbox.search.SearchResultCallback
import com.mapbox.search.base.ExperimentalMapboxSearchAPI
import com.mapbox.search.common.AsyncOperationTask
import com.mapbox.search.details.DetailsApi
import com.mapbox.search.details.DetailsApiSettings
import com.mapbox.search.details.RetrieveDetailsOptions
import com.mapbox.search.result.SearchResult
import com.mapbox.search.sample.R

@OptIn(ExperimentalMapboxSearchAPI::class)
class DetailsApiKotlinExampleActivity : BaseKotlinExampleActivity() {

override val titleResId: Int = R.string.action_open_details_api_kt_example

private lateinit var detailsApi: DetailsApi
private var task: AsyncOperationTask? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

// Set your Access Token here if it's not already set in some other way
// MapboxOptions.accessToken = "<my-access-token>"
detailsApi = DetailsApi.create(DetailsApiSettings())
}

override fun onDestroy() {
task?.cancel()
super.onDestroy()
}

override fun startExample() {
task = detailsApi.retrieveDetails(
mapboxId = "dXJuOm1ieHBvaTowZGY2MzE4Yi0wNGNjLTRkOTYtYTZmMy0yNmJmM2ZiODUyODU",
options = RetrieveDetailsOptions(attributeSets = AttributeSet.values().toList()),
callback = object : SearchResultCallback {
override fun onResult(result: SearchResult, responseInfo: ResponseInfo) {
logI("SearchApiExample", "Retrieve result:", result)
onFinished()
}

override fun onError(e: Exception) {
logE("SearchApiExample", "Retrieve error", e)
onFinished()
}
}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@
android:title="@string/action_open_japan_search_kt_example"
/>

<item
android:id="@+id/open_details_api_kt_example"
android:title="@string/action_open_details_api_kt_example"
/>

<item
android:id="@+id/open_history_data_provider_kt_example"
android:title="@string/action_open_history_data_provider_kt_example"
Expand Down
1 change: 1 addition & 0 deletions MapboxSearch/sample/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<string name="action_open_favorites_data_provider_java_example">Favorites Data Provider</string>
<string name="action_open_custom_data_provider_java_example">Custom data provider</string>
<string name="action_open_custom_data_provider_kt_example">Custom data provider</string>
<string name="action_open_details_api_kt_example">Details API</string>

<string name="action_open_offline_search_along_route_example">Offline Search Along Route</string>

Expand Down
44 changes: 44 additions & 0 deletions MapboxSearch/sdk/api/api-metalava.txt
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,50 @@ package com.mapbox.search.analytics {

}

package com.mapbox.search.details {

@com.mapbox.search.base.ExperimentalMapboxSearchAPI public interface DetailsApi {
method public default static com.mapbox.search.details.DetailsApi create(com.mapbox.search.details.DetailsApiSettings settings = DetailsApiSettings());
method public default static final com.mapbox.search.details.DetailsApi create();
method public default com.mapbox.search.common.AsyncOperationTask retrieveDetails(String mapboxId, com.mapbox.search.details.RetrieveDetailsOptions options, com.mapbox.search.SearchResultCallback callback);
method public com.mapbox.search.common.AsyncOperationTask retrieveDetails(String mapboxId, com.mapbox.search.details.RetrieveDetailsOptions options, java.util.concurrent.Executor executor, com.mapbox.search.SearchResultCallback callback);
field public static final com.mapbox.search.details.DetailsApi.Companion Companion;
}

public static final class DetailsApi.Companion {
method public com.mapbox.search.details.DetailsApi create(com.mapbox.search.details.DetailsApiSettings settings = DetailsApiSettings());
method public com.mapbox.search.details.DetailsApi create();
}

@com.mapbox.search.base.ExperimentalMapboxSearchAPI public final class DetailsApiSettings {
ctor public DetailsApiSettings(com.mapbox.common.location.LocationProvider? locationProvider = <anonymous class>(), com.mapbox.search.ViewportProvider? viewportProvider = null, String? baseUrl = null);
ctor public DetailsApiSettings(com.mapbox.common.location.LocationProvider? locationProvider = <anonymous class>(), com.mapbox.search.ViewportProvider? viewportProvider = null);
ctor public DetailsApiSettings(com.mapbox.common.location.LocationProvider? locationProvider = <anonymous class>());
method public String? getBaseUrl();
method public com.mapbox.common.location.LocationProvider? getLocationProvider();
method public com.mapbox.search.ViewportProvider? getViewportProvider();
property public final String? baseUrl;
property public final com.mapbox.common.location.LocationProvider? locationProvider;
property public final com.mapbox.search.ViewportProvider? viewportProvider;
}

@com.mapbox.search.base.ExperimentalMapboxSearchAPI @kotlinx.parcelize.Parcelize public final class RetrieveDetailsOptions implements android.os.Parcelable {
ctor public RetrieveDetailsOptions(java.util.List<? extends com.mapbox.search.AttributeSet>? attributeSets = null, com.mapbox.search.common.IsoLanguageCode language = <anonymous class>(), com.mapbox.search.common.IsoCountryCode? worldview = null);
ctor public RetrieveDetailsOptions(java.util.List<? extends com.mapbox.search.AttributeSet>? attributeSets = null, com.mapbox.search.common.IsoLanguageCode language = <anonymous class>());
ctor public RetrieveDetailsOptions(java.util.List<? extends com.mapbox.search.AttributeSet>? attributeSets = null);
method public java.util.List<com.mapbox.search.AttributeSet>? getAttributeSets();
method public com.mapbox.search.common.IsoLanguageCode getLanguage();
method public com.mapbox.search.common.IsoCountryCode? getWorldview();
property public final java.util.List<com.mapbox.search.AttributeSet>? attributeSets;
property public final com.mapbox.search.common.IsoLanguageCode language;
property public final com.mapbox.search.common.IsoCountryCode? worldview;
}

public final class RetrieveDetailsOptionsKt {
}

}

package com.mapbox.search.record {

@kotlinx.parcelize.Parcelize public final class FavoriteRecord implements com.mapbox.search.record.IndexableRecord android.os.Parcelable {
Expand Down
57 changes: 57 additions & 0 deletions MapboxSearch/sdk/api/sdk.api
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,63 @@ public final class com/mapbox/search/analytics/events/SearchResultsInfo$Creator
public synthetic fun newArray (I)[Ljava/lang/Object;
}

public abstract interface class com/mapbox/search/details/DetailsApi {
public static final field Companion Lcom/mapbox/search/details/DetailsApi$Companion;
public static fun create ()Lcom/mapbox/search/details/DetailsApi;
public static fun create (Lcom/mapbox/search/details/DetailsApiSettings;)Lcom/mapbox/search/details/DetailsApi;
public abstract fun retrieveDetails (Ljava/lang/String;Lcom/mapbox/search/details/RetrieveDetailsOptions;Lcom/mapbox/search/SearchResultCallback;)Lcom/mapbox/search/common/AsyncOperationTask;
public abstract fun retrieveDetails (Ljava/lang/String;Lcom/mapbox/search/details/RetrieveDetailsOptions;Ljava/util/concurrent/Executor;Lcom/mapbox/search/SearchResultCallback;)Lcom/mapbox/search/common/AsyncOperationTask;
}

public final class com/mapbox/search/details/DetailsApi$Companion {
public final fun create ()Lcom/mapbox/search/details/DetailsApi;
public final fun create (Lcom/mapbox/search/details/DetailsApiSettings;)Lcom/mapbox/search/details/DetailsApi;
public static synthetic fun create$default (Lcom/mapbox/search/details/DetailsApi$Companion;Lcom/mapbox/search/details/DetailsApiSettings;ILjava/lang/Object;)Lcom/mapbox/search/details/DetailsApi;
}

public final class com/mapbox/search/details/DetailsApi$DefaultImpls {
public static fun retrieveDetails (Lcom/mapbox/search/details/DetailsApi;Ljava/lang/String;Lcom/mapbox/search/details/RetrieveDetailsOptions;Lcom/mapbox/search/SearchResultCallback;)Lcom/mapbox/search/common/AsyncOperationTask;
}

public final class com/mapbox/search/details/DetailsApiSettings {
public fun <init> ()V
public fun <init> (Lcom/mapbox/common/location/LocationProvider;)V
public fun <init> (Lcom/mapbox/common/location/LocationProvider;Lcom/mapbox/search/ViewportProvider;)V
public fun <init> (Lcom/mapbox/common/location/LocationProvider;Lcom/mapbox/search/ViewportProvider;Ljava/lang/String;)V
public synthetic fun <init> (Lcom/mapbox/common/location/LocationProvider;Lcom/mapbox/search/ViewportProvider;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getBaseUrl ()Ljava/lang/String;
public final fun getLocationProvider ()Lcom/mapbox/common/location/LocationProvider;
public final fun getViewportProvider ()Lcom/mapbox/search/ViewportProvider;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class com/mapbox/search/details/RetrieveDetailsOptions : android/os/Parcelable {
public static final field CREATOR Landroid/os/Parcelable$Creator;
public fun <init> ()V
public fun <init> (Ljava/util/List;)V
public fun <init> (Ljava/util/List;Lcom/mapbox/search/common/IsoLanguageCode;)V
public fun <init> (Ljava/util/List;Lcom/mapbox/search/common/IsoLanguageCode;Lcom/mapbox/search/common/IsoCountryCode;)V
public synthetic fun <init> (Ljava/util/List;Lcom/mapbox/search/common/IsoLanguageCode;Lcom/mapbox/search/common/IsoCountryCode;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public final fun getAttributeSets ()Ljava/util/List;
public final fun getLanguage ()Lcom/mapbox/search/common/IsoLanguageCode;
public final fun getWorldview ()Lcom/mapbox/search/common/IsoCountryCode;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public fun writeToParcel (Landroid/os/Parcel;I)V
}

public final class com/mapbox/search/details/RetrieveDetailsOptions$Creator : android/os/Parcelable$Creator {
public fun <init> ()V
public final fun createFromParcel (Landroid/os/Parcel;)Lcom/mapbox/search/details/RetrieveDetailsOptions;
public synthetic fun createFromParcel (Landroid/os/Parcel;)Ljava/lang/Object;
public final fun newArray (I)[Lcom/mapbox/search/details/RetrieveDetailsOptions;
public synthetic fun newArray (I)[Ljava/lang/Object;
}

public final class com/mapbox/search/record/FavoriteRecord : android/os/Parcelable, com/mapbox/search/record/IndexableRecord {
public static final field CREATOR Landroid/os/Parcelable$Creator;
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/search/result/SearchAddress;Ljava/util/List;Ljava/util/List;Ljava/lang/String;Lcom/mapbox/geojson/Point;Lcom/mapbox/search/result/SearchResultType;Lcom/mapbox/search/SearchResultMetadata;)V
Expand Down
Loading