Update kotlin usage of okhttp due to bump 3.x->4.xwhich is binary compatible but not source compatible

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2021-05-06 00:48:52 +02:00
parent 6326268793
commit 7a574285db
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
3 changed files with 6 additions and 6 deletions

View File

@ -1267,7 +1267,7 @@ class ChatController(args: Bundle) :
val xChatLastCommonRead = response.headers().get("X-Chat-Last-Common-Read")?.let {
Integer.parseInt(it)
}
if (response.headers().size() > 0 && !TextUtils.isEmpty(xChatLastGivenHeader)) {
if (response.headers().size > 0 && !TextUtils.isEmpty(xChatLastGivenHeader)) {
val header = Integer.parseInt(xChatLastGivenHeader!!)
if (header > 0) {

View File

@ -54,8 +54,8 @@ import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import okhttp3.MediaType
import okhttp3.RequestBody
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody
import javax.inject.Inject
@AutoInjector(NextcloudTalkApplication::class)
@ -122,7 +122,7 @@ class ContactAddressBookWorker(val context: Context, workerParameters: WorkerPar
ncApi.searchContactsByPhoneNumber(
ApiUtils.getCredentials(currentUser.username, currentUser.token),
ApiUtils.getUrlForSearchByNumber(currentUser.baseUrl),
RequestBody.create(MediaType.parse("application/json"), json)
json.toRequestBody("application/json".toMediaTypeOrNull())
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@ -44,7 +44,7 @@ import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody
import retrofit2.Response
import java.io.File
@ -103,7 +103,7 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
val input: InputStream = context.contentResolver.openInputStream(sourcefileUri)!!
val buf = ByteArray(input.available())
while (input.read(buf) != -1);
requestBody = RequestBody.create(MediaType.parse("application/octet-stream"), buf)
requestBody = RequestBody.create("application/octet-stream".toMediaTypeOrNull(), buf)
} catch (e: Exception) {
Log.e(javaClass.simpleName, "failed to create RequestBody for $sourcefileUri", e)
}