algolia / algoliasearch-client-android

Algolia Search API Client for Android
MIT License
99 stars 29 forks source link

feat(Index): Expose sync methods #544

Closed PLNech closed 6 years ago

PLNech commented 6 years ago

Following a support ticket wondering why one cannot setSettings but only setSettingsAsync.

The original author on these methods' access modifiers:

Not sure… I think it’s just that Android forbids network requests from the main thread, so we didn’t want to expose a public method that would fail when used from there. Honestly, I don’t mind if we make it public.

To enable our users to do sync processing when it makes sense (e.g. from a background thread), this PR exposes our sync methods. I believe we don't need to put a specific warning in every method: it's a standard in Android not to call sync methods from the main thread, developers know how to solve a NetworkOnMainThread exception.