Skip to content

Commit

Permalink
Bump Native Search SDK. (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
DzmitryFomchyn authored May 24, 2022
1 parent 73fb6a5 commit 781890d
Show file tree
Hide file tree
Showing 94 changed files with 1,951 additions and 3,512 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

## 1.0.0-beta.30-SNAPSHOT

### Breaking changes
- [CORE] `IndexableDataProvider.add()`, and `IndexableDataProvider.update()` have been replaced with a new function `IndexableDataProvider.upsert()`.
- [CORE] `IndexableDataProvider.addAll()` has been renamed to `IndexableDataProvider.upsertAll()`.
- [CORE] `IndexableDataProviderEngine.add()`, and `IndexableDataProviderEngine.update()` have been replaced with a new function `IndexableDataProviderEngine.upsert()`.
- [CORE] `IndexableDataProviderEngine.addAll()` has been renamed to `IndexableDataProviderEngine.upsertAll()`.
- [CORE] `IndexableDataProviderEngine.executeBatchUpdate()` has been removed along with `IndexableDataProviderEngine.BatchUpdateOperation`. Now `IndexableDataProviderEngine` is a thread-safe entity. If you need multiple operations to be executed one after another, call them in a needed order on the same thread.
- [CORE] `AnalyticsService.sendRawFeedbackEvent()` has been removed. Events should de sent immediately.
- [CORE] `AnalyticsService.createRawFeedbackEvent()` functions have been made asynchronous and marked as deprecated. These functions return raw events in a very specific format and should not be used.

### Mapbox dependencies
- Search Native SDK `0.52.0`
- Common SDK `21.3.0-rc.2`
- Telemetry SDK `8.1.1`
- Search Native SDK `0.54.1`
- Common SDK `21.3.0`
- Kotlin `1.5.31`


Expand Down
36 changes: 0 additions & 36 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens

===========================================================================

Mapbox Search Android uses portions of the Android Support Library core utils.
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox Search Android uses portions of the Android Support Library Cursor Adapter.
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
Expand All @@ -125,12 +119,6 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens

===========================================================================

Mapbox Search Android uses portions of the Android Support Library Document File.
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox Search Android uses portions of the Android Support Library Drawer Layout.
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
Expand All @@ -155,18 +143,6 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens

===========================================================================

Mapbox Search Android uses portions of the Android Support Library Local Broadcast Manager.
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox Search Android uses portions of the Android Support Library Print.
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

===========================================================================

Mapbox Search Android uses portions of the Android Support Library View Pager.
URL: [http://developer.android.com/tools/extras/support-library.html](http://developer.android.com/tools/extras/support-library.html)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
Expand Down Expand Up @@ -292,12 +268,6 @@ License: [Mapbox Terms of Service](https://www.mapbox.com/legal/tos)

===========================================================================

Mapbox Search Android uses portions of the Mapbox Telemetry for Android.
URL: [https://github.com/mapbox/mapbox-events-android](https://github.com/mapbox/mapbox-events-android)
License: [MIT](https://mit-license.org)

===========================================================================

Mapbox Search Android uses portions of the okhttp.
URL: [https://square.github.io/okhttp/](https://square.github.io/okhttp/)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
Expand Down Expand Up @@ -672,12 +642,6 @@ License: [Mapbox Terms of Service](https://www.mapbox.com/legal/tos)

===========================================================================

Mapbox Search Android uses portions of the Mapbox Telemetry for Android.
URL: [https://github.com/mapbox/mapbox-events-android](https://github.com/mapbox/mapbox-events-android)
License: [MIT](https://mit-license.org)

===========================================================================

Mapbox Search Android uses portions of the Material Components for Android.
URL: [https://github.com/material-components/material-components-android](https://github.com/material-components/material-components-android)
License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)
Expand Down
7 changes: 3 additions & 4 deletions MapboxSearch/gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ ext {

pitest_version = '1.6.7'

mapbox_maps_version = "10.4.0"
telemetry_version = '8.1.1'
common_sdk_version = '21.3.0-rc.2'
mapbox_maps_version = "10.5.0"
common_sdk_version = '21.3.0'
mapbox_base_version = '0.6.0'
mapbox_android_core_version = '5.0.1'

search_native_version = '0.52.0'
search_native_version = '0.54.1'

detekt_version = "1.19.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.mapbox.search.sample.Constants.Assets.RANELAGH_ROYAL_SPA_RESULT_ASSET
import com.mapbox.search.sample.Constants.Assets.RANELAGH_SUGGESTIONS_ASSET
import com.mapbox.search.sample.extensions.enqueue
import com.mapbox.search.sample.extensions.noInternetConnectionError
import com.mapbox.search.sample.extensions.unknownError
import com.mapbox.search.sample.robots.addressSearchView
import com.mapbox.search.sample.robots.editFavoriteView
import com.mapbox.search.sample.robots.favoriteActionsDialog
Expand Down Expand Up @@ -383,7 +384,9 @@ class FavoritesTest : MockServerSearchActivityTest() {
typeQuery(CLEMENS_STREET_43_NAME)
awaitResults()
verifySearchResults {
noInternetConnectionError()
// TODO(https://github.com/mapbox/mapbox-search-sdk/issues/870)
// noInternetConnectionError() should be here
unknownError()
}
retryFromError()
selectSearchResult(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ abstract class MockServerSearchActivityTest {

protected fun createNoNetworkConnectionResponse(): MockResponse {
return MockResponse()
.setSocketPolicy(SocketPolicy.NO_RESPONSE)
.setSocketPolicy(SocketPolicy.DISCONNECT_AT_START)
}

protected fun MockWebServer.enqueueSuccessfulResponses(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ fun SearchResultsRecyclerBuilder.noInternetConnectionError() {
errorSubtitle = "You’re offline. Try to reconnect."
)
}

fun SearchResultsRecyclerBuilder.unknownError() {
error(
errorTitle = "Error",
errorSubtitle = "Something went wrong."
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public AsyncOperationTask registerIndexableDataProviderEngine(
@NonNull Executor executor,
@NonNull CompletionCallback<Unit> callback
) {
dataProviderEngine.addAll(records.values());
dataProviderEngine.upsertAll(records.values());
dataProviderEngines.add(dataProviderEngine);
executor.execute(() -> callback.onComplete(Unit.INSTANCE));
return CompletedAsyncOperationTask.getInstance();
Expand Down Expand Up @@ -268,13 +268,13 @@ public AsyncOperationTask contains(@NonNull String id, @NonNull CompletionCallba

@NonNull
@Override
public AsyncOperationTask add(
public AsyncOperationTask upsert(
@NonNull R record,
@NonNull Executor executor,
@NonNull CompletionCallback<Unit> callback
) {
for (IndexableDataProviderEngine engine : dataProviderEngines) {
engine.add(record);
engine.upsert(record);
}
records.put(record.getId(), record);
executor.execute(() -> callback.onComplete(Unit.INSTANCE));
Expand All @@ -283,19 +283,19 @@ public AsyncOperationTask add(

@NonNull
@Override
public AsyncOperationTask add(@NonNull R record, @NonNull CompletionCallback<Unit> callback) {
return add(record, mainThreadExecutor, callback);
public AsyncOperationTask upsert(@NonNull R record, @NonNull CompletionCallback<Unit> callback) {
return upsert(record, mainThreadExecutor, callback);
}

@NonNull
@Override
public AsyncOperationTask addAll(
public AsyncOperationTask upsertAll(
@NonNull List<? extends R> records,
@NonNull Executor executor,
@NonNull CompletionCallback<Unit> callback
) {
for (IndexableDataProviderEngine engine : dataProviderEngines) {
engine.addAll(records);
engine.upsertAll(records);
}
for (R record : records) {
this.records.put(record.getId(), record);
Expand All @@ -306,29 +306,8 @@ public AsyncOperationTask addAll(

@NonNull
@Override
public AsyncOperationTask addAll(@NonNull List<? extends R> records, @NonNull CompletionCallback<Unit> callback) {
return addAll(records, mainThreadExecutor, callback);
}

@NonNull
@Override
public AsyncOperationTask update(
@NonNull R record,
@NonNull Executor executor,
@NonNull CompletionCallback<Unit> callback
) {
for (IndexableDataProviderEngine engine : dataProviderEngines) {
engine.update(record);
}
records.put(record.getId(), record);
executor.execute(() -> callback.onComplete(Unit.INSTANCE));
return CompletedAsyncOperationTask.getInstance();
}

@NonNull
@Override
public AsyncOperationTask update(@NonNull R record, @NonNull CompletionCallback<Unit> callback) {
return update(record, mainThreadExecutor, callback);
public AsyncOperationTask upsertAll(@NonNull List<? extends R> records, @NonNull CompletionCallback<Unit> callback) {
return upsertAll(records, mainThreadExecutor, callback);
}

@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class CustomIndexableDataProviderKotlinExample : AppCompatActivity() {
executor: Executor,
callback: CompletionCallback<Unit>
): AsyncOperationTask {
dataProviderEngine.addAll(records.values.toList())
dataProviderEngine.upsertAll(records.values.toList())
dataProviderEngines.add(dataProviderEngine)
executor.execute {
callback.onComplete(Unit)
Expand Down Expand Up @@ -198,9 +198,9 @@ class CustomIndexableDataProviderKotlinExample : AppCompatActivity() {
return CompletedAsyncOperationTask
}

override fun add(record: R, executor: Executor, callback: CompletionCallback<Unit>): AsyncOperationTask {
override fun upsert(record: R, executor: Executor, callback: CompletionCallback<Unit>): AsyncOperationTask {
dataProviderEngines.forEach {
it.add(record)
it.upsert(record)
}
records[record.id] = record
executor.execute {
Expand All @@ -209,13 +209,13 @@ class CustomIndexableDataProviderKotlinExample : AppCompatActivity() {
return CompletedAsyncOperationTask
}

override fun addAll(
override fun upsertAll(
records: List<R>,
executor: Executor,
callback: CompletionCallback<Unit>
): AsyncOperationTask {
dataProviderEngines.forEach {
it.addAll(records)
it.upsertAll(records)
}
for (record in records) {
this.records[record.id] = record
Expand All @@ -226,17 +226,6 @@ class CustomIndexableDataProviderKotlinExample : AppCompatActivity() {
return CompletedAsyncOperationTask
}

override fun update(record: R, executor: Executor, callback: CompletionCallback<Unit>): AsyncOperationTask {
dataProviderEngines.forEach {
it.update(record)
}
records[record.id] = record
executor.execute {
callback.onComplete(Unit)
}
return CompletedAsyncOperationTask
}

override fun remove(id: String, executor: Executor, callback: CompletionCallback<Boolean>): AsyncOperationTask {
dataProviderEngines.forEach {
it.remove(id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
null
);

task = favoritesDataProvider.add(newFavorite, addFavoriteCallback);
task = favoritesDataProvider.upsert(newFavorite, addFavoriteCallback);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class FavoritesDataProviderKotlinExample : AppCompatActivity() {
metadata = null
)

task = favoritesDataProvider.add(newFavorite, addFavoriteCallback)
task = favoritesDataProvider.upsert(newFavorite, addFavoriteCallback)
}

override fun onDestroy() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.mapbox.search.common

// TODO should ErrorsReporter functionality be moved to the common-sdk module?
object CommonErrorsReporter {
var reporter: ((Throwable) -> Unit)? = null
}
Loading

0 comments on commit 781890d

Please sign in to comment.