From 9c7547690b72163c325e0137ad386cf51ab33db6 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 28 Apr 2022 17:42:33 +0200 Subject: [PATCH 1/2] fix(android): trying to fix kotlin crashes --- .../android/java/com/nativescript/https/OkHttpResponse.java | 4 +++- src/request.android.ts | 2 +- src/typings/android.d.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/platforms/android/java/com/nativescript/https/OkHttpResponse.java b/plugin/platforms/android/java/com/nativescript/https/OkHttpResponse.java index e89e052..c207945 100644 --- a/plugin/platforms/android/java/com/nativescript/https/OkHttpResponse.java +++ b/plugin/platforms/android/java/com/nativescript/https/OkHttpResponse.java @@ -456,7 +456,9 @@ public void run() { }); thread.start(); } - + public static ResponseBody getBody(Response response) { + return response.body(); + } public static int getStatusCode(Response response) { return response.code(); } diff --git a/src/request.android.ts b/src/request.android.ts index cf70cae..3f745b0 100644 --- a/src/request.android.ts +++ b/src/request.android.ts @@ -492,7 +492,7 @@ export function createRequest(opts: HttpsRequestOptions, useLegacy: boolean = tr OkHttpResponse = com.nativescript.https.OkHttpResponse; } try { - const responseBody = response.body(); + const responseBody = OkHttpResponse.getBody(response); const message = OkHttpResponse.getMessage(response); const statusCode = OkHttpResponse.getStatusCode(response); const getHeaders = function () { diff --git a/src/typings/android.d.ts b/src/typings/android.d.ts index 76ca8be..0119d2d 100644 --- a/src/typings/android.d.ts +++ b/src/typings/android.d.ts @@ -22,6 +22,7 @@ declare namespace com { toFile(); toFileAsync(filePath: string, callback: OkHttpResponse.OkHttpResponseAsyncCallback); + static getBody(response: okhttp3.Response): okhttp3.ResponseBody; static getStatusCode(response: okhttp3.Response): number; static getMessage(response: okhttp3.Response): string; static getHeaders(response: okhttp3.Response): string; From 387cdafb822e87a7c9b4007e5cca7a2d52a8e7bb Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 28 Apr 2022 17:43:03 +0200 Subject: [PATCH 2/2] v4.0.5 --- CHANGELOG.md | 6 ++++++ lerna.json | 2 +- plugin/CHANGELOG.md | 6 ++++++ plugin/package.json | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29ba44c..91aa6f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [4.0.5](https://github.com/nativescript-community/https/compare/v4.0.4...v4.0.5) (2022-04-28) + +### Bug Fixes + +* **android:** trying to fix kotlin crashes ([9c75476](https://github.com/nativescript-community/https/commit/9c7547690b72163c325e0137ad386cf51ab33db6)) + ## [4.0.4](https://github.com/nativescript-community/https/compare/v4.0.3...v4.0.4) (2022-04-26) ### Bug Fixes diff --git a/lerna.json b/lerna.json index bc61992..c37db76 100644 --- a/lerna.json +++ b/lerna.json @@ -2,7 +2,7 @@ "packages": [ "plugin" ], - "version": "4.0.4", + "version": "4.0.5", "command": { "publish": { "conventionalCommits": true diff --git a/plugin/CHANGELOG.md b/plugin/CHANGELOG.md index 1b4465a..2e03c54 100644 --- a/plugin/CHANGELOG.md +++ b/plugin/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [4.0.5](https://github.com/nativescript-community/https/compare/v4.0.4...v4.0.5) (2022-04-28) + +### Bug Fixes + +* **android:** trying to fix kotlin crashes ([9c75476](https://github.com/nativescript-community/https/commit/9c7547690b72163c325e0137ad386cf51ab33db6)) + ## [4.0.4](https://github.com/nativescript-community/https/compare/v4.0.3...v4.0.4) (2022-04-26) ### Bug Fixes diff --git a/plugin/package.json b/plugin/package.json index 0b39eec..44368d8 100644 --- a/plugin/package.json +++ b/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript-community/https", - "version": "4.0.4", + "version": "4.0.5", "description": "Nativescript plugin for gestures", "main": "index", "sideEffects": false,