From e86fa36ad367b6c0b5ab38a923d31746f0d8331c Mon Sep 17 00:00:00 2001 From: dzmitryfomchyn Date: Thu, 21 Nov 2024 11:04:28 +0300 Subject: [PATCH] Make settings optional --- MapboxSearch/sdk/api/api-metalava.txt | 6 ++++-- MapboxSearch/sdk/api/sdk.api | 3 +++ .../src/main/java/com/mapbox/search/details/DetailsApi.kt | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/MapboxSearch/sdk/api/api-metalava.txt b/MapboxSearch/sdk/api/api-metalava.txt index 0d3994f76..4b9b5cce0 100644 --- a/MapboxSearch/sdk/api/api-metalava.txt +++ b/MapboxSearch/sdk/api/api-metalava.txt @@ -607,14 +607,16 @@ 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); + 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); + 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 { diff --git a/MapboxSearch/sdk/api/sdk.api b/MapboxSearch/sdk/api/sdk.api index 1e69a4a45..13dbac830 100644 --- a/MapboxSearch/sdk/api/sdk.api +++ b/MapboxSearch/sdk/api/sdk.api @@ -738,13 +738,16 @@ public final class com/mapbox/search/analytics/events/SearchResultsInfo$Creator 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 { diff --git a/MapboxSearch/sdk/src/main/java/com/mapbox/search/details/DetailsApi.kt b/MapboxSearch/sdk/src/main/java/com/mapbox/search/details/DetailsApi.kt index c12cc3171..315491248 100644 --- a/MapboxSearch/sdk/src/main/java/com/mapbox/search/details/DetailsApi.kt +++ b/MapboxSearch/sdk/src/main/java/com/mapbox/search/details/DetailsApi.kt @@ -74,7 +74,8 @@ public interface DetailsApi { * @return a new instance instance of the [DetailsApi]. */ @JvmStatic - public fun create(settings: DetailsApiSettings): DetailsApi { + @JvmOverloads + public fun create(settings: DetailsApiSettings = DetailsApiSettings()): DetailsApi { val coreEngine = SearchEngineFactory().createCoreEngineByApiType( apiType = ApiType.SEARCH_BOX, baseUrl = settings.baseUrl,