|
1 | 1 | import { |
2 | | - isDefined, |
3 | | - isNullOrUndefined, |
4 | | - isObject, |
5 | | -} from "@nativescript/core/utils/types"; |
| 2 | + Utils, |
| 3 | + File, |
| 4 | + ImageSource |
| 5 | +} from "@nativescript/core"; |
6 | 6 | import * as Https from "./https.common"; |
7 | | -import { File } from "@nativescript/core/file-system"; |
8 | | -import { ImageSource } from "@nativescript/core/image-source"; |
9 | 7 |
|
10 | 8 | let cache: NSURLCache; |
11 | 9 |
|
@@ -44,12 +42,12 @@ export function enableSSLPinning(options: Https.HttpsSSLPinningOptions) { |
44 | 42 | policies.secure = AFSecurityPolicy.policyWithPinningMode( |
45 | 43 | AFSSLPinningMode.PublicKey |
46 | 44 | ); |
47 | | - policies.secure.allowInvalidCertificates = isDefined( |
| 45 | + policies.secure.allowInvalidCertificates = Utils.isDefined( |
48 | 46 | options.allowInvalidCertificates |
49 | 47 | ) |
50 | 48 | ? options.allowInvalidCertificates |
51 | 49 | : false; |
52 | | - policies.secure.validatesDomainName = isDefined( |
| 50 | + policies.secure.validatesDomainName = Utils.isDefined( |
53 | 51 | options.validatesDomainName |
54 | 52 | ) |
55 | 53 | ? options.validatesDomainName |
@@ -371,7 +369,7 @@ function AFFailure( |
371 | 369 | let response = error.userInfo.valueForKey( |
372 | 370 | AFNetworkingOperationFailingURLResponseErrorKey |
373 | 371 | ) as NSHTTPURLResponse; |
374 | | - if (!isNullOrUndefined(response)) { |
| 372 | + if (!Utils.isNullOrUndefined(response)) { |
375 | 373 | sendi.statusCode = response.statusCode; |
376 | 374 | getHeaders = function () { |
377 | 375 | let dict = response.allHeaderFields; |
@@ -434,7 +432,7 @@ function bodyToNative(cont) { |
434 | 432 | // cont.forEach(function(item, idx) { |
435 | 433 | // dict.addObject(bodyToNative(item)); |
436 | 434 | // }); |
437 | | - } else if (isObject(cont)) { |
| 435 | + } else if (Utils.isObject(cont)) { |
438 | 436 | dict = NSMutableDictionary.new<string, any>(); |
439 | 437 | Object.keys(cont).forEach((key) => |
440 | 438 | dict.setValueForKey(bodyToNative(cont[key]), key) |
@@ -511,7 +509,7 @@ export function createRequest( |
511 | 509 | ? opts.timeout |
512 | 510 | : 10; |
513 | 511 |
|
514 | | - const useLegacy = isDefined(opts.useLegacy) ? opts.useLegacy : false; |
| 512 | + const useLegacy = Utils.isDefined(opts.useLegacy) ? opts.useLegacy : false; |
515 | 513 |
|
516 | 514 | const progress = opts.onProgress |
517 | 515 | ? (progress: NSProgress) => { |
@@ -543,7 +541,7 @@ export function createRequest( |
543 | 541 | }; |
544 | 542 |
|
545 | 543 | let response = task.response as NSHTTPURLResponse; |
546 | | - if (!isNullOrUndefined(response)) { |
| 544 | + if (!Utils.isNullOrUndefined(response)) { |
547 | 545 | sendi.statusCode = response.statusCode; |
548 | 546 | getHeaders = function () { |
549 | 547 | let dict = response.allHeaderFields; |
|
0 commit comments