Skip to content

Commit fe70864

Browse files
Merge pull request nativescript-community#68 from nstudio/feat/dep-updates
chore: dep updates
2 parents dc96a48 + dee5dc6 commit fe70864

File tree

9 files changed

+27
-33
lines changed

9 files changed

+27
-33
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ demo/report/stats.json
2929
/src/pnpm-lock.yaml
3030
package-lock.json
3131
/package
32+
*.tgz

src/.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ platforms/ios/typings
77
platforms/android/*
88
!platforms/android/include.gradle
99
!platforms/android/*.aar
10-
!platforms/android/*.jar
10+
!platforms/android/*.jar
11+
*.tgz

src/https.android.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import { isDefined } from "@nativescript/core/utils/types";
2-
import { HttpResponseEncoding } from "@nativescript/core/http";
3-
import { ImageSource } from "@nativescript/core/image-source";
1+
import { Utils, HttpResponseEncoding, ImageSource, File } from "@nativescript/core";
42
import * as Https from "./https.common";
5-
import { File } from "@nativescript/core/file-system";
63

74
interface Ipeer {
85
enabled: boolean;
@@ -491,8 +488,8 @@ export function createRequest(
491488
if (
492489
["GET", "HEAD"].indexOf(opts.method) !== -1 ||
493490
(opts.method === "DELETE" &&
494-
!isDefined(opts.body) &&
495-
!isDefined(opts.content))
491+
!Utils.isDefined(opts.body) &&
492+
!Utils.isDefined(opts.content))
496493
) {
497494
request[methods[opts.method]]();
498495
} else {

src/https.common.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { Headers, HttpRequestOptions } from "@nativescript/core/http";
2-
import { ImageSource } from "@nativescript/core/image-source";
3-
import { File } from "@nativescript/core/file-system";
1+
import { Headers, HttpRequestOptions, ImageSource, File } from "@nativescript/core";
42
export interface HttpsSSLPinningOptions {
53
host: string;
64
certificate: string;

src/https.common.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { Headers, HttpRequestOptions } from "@nativescript/core/http";
2-
import { ImageSource } from "@nativescript/core/image-source";
3-
import { File, knownFolders, path } from "@nativescript/core/file-system";
1+
import { Headers, HttpRequestOptions, ImageSource, File, knownFolders, path } from "@nativescript/core";
42

53
export interface HttpsSSLPinningOptions {
64
host: string;

src/https.ios.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import {
2-
isDefined,
3-
isNullOrUndefined,
4-
isObject,
5-
} from "@nativescript/core/utils/types";
2+
Utils,
3+
File,
4+
ImageSource
5+
} from "@nativescript/core";
66
import * as Https from "./https.common";
7-
import { File } from "@nativescript/core/file-system";
8-
import { ImageSource } from "@nativescript/core/image-source";
97

108
let cache: NSURLCache;
119

@@ -44,12 +42,12 @@ export function enableSSLPinning(options: Https.HttpsSSLPinningOptions) {
4442
policies.secure = AFSecurityPolicy.policyWithPinningMode(
4543
AFSSLPinningMode.PublicKey
4644
);
47-
policies.secure.allowInvalidCertificates = isDefined(
45+
policies.secure.allowInvalidCertificates = Utils.isDefined(
4846
options.allowInvalidCertificates
4947
)
5048
? options.allowInvalidCertificates
5149
: false;
52-
policies.secure.validatesDomainName = isDefined(
50+
policies.secure.validatesDomainName = Utils.isDefined(
5351
options.validatesDomainName
5452
)
5553
? options.validatesDomainName
@@ -371,7 +369,7 @@ function AFFailure(
371369
let response = error.userInfo.valueForKey(
372370
AFNetworkingOperationFailingURLResponseErrorKey
373371
) as NSHTTPURLResponse;
374-
if (!isNullOrUndefined(response)) {
372+
if (!Utils.isNullOrUndefined(response)) {
375373
sendi.statusCode = response.statusCode;
376374
getHeaders = function () {
377375
let dict = response.allHeaderFields;
@@ -434,7 +432,7 @@ function bodyToNative(cont) {
434432
// cont.forEach(function(item, idx) {
435433
// dict.addObject(bodyToNative(item));
436434
// });
437-
} else if (isObject(cont)) {
435+
} else if (Utils.isObject(cont)) {
438436
dict = NSMutableDictionary.new<string, any>();
439437
Object.keys(cont).forEach((key) =>
440438
dict.setValueForKey(bodyToNative(cont[key]), key)
@@ -511,7 +509,7 @@ export function createRequest(
511509
? opts.timeout
512510
: 10;
513511

514-
const useLegacy = isDefined(opts.useLegacy) ? opts.useLegacy : false;
512+
const useLegacy = Utils.isDefined(opts.useLegacy) ? opts.useLegacy : false;
515513

516514
const progress = opts.onProgress
517515
? (progress: NSProgress) => {
@@ -543,7 +541,7 @@ export function createRequest(
543541
};
544542

545543
let response = task.response as NSHTTPURLResponse;
546-
if (!isNullOrUndefined(response)) {
544+
if (!Utils.isNullOrUndefined(response)) {
547545
sendi.statusCode = response.statusCode;
548546
getHeaders = function () {
549547
let dict = response.allHeaderFields;

src/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-https",
3-
"version": "2.1.0",
3+
"version": "3.0.0",
44
"description": "Secure HTTP client with SSL pinning for Nativescript - iOS/Android.",
55
"main": "https",
66
"typings": "index.d.ts",
@@ -29,9 +29,9 @@
2929
},
3030
"dependencies": {},
3131
"devDependencies": {
32-
"@nativescript/core": "~6.5.1",
33-
"tns-platform-declarations": "~6.5.1",
34-
"typescript": "3.8.3",
32+
"@nativescript/core": "rc",
33+
"@nativescript/types": "rc",
34+
"typescript": "~3.9.0",
3535
"prompt": "^1.0.0",
3636
"rimraf": "^3.0.2",
3737
"tslint": "^6.1.1",

src/references.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
2-
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
1+
/// <reference path="./node_modules/@nativescript/types/ios.d.ts" />
2+
/// <reference path="./node_modules/@nativescript/types/android.d.ts" />
33

44
/// <reference path="./platforms/android/typings/okio.d.ts" />
55
/// <reference path="./platforms/android/typings/okhttp3.d.ts" />

src/tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
4-
"module": "commonjs",
3+
"target": "es2017",
4+
"module": "esnext",
5+
"moduleResolution": "node",
56
"declaration": true,
67
"removeComments": true,
78
"noLib": false,

0 commit comments

Comments
 (0)