diff --git a/CHANGELOG.md b/CHANGELOG.md index 76735de..c666b75 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.8](https://github.com/nativescript-community/https/compare/v4.0.7...v4.0.8) (2022-09-17) + +### Features + +* export getClient for use with ui-image plugin ([50a5f4a](https://github.com/nativescript-community/https/commit/50a5f4a6657c93a441df7f55f6a0b392f3c2b251)) + ## [4.0.7](https://github.com/nativescript-community/https/compare/v4.0.6...v4.0.7) (2022-09-17) ### Features diff --git a/lerna.json b/lerna.json index 090ecd8..8b0212e 100644 --- a/lerna.json +++ b/lerna.json @@ -2,7 +2,7 @@ "packages": [ "plugin" ], - "version": "4.0.7", + "version": "4.0.8", "command": { "publish": { "conventionalCommits": true diff --git a/plugin/CHANGELOG.md b/plugin/CHANGELOG.md index 9ded29b..88cd2dd 100644 --- a/plugin/CHANGELOG.md +++ b/plugin/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [4.0.8](https://github.com/nativescript-community/https/compare/v4.0.7...v4.0.8) (2022-09-17) + +**Note:** Version bump only for package @nativescript-community/https + ## [4.0.7](https://github.com/nativescript-community/https/compare/v4.0.6...v4.0.7) (2022-09-17) **Note:** Version bump only for package @nativescript-community/https diff --git a/plugin/package.json b/plugin/package.json index 84d2983..e7dfd01 100644 --- a/plugin/package.json +++ b/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript-community/https", - "version": "4.0.7", + "version": "4.0.8", "description": "Nativescript plugin for gestures", "main": "index", "sideEffects": false, diff --git a/src/request.android.ts b/src/request.android.ts index f91f12e..0797f5e 100644 --- a/src/request.android.ts +++ b/src/request.android.ts @@ -30,7 +30,8 @@ export function setCache(options?: CacheOptions) { cache = null; } if (Client) { - getClient(true); + //we need to force a new client for the builder to use cache + getClient(undefined, true); } } export function clearCache() { @@ -221,18 +222,18 @@ export function enableSSLPinning(options: HttpsSSLPinningOptions) { } } peer.enabled = true; - getClient(true); + getClient(undefined, true); } export function disableSSLPinning() { peer.enabled = false; - getClient(true); + getClient(undefined, true); } let Client: okhttp3.OkHttpClient; let cookieJar: com.nativescript.https.QuotePreservingCookieJar; let cookieManager: java.net.CookieManager; -function getClient(reload: boolean = false, opts: Partial = {}): okhttp3.OkHttpClient { +export function getClient(opts: Partial = {}, reload: boolean = false): okhttp3.OkHttpClient { if (!Client) { // ssl error fix on KitKat. Only need to be done once. // client will be null only onced so will run only once @@ -409,7 +410,7 @@ const runningClients: { [k: string]: okhttp3.OkHttpClient } = {}; let OkHttpResponse: typeof com.nativescript.https.OkHttpResponse; export function createRequest(opts: HttpsRequestOptions, useLegacy: boolean = true): HttpsRequest { - const client = getClient(false, opts); + const client = getClient(opts, false); const request = new okhttp3.Request.Builder(); request.url(opts.url); diff --git a/src/request.d.ts b/src/request.d.ts index a1ac570..910cab7 100644 --- a/src/request.d.ts +++ b/src/request.d.ts @@ -110,4 +110,6 @@ export function clearCache(); export function createRequest(opts: HttpsRequestOptions): HttpsRequest; export function cancelRequest(tag: string); export function addNetworkInterceptor(interceptor); + +export function getClient(opts: Partial); export * from './request.common'; diff --git a/src/request.ios.ts b/src/request.ios.ts index a23464c..6a0e60d 100644 --- a/src/request.ios.ts +++ b/src/request.ios.ts @@ -488,3 +488,7 @@ export function request(opts: HttpsRequestOptions, useLegacy: boolean = true) { } }); } +//Android only +export function getClient(opts: Partial) { + return undefined; +}