diff --git a/.classpath b/.classpath deleted file mode 100644 index eb19361..0000000 --- a/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 505a094..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,177 +0,0 @@ -module.exports = { - extends: ['plugin:prettier/recommended'], - plugins: ['prettier', '@typescript-eslint'], - parser: '@typescript-eslint/parser', - parserOptions: { - createDefaultProgram: true, - project: './tsconfig.json', - }, - rules: { - 'prettier/prettier': 'warn', - '@typescript-eslint/adjacent-overload-signatures': 'error', - '@typescript-eslint/array-type': 'error', - '@typescript-eslint/await-thenable': 'error', - '@typescript-eslint/ban-types': 'off', - '@typescript-eslint/class-name-casing': 'off', - '@typescript-eslint/consistent-type-assertions': 'error', - '@typescript-eslint/consistent-type-definitions': 'error', - '@typescript-eslint/explicit-member-accessibility': [ - 'off', - { - accessibility: 'explicit', - }, - ], - '@typescript-eslint/indent': [ - 'error', - 4, - { - FunctionDeclaration: { - parameters: 'first', - }, - FunctionExpression: { - parameters: 'first', - }, - SwitchCase: 1, - }, - ], - '@typescript-eslint/interface-name-prefix': 'off', - '@typescript-eslint/member-delimiter-style': 'error', - '@typescript-eslint/member-ordering': 'off', - '@typescript-eslint/no-empty-function': 'off', - '@typescript-eslint/no-empty-interface': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-floating-promises': 'off', - '@typescript-eslint/no-inferrable-types': 'off', - '@typescript-eslint/no-misused-new': 'off', - '@typescript-eslint/no-namespace': 'off', - '@typescript-eslint/no-parameter-properties': 'off', - '@typescript-eslint/no-require-imports': 'off', - '@typescript-eslint/no-unnecessary-qualifier': 'error', - '@typescript-eslint/no-unnecessary-type-assertion': 'error', - '@typescript-eslint/no-use-before-declare': 'off', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/prefer-for-of': 'off', - '@typescript-eslint/prefer-function-type': 'error', - '@typescript-eslint/prefer-namespace-keyword': 'error', - '@typescript-eslint/quotes': [ - 'error', - 'single', - { - avoidEscape: true, - }, - ], - '@typescript-eslint/semi': ['error'], - '@typescript-eslint/space-within-parens': ['off', 'never'], - '@typescript-eslint/triple-slash-reference': 'off', - '@typescript-eslint/type-annotation-spacing': 'error', - '@typescript-eslint/unified-signatures': 'error', - 'arrow-body-style': 'error', - 'arrow-parens': ['off', 'as-needed'], - camelcase: 'off', - 'capitalized-comments': 'off', - complexity: 'off', - 'constructor-super': 'error', - curly: ['error', 'multi-line'], - 'dot-notation': 'off', - 'eol-last': 'error', - eqeqeq: ['error', 'smart'], - 'guard-for-in': 'off', - 'id-blacklist': ['error', 'any', 'string', 'boolean', 'Undefined'], - 'id-match': 'error', - 'sort-imports': [ - 'error', - { - ignoreCase: false, - ignoreDeclarationSort: true, - ignoreMemberSort: false, - memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], - }, - ], - 'linebreak-style': 'off', - 'max-classes-per-file': 'off', - 'max-len': [ - 'off', - { - ignorePattern: '^import |^export {(.*?)}', - code: 200, - }, - ], - 'new-parens': 'off', - 'newline-per-chained-call': 'off', - 'no-bitwise': 'off', - 'no-caller': 'error', - 'no-cond-assign': 'off', - 'no-console': [ - 'off', - { - allow: [ - 'log', - 'warn', - 'dir', - 'timeLog', - 'assert', - 'clear', - 'count', - 'countReset', - 'group', - 'groupEnd', - 'table', - 'debug', - 'dirxml', - 'error', - 'groupCollapsed', - 'Console', - 'profile', - 'profileEnd', - 'timeStamp', - 'context', - ], - }, - ], - 'no-constant-condition': 'error', - 'no-control-regex': 'off', - 'no-debugger': 'error', - 'no-duplicate-imports': 'error', - 'no-empty': 'off', - 'no-eval': 'off', - 'no-extra-semi': 'off', - 'no-fallthrough': 'error', - 'no-invalid-regexp': 'error', - 'no-invalid-this': 'off', - 'no-irregular-whitespace': 'off', - 'no-multiple-empty-lines': 'off', - 'no-new-wrappers': 'error', - 'no-redeclare': ['error', { builtinGlobals: false }], - 'no-regex-spaces': 'error', - 'no-return-await': 'error', - 'no-shadow': [ - 'off', - { - hoist: 'all', - }, - ], - 'no-throw-literal': 'error', - 'no-trailing-spaces': 'error', - 'no-undef-init': 'error', - 'no-underscore-dangle': 'off', - 'no-unsafe-finally': 'error', - 'no-unused-expressions': [ - 'error', - { - allowTaggedTemplates: true, - allowShortCircuit: true, - }, - ], - 'no-unused-labels': 'error', - 'no-var': 'error', - 'object-shorthand': 'error', - 'one-var': ['off', 'never'], - 'prefer-arrow/prefer-arrow-functions': 'off', - 'prefer-const': 'error', - 'quote-props': 'off', - radix: 'error', - 'space-before-function-paren': 'off', - 'use-isnan': 'error', - 'valid-typeof': 'off', - }, -}; diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..04d38ab --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [farfromrefug] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..edece08 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,112 @@ +name: 'release' + +on: + workflow_dispatch: + inputs: + release_type: + type: choice + default: auto + description: What kind of version upgrade + options: + - auto + - patch + - minor + - major + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: "0" + submodules: true + + - name: setup node + uses: actions/setup-node@v4 + with: + node-version: lts/* + registry-url: 'https://registry.npmjs.org' + + + - uses: oNaiPs/secrets-to-env-action@v1 + with: + secrets: ${{ toJSON(secrets) }} + + + - uses: oleksiyrudenko/gha-git-credentials@v2-latest + with: + token: '${{ secrets.GITHUB_TOKEN }}' + name: Martin Guillon + email: dev@akylas.fr + + - name: install jq + run: sudo apt install jq + + - name: Enable CorePack + run: | + corepack enable + yarn config get globalFolder # the yarn command will ensure the correct yarn version is downloaded and installed + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn config get globalFolder)" + + - name: Remove package.json resolutions + run: echo "`jq 'delpaths([["resolutions"]])' package.json`" > package.json + + - uses: actions/cache@v4 + name: Handle node_modules Cache + id: yarn-node_modules # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: node_modules + key: ${{ runner.os }}-yarn-node_modules-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node_modules- + + - uses: actions/cache@v4 + if: steps.yarn-node_modules.outputs.cache-hit != 'true' + name: Handle Yarn cache + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-cache-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install deps + if: steps.yarn-node_modules.outputs.cache-hit != 'true' + uses: bahmutov/npm-install@v1 + with: + install-command: corepack yarn --silent + env: + YARN_ENABLE_IMMUTABLE_INSTALLS: false + + - name: run setup + run: | + npm run setup + + - name: "NPM Identity" + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc + + - name: publish auto + if: github.event.inputs.release_type == 'auto' + run: | + npm run publish -- --force-publish --no-verify-access --no-private --no-commit-hooks --yes + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: publish + if: github.event.inputs.release_type != 'auto' + run: | + npm run publish -- --force-publish --no-verify-access --no-private --no-commit-hooks --yes --bump ${{ github.event.inputs.release_type }} + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index dd3b22f..204dcfb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,62 @@ -.idea -.vscode -node_modules +# NativeScript +hooks/ +node_modules/ platforms -hooks -package-lock.json + +# NativeScript Template +*.js.map +!ngcc.config.js +!webpack.config.js + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# General .DS_Store -npm-debug.log.* -demo*/app/**/*.js -demo*/typings +.AppleDouble +.LSOverride +.idea +.cloud +.gradle +.project +.yarn +.cxx +tmp/ + +!.eslintrc.js +!.prettierrc.js + +!e2e/*.js +!detox.config.js +devices.js + *.framework +*.xcframework **/*.js.map src/**/*.js -plugin/**/*.js -plugin/**/*.d.ts +packages/**/*.js +packages/**/*.d.ts bin build Pods -!plugin/platforms -/plugin/platforms/android/*.aar +!packages/*/platforms +/packages/**/*.aar +/packages/**/*.framework +/packages/**/*.xcframework +/demo-snippets/**/*.aar *.xcuserdatad -/plugin/README.md -plugin/**/*js.map -plugin/**/*js -pnpm-lock.yaml +/packages/README.md +packages/**/*js.map +packages/**/*js +packages/typings +packages/**/angular +packages/**/*.ngsummary.json +packages/**/*.metadata.json + +/blueprint.md + +*.tsbuildinfo \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..9c65367 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "demo-vue"] + path = demo-vue + url = https://github.com/nativescript-community/plugin-seed-demo-vue.git +[submodule "tools"] + path = tools + url = https://github.com/nativescript-community/plugin-seed-tools.git diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..bf96d31 --- /dev/null +++ b/.npmrc @@ -0,0 +1,11 @@ +shamefully-hoist=true +public-hoist-pattern[]=*eslint* +public-hoist-pattern[]=source-map-support +public-hoist-pattern[]=ts-patch +public-hoist-pattern[]=typescript +public-hoist-pattern[]=cpy-cli +strict-peer-dependencies=false +shell-emulator=true +auto-install-peers=false +loglevel=error +engine-strict=true diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..96d64cd --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +package-lock.json +node_modules/ +plugin/ +docs/ diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index e27ecb6..0000000 --- a/.prettierrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "printWidth": 200, - "semi": true, - "tabWidth": 4, - "singleQuote": true -} \ No newline at end of file diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..2010c32 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,13 @@ +module.exports = { + plugins: ['prettier-plugin-svelte'], + overrides: [{ files: '*.svelte', options: { parser: 'svelte' } }], + printWidth: 200, + semi: true, + tabWidth: 4, + trailingComma: 'none', + singleQuote: true, + svelteSortOrder: 'options-styles-scripts-markup', + svelteStrictMode: false, + svelteBracketNewLine: false, + svelteIndentScriptAndStyle: true +}; diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 04347a5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,60 +0,0 @@ -matrix: - include: - - stage: "Lint" - language: node_js - os: linux - node_js: "10" - script: cd src && npm run ci.tslint - - stage: "WebPack, Build" - os: osx - env: - - WebPack="iOS" - osx_image: xcode10.2 - language: node_js - node_js: "10" - jdk: oraclejdk8 - before_script: pod repo update - script: cd demo && npm run build.plugin && npm i && tns build ios --bundle --env.uglify - - language: android - os: linux - env: - - WebPack="Android" - dist: trusty - jdk: oraclejdk8 - before_install: nvm install 10 - script: cd demo && npm run build.plugin && npm i && tns build android --bundle --env.uglify --env.snapshot - - language: android - env: - - BuildAndroid="28" - os: linux - jdk: oraclejdk8 - dist: trusty - before_install: nvm install 10 - script: - - cd src && npm i && npm run tsc && cd ../demo && tns build android - - os: osx - osx_image: xcode10.2 - language: node_js - node_js: "10" - jdk: oraclejdk8 - before_script: pod repo update - script: - - cd src && npm i && npm run tsc && cd ../demo && tns build ios - -android: - components: - - tools - - platform-tools - - build-tools-28.0.3 - - android-28 - - extra-android-m2repository - - sys-img-armeabi-v7a-android-21 - -before_install: - - sudo pip install --upgrade pip - - sudo pip install six - -install: - - echo no | npm install -g nativescript - - tns usage-reporting disable - - tns error-reporting disable \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..28eb5c5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,51 @@ +{ + "typescript.tsdk": "node_modules/typescript/lib", + "svelte.plugin.svelte.compilerWarnings": { + "missing-declaration": "ignore", + "a11y-aria-attributes": "ignore", + "a11y-incorrect-aria-attribute-type": "ignore", + "a11y-unknown-aria-attribute": "ignore", + "a11y-hidden": "ignore", + "a11y-misplaced-role": "ignore", + "a11y-unknown-role": "ignore", + "a11y-no-abstract-role": "ignore", + "a11y-no-redundant-roles": "ignore", + "a11y-role-has-required-aria-props": "ignore", + "a11y-accesskey": "ignore", + "a11y-autofocus": "ignore", + "a11y-misplaced-scope": "ignore", + "a11y-positive-tabindex": "ignore", + "a11y-invalid-attribute": "ignore", + "a11y-missing-attribute": "ignore", + "a11y-img-redundant-alt": "ignore", + "a11y-label-has-associated-control": "ignore", + "a11y-media-has-caption": "ignore", + "a11y-distracting-elements": "ignore", + "a11y-structure": "ignore", + "a11y-mouse-events-have-key-events": "ignore", + "a11y-missing-content": "ignore", + "illegal-attribute-character": "ignore" + }, + "scss.lint.validProperties": [ + "max-font-size", + "min-font-size", + "ios-a11y-adjusts-font-size", + "status-bar-style", + "navigation-bar-color", + "status-bar-color", + "ripple-color", + "stroke-color", + "fill-color", + "on-check-color", + "on-tint-color", + "shape", + "elevation", + "horizontal-align", + "horizontal-alignment", + "vertical-text-alignment", + "floating", + "vertical-alignment", + "placeholder-color", + "variant" + ] +} \ No newline at end of file diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000..80c89ad --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1,5 @@ +compressionLevel: mixed + +nmHoistingLimits: workspaces + +nodeLinker: node-modules diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c7021e..7cd35b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,112 +3,480 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [3.3.2](https://github.com/farfromrefug/nativescript-https/compare/v3.3.1...v3.3.2) (2021-10-21) +## [4.1.32](https://github.com/nativescript-community/https/compare/v4.1.31...v4.1.32) (2026-03-31) + +### Bug Fixes +* error when Blob does not exist ([f20e60b](https://github.com/nativescript-community/https/commit/f20e60b3f7d8e50033e4db837ea38a7a96c62f82)) + +## [4.1.31](https://github.com/nativescript-community/https/compare/v4.1.30...v4.1.31) (2026-03-30) ### Bug Fixes -* **android:** native-api-usage fix ([6f8748d](https://github.com/farfromrefug/nativescript-https/commit/6f8748da0323eb2520dbb5024301deb136bd5baa)) +* new getManager() method ([a232425](https://github.com/nativescript-community/https/commit/a232425fc8002301dc43d6a3f1786808953b0510)) +## [4.1.30](https://github.com/nativescript-community/https/compare/v4.1.29...v4.1.30) (2026-03-28) +### Bug Fixes +* ios fix for body and POST ([04c719a](https://github.com/nativescript-community/https/commit/04c719a1b0280b15f4fff639c0a21eded6b4a543)) +## [4.1.29](https://github.com/nativescript-community/https/compare/v4.1.28...v4.1.29) (2026-03-27) -## [3.3.1](https://github.com/farfromrefug/nativescript-https/compare/v3.3.0...v3.3.1) (2021-10-18) +### Bug Fixes + +* **https:** android application/x-www-form-urlencoded fix ([a133e53](https://github.com/nativescript-community/https/commit/a133e53409a24e64ded19c3c19d6ba948e8c46bc)) +## [4.1.28](https://github.com/nativescript-community/https/compare/v4.1.27...v4.1.28) (2026-03-26) ### Bug Fixes -* **android:** native-api-usage fix ([e18a203](https://github.com/farfromrefug/nativescript-https/commit/e18a2039464d488f3e370dd7feaf6ed61e4938e6)) +* form data supports File type ([486f83f](https://github.com/nativescript-community/https/commit/486f83f398cc6bc6377ca6ef5b171f63653abfa0)) +## [4.1.27](https://github.com/nativescript-community/https/compare/v4.1.26...v4.1.27) (2026-01-14) +### Bug Fixes +* support ArrayBuffer/Blob for form data ([54140de](https://github.com/nativescript-community/https/commit/54140de323c0e9854c86444effaa02c3b8404529)) +## [4.1.26](https://github.com/nativescript-community/https/compare/v4.1.25...v4.1.26) (2025-12-18) -# [3.3.0](https://github.com/farfromrefug/nativescript-https/compare/v3.2.2...v3.3.0) (2021-10-17) +### Bug Fixes + +* prevent error with undefined/null headers entries ([e19d7b5](https://github.com/nativescript-community/https/commit/e19d7b557166a44b6d5b7d74077bb88651a70fc6)) + +## [4.1.25](https://github.com/nativescript-community/https/compare/v4.1.24...v4.1.25) (2025-12-11) + +**Note:** Version bump only for package https + +## [4.1.24](https://github.com/nativescript-community/https/compare/v4.1.23...v4.1.24) (2025-12-11) + +**Note:** Version bump only for package https +## [4.1.23](https://github.com/nativescript-community/https/compare/v4.1.22...v4.1.23) (2025-12-11) ### Bug Fixes -* **android:** Conscrypt not included by default anymore. You need to add it in your app ([c16f34d](https://github.com/farfromrefug/nativescript-https/commit/c16f34d1b2f3fa226760ab00b17e56f6996dff96)) +* new option `runProgressOnMainThread` ([e53584a](https://github.com/nativescript-community/https/commit/e53584aa2f72fa917637da07987f6a763a69b59e)) + +## [4.1.22](https://github.com/nativescript-community/https/compare/v4.1.21...v4.1.22) (2025-11-25) + +### Bug Fixes + +* **android:** improved cache control interceptor ([b92d084](https://github.com/nativescript-community/https/commit/b92d0847ea79370f5b76d0ff777c58954a29598a)) + +## [4.1.21](https://github.com/nativescript-community/https/compare/v4.1.20...v4.1.21) (2025-10-29) + +### Bug Fixes + +* **android:** another native-api-usage fix ([f3e95a2](https://github.com/nativescript-community/https/commit/f3e95a2f3f4064a378082cf4d148bc797f2b600d)) +## [4.1.20](https://github.com/nativescript-community/https/compare/v4.1.19...v4.1.20) (2025-10-29) ### Features -* **android:** native-api-usage ([9415f38](https://github.com/farfromrefug/nativescript-https/commit/9415f387b929b01c7fe385ff5d42e1bbd15ae2e4)) +* Expose native http error instance on failure ([17443fb](https://github.com/nativescript-community/https/commit/17443fb05044b41940ab2dcf04cb99f0e88d1f64)) +### Bug Fixes +* **android:** native-api-usage fix ([43d8595](https://github.com/nativescript-community/https/commit/43d8595cf132d5705ec185a065fc9e7098d247b0)) +## [4.1.19](https://github.com/nativescript-community/https/compare/v4.1.18...v4.1.19) (2024-10-05) +### Bug Fixes -## [3.2.2](https://github.com/farfromrefug/nativescript-https/compare/v3.2.1...v3.2.2) (2021-07-21) +* **ios:** should fix privacy submission issue ([299bd38](https://github.com/nativescript-community/https/commit/299bd3814b648e210c38a4910e537283718ca39b)) +## [4.1.18](https://github.com/nativescript-community/https/compare/v4.1.17...v4.1.18) (2024-09-26) ### Bug Fixes -* **android:** prevent error when no cache-control ([e3d781e](https://github.com/farfromrefug/nativescript-https/commit/e3d781ed3a2d7364d3179d6a5acc39b5b9b65e29)) +* **ios:** prevent error ([67d096c](https://github.com/nativescript-community/https/commit/67d096cc30585b997423e52c32e52fdd93e37190)) +## [4.1.17](https://github.com/nativescript-community/https/compare/v4.1.16...v4.1.17) (2024-09-25) +### Bug Fixes +* **ios:** encoding fix for toString ([0a1221a](https://github.com/nativescript-community/https/commit/0a1221a3b5a3ecb6b736855eb242d7a5311918e2)) +* **ios:** Unexpected end of JSON input ([949fcfb](https://github.com/nativescript-community/https/commit/949fcfb9d154f0687ae76714ed12c091ed4dcf23)) +## [4.1.16](https://github.com/nativescript-community/https/compare/v4.1.15...v4.1.16) (2024-07-17) -## [3.2.1](https://github.com/farfromrefug/nativescript-https/compare/v3.2.0...v3.2.1) (2021-07-01) +### Bug Fixes +* new `responseOnMainThread` option which allows running requests from worker ([71885b3](https://github.com/nativescript-community/https/commit/71885b30f26e5e70f6cdfdb61597cd7ff87d499c)) + +## [4.1.15](https://github.com/nativescript-community/https/compare/v4.1.14...v4.1.15) (2024-07-16) + +### Features + +* Added support for removing cached responses using url ([9866da9](https://github.com/nativescript-community/https/commit/9866da95aaa4afdbf758967ca943e71b3c22ffcd)) ### Bug Fixes -* **android:** support for application/x-www-form-urlencoded ([fb8db51](https://github.com/farfromrefug/nativescript-https/commit/fb8db514916dd1c29baa40016fc5302c64a79a41)) +* Compiler warnings ([87a9631](https://github.com/nativescript-community/https/commit/87a9631143f5394f298047ef02308579bb8075bb)) +## [4.1.14](https://github.com/nativescript-community/https/compare/v4.1.13...v4.1.14) (2024-07-10) +### Bug Fixes +* android timeout ([d648278](https://github.com/nativescript-community/https/commit/d6482785485f60655227491b81f8c070889cb4e5)) +## [4.1.13](https://github.com/nativescript-community/https/compare/v4.1.12...v4.1.13) (2024-05-24) -# [3.2.0](https://github.com/farfromrefug/nativescript-https/compare/v3.1.3...v3.2.0) (2021-03-14) +### Bug Fixes + +* **android:** getImage fix ([dae5f65](https://github.com/nativescript-community/https/commit/dae5f6541a8ffe4ba561021b0bd4267aaeb8a92c)) + +## [4.1.12](https://github.com/nativescript-community/https/compare/v4.1.11...v4.1.12) (2024-04-10) + +### Bug Fixes + +* **android:** prevent null exception ([73817e3](https://github.com/nativescript-community/https/commit/73817e3f706dc77b8ed78fc406bfe7eea1330839)) + +## [4.1.11](https://github.com/nativescript-community/https/compare/v4.1.10...v4.1.11) (2024-04-09) + +### Bug Fixes + +* **android:** revert wraping native error so that app ([b23b7ca](https://github.com/nativescript-community/https/commit/b23b7ca73525a5c2e0176771d5a84a7be2d7a17b)) + +## [4.1.10](https://github.com/nativescript-community/https/compare/v4.1.9...v4.1.10) (2024-03-29) + +### Bug Fixes + +* **android:** `forceCache` fix ([b3319ea](https://github.com/nativescript-community/https/commit/b3319ead68353f19e07a0eade5367ba7428e72fd)) + +## [4.1.9](https://github.com/nativescript-community/https/compare/v4.1.8...v4.1.9) (2024-02-28) + +### Bug Fixes + +* **android:** wrap native errors in js Error ([c6f11c5](https://github.com/nativescript-community/https/commit/c6f11c5132116560d98901246f69d6ec52911917)) + +## [4.1.8](https://github.com/nativescript-community/https/compare/v4.1.7...v4.1.8) (2023-11-21) + +### Bug Fixes + +* **ios:** ensure progress is run on main thread(for now) ([60a4453](https://github.com/nativescript-community/https/commit/60a44530f2371996a952c8566f2d9fded26d5b1e)) + +## [4.1.7](https://github.com/nativescript-community/https/compare/v4.1.6...v4.1.7) (2023-11-21) + +## [4.1.5](https://github.com/nativescript-community/https/compare/v4.1.4...v4.1.5) (2023-11-02) + +### Bug Fixes + +* **ios:** rewrote to support all HTTP methods. ([4a25a73](https://github.com/nativescript-community/https/commit/4a25a73dc672e051370591e11e2dfe98127a60a5)) +## [4.1.6](https://github.com/nativescript-community/https/compare/v4.1.4...v4.1.6) (2023-11-13) + +### Bug Fixes + +* **android:** prevent error with GET and onProgress ([ae50812](https://github.com/nativescript-community/https/commit/ae508120411543c5a6822196dd890b29890a0804)) +* refactor to allow all HTTP methods. better support for uploading files ([b7ad6b9](https://github.com/nativescript-community/https/commit/b7ad6b99c7d8952249215e7170dcd4ca51070ddd)) + +## [4.1.4](https://github.com/nativescript-community/https/compare/v4.1.3...v4.1.4) (2023-10-25) + +### Bug Fixes + +* **angular:** xhr factory import ([71a3609](https://github.com/nativescript-community/https/commit/71a3609abd8a0180f1519b051b02e633605bdfe1)) + +## [4.1.3](https://github.com/nativescript-community/https/compare/v4.1.2...v4.1.3) (2023-10-19) ### Features -* **android:** forceCache option ([cc225be](https://github.com/farfromrefug/nativescript-https/commit/cc225bea37e0035288533106e48a469e11d15d01)) +* **angular:** handle params ([eff8222](https://github.com/nativescript-community/https/commit/eff82226bf4727b73d8484014245956248931d70)) +## [4.1.2](https://github.com/nativescript-community/https/compare/v4.1.1...v4.1.2) (2023-08-30) +### Bug Fixes +* **android:** toBitmapAsync is not a function error fix ([63b19f0](https://github.com/nativescript-community/https/commit/63b19f03334d8ae742dddc47d48db530d88db63f)) +* **ios:** base URL for AFHTTPSessionManager ([0ee4640](https://github.com/nativescript-community/https/commit/0ee46405eed8fe2902b01ddb1f871f604424bf51)) +* **ios:** non legacy report format fix ([1cec77e](https://github.com/nativescript-community/https/commit/1cec77ef3144c4840fb205142aa4d7e761262196)) +## [4.1.1](https://github.com/nativescript-community/https/compare/v4.1.0...v4.1.1) (2023-07-03) -## [3.1.3](https://github.com/farfromrefug/nativescript-https/compare/v3.1.2...v3.1.3) (2021-03-12) +### Bug Fixes + +* angular build ([0290951](https://github.com/nativescript-community/https/commit/0290951a20d41a9158e406f6120ea9f2a1459219)) +* angular code formatting & error handling ([e1893e4](https://github.com/nativescript-community/https/commit/e1893e4481793abecf32bb44ef6185c498935d2d)) +* call async methods to prevent android.os.NetworkOnMainThreadException errors ([ec82cef](https://github.com/nativescript-community/https/commit/ec82cef78897de459f879b42f3a83eb7504d5fec)) + +# [4.1.0](https://github.com/nativescript-community/https/compare/v4.0.17...v4.1.0) (2023-04-30) + +### Features + +* angular module ([dc3761a](https://github.com/nativescript-community/https/commit/dc3761ac33d99ddaa35d47e56c3275774af647f1)) +* angular support ([ff92deb](https://github.com/nativescript-community/https/commit/ff92deb51bc95605c02eafe9ae4f066434fe8dcd)) +## [4.0.17](https://github.com/nativescript-community/https/compare/v4.0.16...v4.0.17) (2023-03-20) ### Bug Fixes -* **android:** correctly use timeout option ([9a1e5be](https://github.com/farfromrefug/nativescript-https/commit/9a1e5be39f70453653d8cbc38c66ddf6843754ce)) +* **android:** support native data for form data parameters ([47e9002](https://github.com/nativescript-community/https/commit/47e9002ddd4c1ec8acf106035e36c6649829ae85)) +## [4.0.16](https://github.com/nativescript-community/https/compare/v4.0.15...v4.0.16) (2023-03-14) +### Features +* `cancelAllRequests` ([3a014bc](https://github.com/nativescript-community/https/commit/3a014bc9fe797d9b1405b9ed75348fba776d6eb2)) +## [4.0.15](https://github.com/nativescript-community/https/compare/v4.0.14...v4.0.15) (2023-03-06) -## [3.1.2](https://github.com/farfromrefug/nativescript-https/compare/v3.1.1...v3.1.2) (2020-12-09) +### Bug Fixes +* **android:** update to latest okhttp lib ([c4b7870](https://github.com/nativescript-community/https/commit/c4b78703637e21bbfa84647d7f8a6f07348c9f44)) + +### Features + +* **android:** support passing custom RequestBody as `content` parameter ([4e5b513](https://github.com/nativescript-community/https/commit/4e5b5136f19487a87911638ef4b9fc7a174dd619)) + +## [4.0.14](https://github.com/nativescript-community/https/compare/v4.0.13...v4.0.14) (2023-02-15) ### Bug Fixes -* ios crash with cache on < 13 ([e021b8d](https://github.com/farfromrefug/nativescript-https/commit/e021b8d9c847f5ba545cc6fc52e6271780dd4e7f)) +* **android:** cookiesEnabled: false fixed ([94f6bb1](https://github.com/nativescript-community/https/commit/94f6bb18c546ef1e427730d45cc71a4726f9ab39)) +## [4.0.13](https://github.com/nativescript-community/https/compare/v4.0.12...v4.0.13) (2023-01-24) +### Bug Fixes +* **android:** native-api-usage fix ([0f5ca06](https://github.com/nativescript-community/https/commit/0f5ca062c06c0f2c31677be8c528c1b072070e50)) +## [4.0.12](https://github.com/nativescript-community/https/compare/v4.0.11...v4.0.12) (2023-01-23) -## [3.1.1](https://github.com/farfromrefug/nativescript-https/compare/v3.1.0...v3.1.1) (2020-11-26) +### Bug Fixes + +* **android:** improved native-api-usage ([5e32bb0](https://github.com/nativescript-community/https/commit/5e32bb08e3f95c75e0ec05d0594294911eda72af)) + +## [4.0.11](https://github.com/nativescript-community/https/compare/v4.0.10...v4.0.11) (2022-12-05) + +### Features + +* clearCookies method ([5410f6e](https://github.com/nativescript-community/https/commit/5410f6e86202ca74b31fea0f94fda95467c13e38)) +## [4.0.10](https://github.com/nativescript-community/https/compare/v4.0.9...v4.0.10) (2022-11-02) ### Bug Fixes -* correctly handle null responses from requests ([6b70be6](https://github.com/farfromrefug/nativescript-https/commit/6b70be64eb44a7e3da1705f025128bd9fabe6d2a)) +* **ios:** correctly send JSON body with null values ([8ba7085](https://github.com/nativescript-community/https/commit/8ba70858927adef23b2a0eeea32827bff975457b)) +## [4.0.9](https://github.com/nativescript-community/https/compare/v4.0.8...v4.0.9) (2022-11-02) +### Bug Fixes +* **ios:** prevent crash on request failure ([c9485e5](https://github.com/nativescript-community/https/commit/c9485e57833946c858682899b09d2c504d445fbc)) +## [4.0.8](https://github.com/nativescript-community/https/compare/v4.0.7...v4.0.8) (2022-09-17) -# 3.1.0 (2020-10-29) +### 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 + +* added `cookiesEnabled` property (`true` by default) ([19aeb27](https://github.com/nativescript-community/https/commit/19aeb27f469e989c8d71b48aa32139c8faa66cd2)) + +## [4.0.6](https://github.com/nativescript-community/https/compare/v4.0.5...v4.0.6) (2022-05-18) + +### Bug Fixes + +* **android:** cancelling of long process requests fix ([e46b698](https://github.com/nativescript-community/https/commit/e46b698d106ccf3239ecbee5f7ea3a39192a50f5)) + +## [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 + +* **android:** should work now ([7368616](https://github.com/nativescript-community/https/commit/7368616735cdb4d3110c04a5fc19800327b5e3ed)) + +## [4.0.3](https://github.com/nativescript-community/https/compare/v4.0.2...v4.0.3) (2022-04-26) + +### Bug Fixes + +* **android:** another fix... ([8cd3c92](https://github.com/nativescript-community/https/commit/8cd3c92980faeb6b87dfe6799b56b3b0a9375e60)) + +## [4.0.2](https://github.com/nativescript-community/https/compare/v4.0.1...v4.0.2) (2022-04-26) + +### Bug Fixes + +* **android:** broken headers in response ([81d8479](https://github.com/nativescript-community/https/commit/81d8479a5dd44fb1e51212b8842c3409b7c23ed3)) + +## [4.0.1](https://github.com/nativescript-community/https/compare/v4.0.0...v4.0.1) (2022-04-25) + +### Bug Fixes + +* **android:** crash on response headers ([b09da7f](https://github.com/nativescript-community/https/commit/b09da7f3e357e5b3047b73227f7c29d2efb93ced)) + +# [4.0.0](https://github.com/nativescript-community/https/compare/v3.4.4...v4.0.0) (2022-04-25) + +### Features + +* **android:** upgrade okhttp to 4.x. WARNING: minSDKVersion bumped to 21! + +## [3.4.4](https://github.com/nativescript-community/https/compare/v3.4.3...v3.4.4) (2022-04-25) + +### Bug Fixes + +* **android:** dont try/catch sync methods to prevent missed errors ([cb830a8](https://github.com/nativescript-community/https/commit/cb830a8cad414133bcdff4a14c986cb8899984e6)) +* **android:** upgrade okhttp to max 3.x ([eb0b61e](https://github.com/nativescript-community/https/commit/eb0b61ea8ba53055538d5460abf0474a22ba3282)) + +## [3.4.3](https://github.com/nativescript-community/https/compare/v3.4.2...v3.4.3) (2022-04-25) + +### Bug Fixes + +* **android:** native-api-usage fix ([bc3c7d2](https://github.com/nativescript-community/https/commit/bc3c7d24160038f48e487918ee8abcf5d24f0322)) + +### Features + +* contentLength ([a2e1017](https://github.com/nativescript-community/https/commit/a2e10170145a8e94e10f407e5fe772cb0d40e12c)) + +## [3.4.2](https://github.com/nativescript-community/https/compare/v3.4.1...v3.4.2) (2022-02-26) + +### Bug Fixes + +* completely broken release … ([b35209e](https://github.com/nativescript-community/https/commit/b35209e98ebd87a196512a84b68b67c79ffb1341)) + +## [3.4.1](https://github.com/nativescript-community/https/compare/v3.4.0...v3.4.1) (2022-02-26) + +### Bug Fixes + +* **android:** fixed broken build ([532ae49](https://github.com/nativescript-community/https/commit/532ae49a0dbe6c9dc4742400051d5ea86646ebbc)) + +# [3.4.0](https://github.com/nativescript-community/https/compare/v3.3.13...v3.4.0) (2022-02-25) + +### Features + +* refactoring to allow N alias to replace core impl ([22ac92f](https://github.com/nativescript-community/https/commit/22ac92f572c9b2739c40f5a39f47ac67d28a78ee)) + +## [3.3.13](https://github.com/nativescript-community/https/compare/v3.3.12...v3.3.13) (2022-02-08) + +### Bug Fixes + +* **ios:** fix form data passed as a string ([d234842](https://github.com/nativescript-community/https/commit/d234842c5a29b8a360aae6c91dce80821630eea1)) + +## [3.3.12](https://github.com/nativescript-community/https/compare/v3.3.11...v3.3.12) (2022-01-20) + +### Bug Fixes + +* **android:** progress support for uploading ([67817ac](https://github.com/nativescript-community/https/commit/67817ac284f8da424829b0c400b5c2c788ccf9dc)) + +## [3.3.11](https://github.com/nativescript-community/https/compare/v3.3.10...v3.3.11) (2022-01-20) + +### Bug Fixes + +* **android:** native-api-usage fix ([06dc376](https://github.com/nativescript-community/https/commit/06dc376b01683675ef2a90135396ec5a9f1cf60a)) + +## [3.3.10](https://github.com/nativescript-community/https/compare/v3.3.9...v3.3.10) (2022-01-19) + +### Bug Fixes + +* typings fix ([3490469](https://github.com/nativescript-community/https/commit/3490469cdc019265ec321ff9db37b94100f94b49)) + +## [3.3.9](https://github.com/nativescript-community/https/compare/v3.3.8...v3.3.9) (2022-01-18) + +**Note:** Version bump only for package @nativescript-community/https + +## [3.3.8](https://github.com/farfromrefug/nativescript-https/compare/v3.3.7...v3.3.8) (2022-01-18) + +### Bug Fixes + +* **android:** `cancelRequest` fix ([c7b8c93](https://github.com/farfromrefug/nativescript-https/commit/c7b8c935a6b02dc4f9e5c20c6911b2e59db8fa64)) + +## [3.3.7](https://github.com/farfromrefug/nativescript-https/compare/v3.3.6...v3.3.7) (2022-01-15) + +### Bug Fixes + +* **android:** `cancelRequest` not exported ([9727802](https://github.com/farfromrefug/nativescript-https/commit/972780279a291d3f95636601450198a78d935696)) + +## [3.3.6](https://github.com/farfromrefug/nativescript-https/compare/v3.3.5...v3.3.6) (2022-01-15) + +### Features + +* added method `cancelRequest`. You need to set the `tag` in request options first ([bace983](https://github.com/farfromrefug/nativescript-https/commit/bace9832d9ab07b158068eca3104a24f4c494851)) + +## [3.3.5](https://github.com/farfromrefug/nativescript-https/compare/v3.3.4...v3.3.5) (2022-01-14) + +**Note:** Version bump only for package @nativescript-community/https + +## [3.3.4](https://github.com/farfromrefug/nativescript-https/compare/v3.3.3...v3.3.4) (2022-01-14) + +### Bug Fixes + +* **android:** missing native-api-usage ([0d6d67b](https://github.com/farfromrefug/nativescript-https/commit/0d6d67b223e52d5e3d80b4513f2ee6d591495e4f)) +* missing export of `addNetworkInterceptor`, `addInterceptor` ([2b503c4](https://github.com/farfromrefug/nativescript-https/commit/2b503c42d43cde3f82d994346948e20bbf91fc57)) + +## [3.3.3](https://github.com/farfromrefug/nativescript-https/compare/v3.3.2...v3.3.3) (2021-12-23) + +### Bug Fixes + +* android allow interceptors ([49073c5](https://github.com/farfromrefug/nativescript-https/commit/49073c5c4e1ab1370da4260ebc833705eaabb2b3)) + +## [3.3.2](https://github.com/farfromrefug/nativescript-https/compare/v3.3.1...v3.3.2) (2021-10-21) + +### Bug Fixes + +* **android:** native-api-usage fix ([6f8748d](https://github.com/farfromrefug/nativescript-https/commit/6f8748da0323eb2520dbb5024301deb136bd5baa)) + +## [3.3.1](https://github.com/farfromrefug/nativescript-https/compare/v3.3.0...v3.3.1) (2021-10-18) + +### Bug Fixes + +* **android:** native-api-usage fix ([e18a203](https://github.com/farfromrefug/nativescript-https/commit/e18a2039464d488f3e370dd7feaf6ed61e4938e6)) + +# [3.3.0](https://github.com/farfromrefug/nativescript-https/compare/v3.2.2...v3.3.0) (2021-10-17) + +### Bug Fixes + +* **android:** Conscrypt not included by default anymore. You need to add it in your app ([c16f34d](https://github.com/farfromrefug/nativescript-https/commit/c16f34d1b2f3fa226760ab00b17e56f6996dff96)) + +### Features + +* **android:** native-api-usage ([9415f38](https://github.com/farfromrefug/nativescript-https/commit/9415f387b929b01c7fe385ff5d42e1bbd15ae2e4)) + +## [3.2.2](https://github.com/farfromrefug/nativescript-https/compare/v3.2.1...v3.2.2) (2021-07-21) + +### Bug Fixes + +* **android:** prevent error when no cache-control ([e3d781e](https://github.com/farfromrefug/nativescript-https/commit/e3d781ed3a2d7364d3179d6a5acc39b5b9b65e29)) + +## [3.2.1](https://github.com/farfromrefug/nativescript-https/compare/v3.2.0...v3.2.1) (2021-07-01) + +### Bug Fixes + +* **android:** support for application/x-www-form-urlencoded ([fb8db51](https://github.com/farfromrefug/nativescript-https/commit/fb8db514916dd1c29baa40016fc5302c64a79a41)) + +# [3.2.0](https://github.com/farfromrefug/nativescript-https/compare/v3.1.3...v3.2.0) (2021-03-14) + +### Features + +* **android:** forceCache option ([cc225be](https://github.com/farfromrefug/nativescript-https/commit/cc225bea37e0035288533106e48a469e11d15d01)) + +## [3.1.3](https://github.com/farfromrefug/nativescript-https/compare/v3.1.2...v3.1.3) (2021-03-12) + +### Bug Fixes + +* **android:** correctly use timeout option ([9a1e5be](https://github.com/farfromrefug/nativescript-https/commit/9a1e5be39f70453653d8cbc38c66ddf6843754ce)) + +## [3.1.2](https://github.com/farfromrefug/nativescript-https/compare/v3.1.1...v3.1.2) (2020-12-09) + +### Bug Fixes + +* ios crash with cache on < 13 ([e021b8d](https://github.com/farfromrefug/nativescript-https/commit/e021b8d9c847f5ba545cc6fc52e6271780dd4e7f)) + +## [3.1.1](https://github.com/farfromrefug/nativescript-https/compare/v3.1.0...v3.1.1) (2020-11-26) + +### Bug Fixes + +* correctly handle null responses from requests ([6b70be6](https://github.com/farfromrefug/nativescript-https/commit/6b70be64eb44a7e3da1705f025128bd9fabe6d2a)) + +# 3.1.0 (2020-10-29) ### Bug Fixes @@ -132,7 +500,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * useLegacy should be a request option ([74f1afa](https://github.com/farfromrefug/nativescript-https/commit/74f1afabfeb051c08b89050b17771356381bd03c)) * **ios:** multipart fix ([0d9d331](https://github.com/farfromrefug/nativescript-https/commit/0d9d331ff49cedd06ed0d07cd25a4b50181a23a5)) - ### Features * basick cookie support ([91fe3c7](https://github.com/farfromrefug/nativescript-https/commit/91fe3c7d6b8fd7f4198845bd9f88324ccb384704)) @@ -141,22 +508,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline * move to @nativescript-community/https ([5c8d5c8](https://github.com/farfromrefug/nativescript-https/commit/5c8d5c8c4e5e7d50a0312cf978638b6068398025)) * multi formdata support ([c1dff6d](https://github.com/farfromrefug/nativescript-https/commit/c1dff6d27bcad54fb4f7aa03180a73696fc17ce2)) - - # 2.1.0 (2020-04-07) - - # 2.0.0 (2020-03-30) - - # 1.3.0 (2020-02-13) - - ## 1.2.2 (2019-10-16) - - # 1.2.0 (2019-10-06) diff --git a/README.md b/README.md index 5df82d4..a10faaa 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,103 @@ -# @nativescript-community/https - -[![NPM version][npm-image]][npm-url] -[![Downloads][downloads-image]][npm-url] -[![TotalDownloads][total-downloads-image]][npm-url] -[![Twitter Follow][twitter-image]][twitter-url] - -[build-status]: https://travis-ci.org/nativescript-community/https.svg?branch=master -[build-url]: https://travis-ci.org/nativescript-community/https -[npm-image]: http://img.shields.io/npm/v/@nativescript-community/https.svg -[npm-url]: https://npmjs.org/package/@nativescript-community/https -[downloads-image]: http://img.shields.io/npm/dm/@nativescript-community/https.svg -[total-downloads-image]: http://img.shields.io/npm/dt/@nativescript-community/https.svg?label=total%20downloads -[twitter-image]: https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social&label=Follow%20me -[twitter-url]: https://twitter.com/eddyverbruggen + + +

@nativescript-community/https

+

+ Downloads per month +NPM Version +

+ +

+ Nativescript plugin for https requests
+ +

+ +
+ + + +[](#table-of-contents) + + +[](#table-of-contents) + +## Table of Contents + + * [Installation](#installation) + * [A drop-in replacement for the [default http module](https://docs.nativescript.org/cookbook/http).](#a-drop-in-replacement-for-the-default-http-modulehttpsdocsnativescriptorgcookbookhttp) + * [Features](#features) + * [FAQ](#faq) + * [Installation](#installation-1) + * [Examples](#examples) + * [Hitting an API using `GET` method](#hitting-an-api-using-get-method) + * [Configuration](#configuration) + * [Installing your SSL certificate](#installing-your-ssl-certificate) + * [Enabling SSL pinning](#enabling-ssl-pinning) + * [Disabling SSL pinning](#disabling-ssl-pinning) + * [useLegacy](#uselegacy) + * [Cookie](#cookie) + * [Enabling Cache](#enabling-cache) + * [Multipart form data](#multipart-form-data) + * [Options](#options) + * [Webpack / bundling](#webpack--bundling) + * [`iOS` Troubleshooting](#ios-troubleshooting) + * [`Android` troubleshooting](#android-troubleshooting) +* [Thanks](#thanks) + * [Examples:](#examples-1) + * [Demos and Development](#demos-and-development) + * [Repo Setup](#repo-setup) + * [Build](#build) + * [Demos](#demos) + * [Contributing](#contributing) + * [Update repo ](#update-repo-) + * [Update readme ](#update-readme-) + * [Update doc ](#update-doc-) + * [Publish](#publish) + * [modifying submodules](#modifying-submodules) + * [Questions](#questions) + + +[](#installation) + + +[](#installation) + +## Installation +Run the following command from the root of your project: -### The definitive way to hit HTTP based APIs in Nativescript. +`ns plugin add @nativescript-community/https` Easily integrate the most reliable native networking libraries with the latest and greatest HTTPS security features. +> Android: version 4.x using okhttp 4.x changing minSDKVersion to 21! If lower needed stick to 3.x + > Plugin version 2.0.0 bumps `AFNetworking` on iOS to [4.0.0](https://github.com/AFNetworking/AFNetworking/releases/tag/4.0.0) which no longer relies on `UIWebView`. Make sure to run `pod repo update` to get the latest `AFNetworking` pod on your development machine. -#### A drop-in replacement for the [default http module](https://docs.nativescript.org/cookbook/http#get-response-status-code). +#### A drop-in replacement for the [default http module](https://docs.nativescript.org/cookbook/http). + +[](#features) + + +[](#features) + ## Features - Modern TLS & SSL security features @@ -34,6 +110,12 @@ Easily integrate the most reliable native networking libraries with the latest a - Cache - Basic Cookie support + +[](#faq) + + +[](#faq) + ## FAQ > What the flip is SSL pinning and all this security mumbo jumbo? @@ -44,33 +126,25 @@ Easily integrate the most reliable native networking libraries with the latest a **No.** This plugin works out of the box without any security configurations needed. Either way you'll still benefit from all the features listed above. -## Demo - -```shell -git clone https://github.com/nativescript-community/https -cd https -npm run demo.ios -npm run demo.android -``` + +[](#installation) + + +[](#installation) + ## Installation -#### Add `tns-platform-declarations` for Android and iOS to your `references.d.ts`! - -```typescript -/// -/// -``` - -We also recommend adding `"skipLibCheck": true,` to your `tsconfig.json`. -More information on that can be found [here](https://github.com/NativeScript/NativeScript/tree/master/tns-platform-declarations). - -Install the plugin: - ```bash tns plugin add @nativescript-community/https ``` + +[](#examples) + + +[](#examples) + ## Examples ### Hitting an API using `GET` method @@ -90,6 +164,12 @@ Https.request({ }); ``` + +[](#configuration) + + +[](#configuration) + ## Configuration ### Installing your SSL certificate @@ -193,11 +273,23 @@ export interface HttpsRequestOptions extends HTTPOptions { | `cachePolicy?: 'noCache' | 'onlyCache' | 'ignoreCache'` | Set the cache policy to use with that request. This only works with GET requests for now. | | `onProgress?: (current: number, total: number) => void` | [IOS only] Set the progress callback. | + +[](#webpack--bundling) + + +[](#webpack--bundling) + ## Webpack / bundling Since you're probably shipping a certificate with your app (like [our demo does](https://github.com/nativescript-community/https/tree/master/demo/app/assets)), make sure it's bundled by Webpack as well. You can do this by [adding the certificate(s) with the `CopyWebpackPlugin`](https://github.com/nativescript-community/https/blob/a5c841c0af7ff6d9994fa23f7fba0df0514c58f1/demo/webpack.config.js#L240). + +[](#ios-troubleshooting) + + +[](#ios-troubleshooting) + ## `iOS` Troubleshooting > ### Please educate yourself on iOS's [App Transport Security](https://github.com/codepath/ios_guides/wiki/App-Transport-Security) before starting beef! @@ -215,15 +307,239 @@ You can bypass this behavior by adding the following to your projects `Info.plis > This plugin **does not** add `NSAllowsArbitraryLoads` to your projects `Info.plist` for you. + +[](#android-troubleshooting) + + +[](#android-troubleshooting) + ## `Android` troubleshooting -If you app crashes with a message that it's doing too much networkin on the main thread, +If you app crashes with a message that it's doing too much networking on the main thread, then pass the option `allowLargeResponse` with value `true` to the `request` function. + +[](#thanks) + + +[](#thanks) + # Thanks | Who | Why | | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [Robert Laverty](https://github.com/roblav96) | For creating and maintaining this plugin for a long time, before transfering it to me, with the help of Jeff Whelpley of [GetHuman](https://github.com/gethuman). | +| [Robert Laverty](https://github.com/roblav96) | For creating and maintaining this plugin for a long time | +| [Jeff Whelple](https://github.com/gethuman) | For contributing | +| [Eddy Verbruggen](https://github.com/EddyVerbruggen) | For maintaining this before it got transferred | | [AFNetworking](https://github.com/AFNetworking) | [AFNetworking](https://github.com/AFNetworking/AFNetworking) A delightful networking framework for iOS, OS X, watchOS, and tvOS. | | [Square](http://square.github.io/) | [okhttp](https://github.com/square/okhttp) An HTTP+HTTP/2 client for Android and Java applications. | + +### Examples: + +- [Basic](demo-snippets/vue/Basic.vue) + - A basic example + + +[](#demos-and-development) + + +[](#demos-and-development) + +## Demos and Development + + +### Repo Setup + +The repo uses submodules. If you did not clone with ` --recursive` then you need to call +``` +git submodule update --init +``` + +The package manager used to install and link dependencies must be `pnpm` or `yarn`. `npm` wont work. + +To develop and test: +if you use `yarn` then run `yarn` +if you use `pnpm` then run `pnpm i` + +**Interactive Menu:** + +To start the interactive menu, run `npm start` (or `yarn start` or `pnpm start`). This will list all of the commonly used scripts. + +### Build + +```bash +npm run build.all +``` +WARNING: it seems `yarn build.all` wont always work (not finding binaries in `node_modules/.bin`) which is why the doc explicitly uses `npm run` + +### Demos + +```bash +npm run demo.[ng|react|svelte|vue].[ios|android] + +npm run demo.svelte.ios # Example +``` + +Demo setup is a bit special in the sense that if you want to modify/add demos you dont work directly in `demo-[ng|react|svelte|vue]` +Instead you work in `demo-snippets/[ng|react|svelte|vue]` +You can start from the `install.ts` of each flavor to see how to register new demos + + +[](#contributing) + + +[](#contributing) + +## Contributing + +### Update repo + +You can update the repo files quite easily + +First update the submodules + +```bash +npm run update +``` + +Then commit the changes +Then update common files + +```bash +npm run sync +``` +Then you can run `yarn|pnpm`, commit changed files if any + +### Update readme +```bash +npm run readme +``` + +### Update doc +```bash +npm run doc +``` + +### Publish + +The publishing is completely handled by `lerna` (you can add `-- --bump major` to force a major release) +Simply run +```shell +npm run publish +``` + +### modifying submodules + +The repo uses https:// for submodules which means you won't be able to push directly into the submodules. +One easy solution is t modify `~/.gitconfig` and add +``` +[url "ssh://git@github.com/"] + pushInsteadOf = https://github.com/ +``` + + +[](#questions) + + +[](#questions) + +## Questions + +If you have any questions/issues/comments please feel free to create an issue or start a conversation in the [NativeScript Community Discord](https://nativescript.org/discord). + +[](#demos-and-development) + +## Demos and Development + + +### Repo Setup + +The repo uses submodules. If you did not clone with ` --recursive` then you need to call +``` +git submodule update --init +``` + +The package manager used to install and link dependencies must be `pnpm` or `yarn`. `npm` wont work. + +To develop and test: +if you use `yarn` then run `yarn` +if you use `pnpm` then run `pnpm i` + +**Interactive Menu:** + +To start the interactive menu, run `npm start` (or `yarn start` or `pnpm start`). This will list all of the commonly used scripts. + +### Build + +```bash +npm run build.all +``` +WARNING: it seems `yarn build.all` wont always work (not finding binaries in `node_modules/.bin`) which is why the doc explicitly uses `npm run` + +### Demos + +```bash +npm run demo.[ng|react|svelte|vue].[ios|android] + +npm run demo.svelte.ios # Example +``` + +Demo setup is a bit special in the sense that if you want to modify/add demos you dont work directly in `demo-[ng|react|svelte|vue]` +Instead you work in `demo-snippets/[ng|react|svelte|vue]` +You can start from the `install.ts` of each flavor to see how to register new demos + + +[](#contributing) + +## Contributing + +### Update repo + +You can update the repo files quite easily + +First update the submodules + +```bash +npm run update +``` + +Then commit the changes +Then update common files + +```bash +npm run sync +``` +Then you can run `yarn|pnpm`, commit changed files if any + +### Update readme +```bash +npm run readme +``` + +### Update doc +```bash +npm run doc +``` + +### Publish + +The publishing is completely handled by `lerna` (you can add `-- --bump major` to force a major release) +Simply run +```shell +npm run publish +``` + +### modifying submodules + +The repo uses https:// for submodules which means you won't be able to push directly into the submodules. +One easy solution is t modify `~/.gitconfig` and add +``` +[url "ssh://git@github.com/"] + pushInsteadOf = https://github.com/ +``` + +[](#questions) + +## Questions + +If you have any questions/issues/comments please feel free to create an issue or start a conversation in the [NativeScript Community Discord](https://nativescript.org/discord). \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..6db1ce0 --- /dev/null +++ b/config.json @@ -0,0 +1,7 @@ +{ + "readme": true, + "angular": true, + "demos": [ + "vue" + ] +} \ No newline at end of file diff --git a/demo/app/assets/httpbin.org.cer b/demo-snippets/assets/httpbin.org.cer similarity index 100% rename from demo/app/assets/httpbin.org.cer rename to demo-snippets/assets/httpbin.org.cer diff --git a/demo/app/assets/httpbin.org.expired.cer b/demo-snippets/assets/httpbin.org.expired.cer similarity index 100% rename from demo/app/assets/httpbin.org.expired.cer rename to demo-snippets/assets/httpbin.org.expired.cer diff --git a/demo-snippets/package.json b/demo-snippets/package.json new file mode 100644 index 0000000..384c7ba --- /dev/null +++ b/demo-snippets/package.json @@ -0,0 +1,14 @@ +{ + "name": "@nativescript-community/template-snippet", + "private": true, + "version": "0.0.1", + "dependencies": { + "@nativescript-community/https": "4.0.11" + }, + "nativescript": { + "platforms": { + "android": "2.3.0", + "ios": "2.3.0" + } + } +} diff --git a/demo-snippets/vue/Basic.vue b/demo-snippets/vue/Basic.vue new file mode 100644 index 0000000..7f50af3 --- /dev/null +++ b/demo-snippets/vue/Basic.vue @@ -0,0 +1,216 @@ + + + + + diff --git a/demo-snippets/vue/install.ts b/demo-snippets/vue/install.ts new file mode 100644 index 0000000..3d1b976 --- /dev/null +++ b/demo-snippets/vue/install.ts @@ -0,0 +1,18 @@ +import Vue from 'nativescript-vue'; +import Basic from './Basic.vue'; +import * as Https from '@nativescript-community/https'; +import * as fs from '@nativescript/core/file-system'; + +const folder = fs.knownFolders.temp().getFolder('cache'); +const diskLocation = folder.path; +const cacheSize = 10 * 1024 * 1024; +Https.setCache({ + // forceCache: true, + diskLocation, + diskSize: cacheSize, + memorySize: cacheSize +}); + +export function installPlugin() {} + +export const demos = [{ name: 'Basic', path: 'basic', component: Basic }]; diff --git a/demo-vue b/demo-vue new file mode 160000 index 0000000..ef6f78f --- /dev/null +++ b/demo-vue @@ -0,0 +1 @@ +Subproject commit ef6f78fe04b61ea05dca21c61a6c2515b1b46b7e diff --git a/demo/app/App_Resources/Android/app.gradle b/demo/app/App_Resources/Android/app.gradle deleted file mode 100644 index 8c5b9f8..0000000 --- a/demo/app/App_Resources/Android/app.gradle +++ /dev/null @@ -1,9 +0,0 @@ -android { - defaultConfig { - generatedDensities = [] - applicationId = "org.nativescript.plugindemo.https" - } - aaptOptions { - additionalParameters "--no-version-vectors" - } -} diff --git a/demo/app/App_Resources/Android/src/main/AndroidManifest.xml b/demo/app/App_Resources/Android/src/main/AndroidManifest.xml deleted file mode 100644 index 9db8321..0000000 --- a/demo/app/App_Resources/Android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png deleted file mode 100644 index eb381c2..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png deleted file mode 100644 index 1034356..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png deleted file mode 100644 index 5218f4c..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png deleted file mode 100644 index 748b2ad..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png deleted file mode 100644 index ddfc17a..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png deleted file mode 100644 index b9e102a..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png deleted file mode 100644 index efeaf29..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png deleted file mode 100644 index 486e410..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png deleted file mode 100644 index 6263387..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml b/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml deleted file mode 100644 index ada77f9..0000000 --- a/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png deleted file mode 100644 index 612bbd0..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png deleted file mode 100644 index f291882..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png deleted file mode 100644 index ad8ee2f..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png deleted file mode 100644 index 0fa88e2..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png deleted file mode 100644 index 4f69cb2..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png deleted file mode 100644 index 6683278..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png deleted file mode 100644 index c650f64..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png deleted file mode 100644 index 50887a8..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png deleted file mode 100644 index fa6331c..0000000 Binary files a/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png and /dev/null differ diff --git a/demo/app/App_Resources/Android/src/main/res/values-v21/colors.xml b/demo/app/App_Resources/Android/src/main/res/values-v21/colors.xml deleted file mode 100644 index a64641a..0000000 --- a/demo/app/App_Resources/Android/src/main/res/values-v21/colors.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - #3d5afe - \ No newline at end of file diff --git a/demo/app/App_Resources/Android/src/main/res/values-v21/styles.xml b/demo/app/App_Resources/Android/src/main/res/values-v21/styles.xml deleted file mode 100644 index dac8727..0000000 --- a/demo/app/App_Resources/Android/src/main/res/values-v21/styles.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/demo/app/App_Resources/Android/src/main/res/values/colors.xml b/demo/app/App_Resources/Android/src/main/res/values/colors.xml deleted file mode 100644 index 74ad882..0000000 --- a/demo/app/App_Resources/Android/src/main/res/values/colors.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - #F5F5F5 - #757575 - #33B5E5 - #272734 - \ No newline at end of file diff --git a/demo/app/App_Resources/Android/src/main/res/values/styles.xml b/demo/app/App_Resources/Android/src/main/res/values/styles.xml deleted file mode 100644 index 1e8c7f2..0000000 --- a/demo/app/App_Resources/Android/src/main/res/values/styles.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 5f53593..0000000 --- a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "images" : [ - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "icon-29.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "icon-29@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "icon-29@3x.png", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "icon-40@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "icon-40@3x.png", - "scale" : "3x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "icon-57.png", - "scale" : "1x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "icon-57@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "icon-60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "icon-60@3x.png", - "scale" : "3x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "icon-29.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "icon-29@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "icon-40.png", - "scale" : "1x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "icon-40@2x.png", - "scale" : "2x" - }, - { - "size" : "50x50", - "idiom" : "ipad", - "filename" : "icon-50.png", - "scale" : "1x" - }, - { - "size" : "50x50", - "idiom" : "ipad", - "filename" : "icon-50@2x.png", - "scale" : "2x" - }, - { - "size" : "72x72", - "idiom" : "ipad", - "filename" : "icon-72.png", - "scale" : "1x" - }, - { - "size" : "72x72", - "idiom" : "ipad", - "filename" : "icon-72@2x.png", - "scale" : "2x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "icon-76.png", - "scale" : "1x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "icon-76@2x.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "icon-83.5@2x.png", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png deleted file mode 100644 index 9e15af0..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png deleted file mode 100644 index 7b9e555..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png deleted file mode 100644 index 76f61ec..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png deleted file mode 100644 index 15b06db..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png deleted file mode 100644 index 585065f..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png deleted file mode 100644 index a450c42..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png deleted file mode 100644 index 4a62478..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png deleted file mode 100644 index 01ff7c1..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png deleted file mode 100644 index beea819..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png deleted file mode 100644 index c3dc7b0..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png deleted file mode 100644 index 457b6d9..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png deleted file mode 100644 index fa5a6ac..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png deleted file mode 100644 index 556bdd6..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png deleted file mode 100644 index 4f69cb2..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png deleted file mode 100644 index 94abcf7..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png deleted file mode 100644 index 2e71dd3..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png deleted file mode 100644 index 4abc9ec..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/Contents.json b/demo/app/App_Resources/iOS/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164..0000000 --- a/demo/app/App_Resources/iOS/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index 4414bad..0000000 --- a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "images" : [ - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "736h", - "filename" : "Default-736h@3x.png", - "minimum-system-version" : "8.0", - "orientation" : "portrait", - "scale" : "3x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "736h", - "filename" : "Default-Landscape@3x.png", - "minimum-system-version" : "8.0", - "orientation" : "landscape", - "scale" : "3x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "667h", - "filename" : "Default-667h@2x.png", - "minimum-system-version" : "8.0", - "orientation" : "portrait", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default@2x.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "retina4", - "filename" : "Default-568h@2x.png", - "minimum-system-version" : "7.0", - "orientation" : "portrait", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "filename" : "Default-Portrait.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "filename" : "Default-Landscape.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "filename" : "Default-Portrait@2x.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "filename" : "Default-Landscape@2x.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default.png", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default@2x.png", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default-568h@2x.png", - "extent" : "full-screen", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "filename" : "Default-Portrait.png", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "filename" : "Default-Landscape.png", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "filename" : "Default-Portrait@2x.png", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "filename" : "Default-Landscape@2x.png", - "extent" : "full-screen", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png deleted file mode 100644 index d7f17fc..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png deleted file mode 100644 index b884154..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png deleted file mode 100644 index faab4b6..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png deleted file mode 100644 index 3365ba3..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png deleted file mode 100644 index a44945c..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png deleted file mode 100644 index e6dca62..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png deleted file mode 100644 index 1a50079..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png deleted file mode 100644 index 73d8b92..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png deleted file mode 100644 index 9f1f6ce..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png deleted file mode 100644 index 514fc5c..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json deleted file mode 100644 index 4f4e9c5..0000000 --- a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "LaunchScreen-AspectFill.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "LaunchScreen-AspectFill@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png deleted file mode 100644 index c293f9c..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png deleted file mode 100644 index 233693a..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json deleted file mode 100644 index 23c0ffd..0000000 --- a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "LaunchScreen-Center.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "LaunchScreen-Center@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png deleted file mode 100644 index a5a775a..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png b/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png deleted file mode 100644 index 154c193..0000000 Binary files a/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png and /dev/null differ diff --git a/demo/app/App_Resources/iOS/Info.plist b/demo/app/App_Resources/iOS/Info.plist deleted file mode 100644 index ea3e3ea..0000000 --- a/demo/app/App_Resources/iOS/Info.plist +++ /dev/null @@ -1,47 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - ${PRODUCT_NAME} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIRequiresFullScreen - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/demo/app/App_Resources/iOS/LaunchScreen.storyboard b/demo/app/App_Resources/iOS/LaunchScreen.storyboard deleted file mode 100644 index 2ad9471..0000000 --- a/demo/app/App_Resources/iOS/LaunchScreen.storyboard +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/app/App_Resources/iOS/build.xcconfig b/demo/app/App_Resources/iOS/build.xcconfig deleted file mode 100644 index a777ac8..0000000 --- a/demo/app/App_Resources/iOS/build.xcconfig +++ /dev/null @@ -1,7 +0,0 @@ -// You can add custom settings here -// for example you can uncomment the following line to force distribution code signing -// CODE_SIGN_IDENTITY = iPhone Distribution -ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; -ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - -DEVELOPMENT_TEAM = 8Q5F6M3TNS diff --git a/demo/app/app.css b/demo/app/app.css deleted file mode 100644 index 5f28270..0000000 --- a/demo/app/app.css +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/demo/app/app.ts b/demo/app/app.ts deleted file mode 100644 index deb50cb..0000000 --- a/demo/app/app.ts +++ /dev/null @@ -1,8 +0,0 @@ -import * as application from '@nativescript/core/application'; -import { knownFolders, path } from '@nativescript/core/file-system'; -import * as Https from '@nativescript-community/https'; -Https.setCache({ - diskLocation: path.join(knownFolders.documents().path, 'httpcache'), - diskSize: 10 * 1024 * 1024, // 10 MiB -}); -application.run({ moduleName: 'main-page' }); diff --git a/demo/app/main-page.ts b/demo/app/main-page.ts deleted file mode 100644 index 6c393cc..0000000 --- a/demo/app/main-page.ts +++ /dev/null @@ -1,159 +0,0 @@ -import * as Https from '@nativescript-community/https'; -import * as Observable from '@nativescript/core/data/observable'; -import * as fs from '@nativescript/core/file-system'; -import * as dialogs from '@nativescript/core/ui/dialogs'; -import * as Page from '@nativescript/core/ui/page'; - -let page; -let viewModel; -export function pageLoaded(args: Page.NavigatedData) { - page = args.object as Page.Page; - viewModel = Observable.fromObject({ - enabled: false, - progress: 0, - currentRequest: null, - }); - page.bindingContext = viewModel; -} - -function createRequest(url: string, options?: Partial) { - return Https.createRequest({ - useLegacy: true, - url, - method: 'GET', - timeout: 1, - ...options, - }); -} - -function onError(error) { - console.error('Https.request error', error, error.stack); - dialogs.alert(error.toString()); - page.bindingContext.currentRequest = null; - page.bindingContext.progress = 0; - return Promise.reject(error); -} -function getRequest(url: string, options?: Partial) { - return Https.request({ - useLegacy: true, - url, - method: 'GET', - timeout: 1, - ...options, - }) - .then((response) => { - page.bindingContext.currentRequest = null; - page.bindingContext.progress = 0; - console.log('Https.request response', response); - return response; - }) - .catch(onError); -} - -function postRequest(url: string, options?: Partial) { - return Https.request({ - useLegacy: true, - url, - method: 'POST', - ...options, - }) - .then((response) => console.log('Https.request response', response)) - .catch((error) => { - console.error('Https.request error', error); - dialogs.alert(error); - }); -} - -export function postHttpbin() { - postRequest('https://httpbin.org/post', { - body: { foo: 'bar', baz: undefined, plaz: null }, - }); -} - -export function postHttpbinWithUTF8() { - Https.request({ - url: 'https://httpbin.org/post', - method: 'POST', - body: { foo: 'bar', baz: undefined, plaz: null }, - headers: { - 'Content-Type': 'application/json; charset=utf-8', - 'X-testing': 'ok', - }, - }).catch((error) => { - console.error('Https.request error', error); - dialogs.alert(error); - }); -} - -export function getHttpbin() { - getRequest('https://httpbin.org/get', { - headers: { - // 'Cache-Control': 'public, only-if-cached, max-stale=' +(60 * 60 * 24 * 7), - 'Cache-Control': 'max-age=50000', - } - }); -} - -export function cancelCurrentRequest() { - if (page.bindingContext.currentRequest) { - page.bindingContext.currentRequest.cancel(); - } -} -export function getBigFile() { - const request = createRequest('http://ipv4.download.thinkbroadband.com/200MB.zip', { - onProgress: (current, total) => { - page.bindingContext.progress = (current / total) * 100; - }, - }); - page.bindingContext.currentRequest = request; - - return new Promise((resolve, reject) => { - request.run(resolve, reject); - }) - .then((response) => { - console.log('did get response'); - const dir = fs.knownFolders.temp().getFile('200MB.zip'); - return (response.content as Https.HttpsResponseLegacy).toFile(dir.path); - // console.log("did get response done"); - }) - .then(() => { - page.bindingContext.currentPromise = null; - console.log('did get response done'); - }) - .catch(onError); -} - -export function getHttpbinLargeResponse() { - getRequest('https://httpbin.org/bytes/100000'); -} - -export function getMockbin() { - getRequest('https://mockbin.com/request'); -} - -export function get404() { - getRequest('https://mockbin.com/reque2st'); -} - -export function enableSSLPinning(args: Observable.EventData) { - const dir = fs.knownFolders.currentApp().getFolder('assets'); - const certificate = dir.getFile('httpbin.org.cer').path; - Https.enableSSLPinning({ - host: 'httpbin.org', - commonName: 'httpbin.org', - certificate, - }); - console.log('enabled'); -} - -export function enableSSLPinningExpired(args: Observable.EventData) { - const dir = fs.knownFolders.currentApp().getFolder('assets'); - const certificate = dir.getFile('httpbin.org.expired.cer').path; - Https.enableSSLPinning({ host: 'httpbin.org', certificate }); - console.log('enabled'); -} - -export function disableSSLPinning(args: Observable.EventData) { - Https.disableSSLPinning(); - console.log('disabled'); -} diff --git a/demo/app/main-page.xml b/demo/app/main-page.xml deleted file mode 100644 index d6f4e68..0000000 --- a/demo/app/main-page.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - -