Skip to content

Commit

Permalink
Merge pull request #22 from ionic-team/dev
Browse files Browse the repository at this point in the history
Merge `dev` into `main` for `1.0.0` release
OS-martacarlos authored Aug 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents a7aa18e + 94bba8a commit 67f1aff
Showing 69 changed files with 2,675 additions and 27,326 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

4 changes: 1 addition & 3 deletions .github/actions/setup-tools/action.yml
Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@ runs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
shell: bash
run: npm install
run: npm i
6 changes: 3 additions & 3 deletions .github/workflows/basic-tests.yml
Original file line number Diff line number Diff line change
@@ -8,18 +8,18 @@ on:

jobs:
setup:
uses: ./.github/workflows/reusable/setup.yml
uses: ./.github/workflows/reusable_setup.yml
secrets:
CAP_GH_RELEASE_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }}

lint-test:
needs: 'setup'
uses: ./.github/workflows/reusable/lint.yml
uses: ./.github/workflows/reusable_lint.yml
secrets:
CAP_GH_RELEASE_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }}

build-packages:
needs: 'setup'
uses: ./.github/workflows/reusable/build.yml
uses: ./.github/workflows/reusable_build.yml
secrets:
CAP_GH_RELEASE_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Release"

on:
push:
branches:
- dev
- next
# - main
workflow_dispatch:

jobs:
setup:
uses: ./.github/workflows/reusable_setup.yml
secrets:
THE_GH_RELEASE_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }}

lint-test:
needs: 'setup'
uses: ./.github/workflows/reusable_lint.yml
secrets:
THE_GH_RELEASE_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }}

build-packages:
needs: 'setup'
uses: ./.github/workflows/reusable_build.yml
secrets:
THE_GH_RELEASE_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }}

release:
needs: ['setup','lint-test','build-packages']
runs-on: 'ubuntu-22.04'
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.CAP_GH_RELEASE_TOKEN }}
- name: 'Setup Tools'
uses: ./.github/actions/setup-tools
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: npx semantic-release
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build
dist
example-app
24 changes: 24 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
excluded:
- 'node_modules'
- 'ios/Pods'
- 'example-app'

opt_in_rules:
- 'implicitly_unwrapped_optional'
- 'file_name_no_space'
- 'force_unwrapping'
- 'function_default_parameter_at_end'
- 'lower_acl_than_parent'
- 'modifier_order'
- 'overridden_super_call'
- 'unowned_variable_capture'
- 'unused_import'

line_length:
warning: 250
error: 350
ignores_function_declarations: true
ignores_comments: true
ignores_interpolated_strings: true
ignores_urls: true

101 changes: 101 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# 1.0.0-dev.1 (2024-08-21)


### Bug Fixes

* android dep ref ([caaaf2c](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/caaaf2c61c424eaa6d82628728b2a17fa8a04133))
* capacitor bridge ([5021349](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/50213495b200c58857d0b66ac38f6828dda91ddb))
* ci release process ([38687ed](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/38687ed61d6ce624128c288dbc1c3ca25d2d7c7b))
* decodeIfPresent for optional param ([29d4356](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/29d4356e813068943b8bc97cfbddbd4fb0289eef))
* more ci fixes ([a20f93c](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/a20f93c86c24be985e7bef470c9ca0d1105ece18))
* podspec not published ([d031b43](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/d031b435001c7420245171815e8f281467786fc3))
* use correct parameter for openInWebView in definitions.ts ([94e36cd](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/94e36cd000d74b486d7f7c02e38edf5176b0d882))


### Features

* add documentation for isSchemeValid function ([2f39e9e](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/2f39e9eb1e4143d8ec96a8ba4075a5bab5a2100e))
* add external browser options to sample app ([6f621f6](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/6f621f6f75c1ff304d06c6426d51e2f7e32ca7d5))
* add webview customizations ([9ba1d27](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/9ba1d27ec6212f31f2bde39d47d14d4e5fbe6a5f))
* **android:** implement open with external browser ([150404b](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/150404bf0c232ead5da6a37486da291343d92172))
* check if url scheme is valid before trying to open it ([119d4d0](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/119d4d01863026e022471b89c6e42a439c453ebf))
* implement browserPageLoaded and browserFinished events ([e70ab0c](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/e70ab0c708e770e3ca773d0a20c44f0b507d32ef))
* implement event listeners for CustomTabs ([00071db](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/00071db7ac5d7052a61c3a11e78ab8df6bf64dbb))
* implement openInWebView for Android ([70ad5e5](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/70ad5e50ad18a144238d5e13c4022f61ba79915d))
* **ios:** add openInExternalBrowser ([#1](https://github.com/ionic-team/capacitor-os-inappbrowser/issues/1)) ([17a7c59](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/17a7c594c5d8fb61027a9ebe1955499a0edbf683))
* **ios:** add openInSystemBrowser ([#3](https://github.com/ionic-team/capacitor-os-inappbrowser/issues/3)) ([fa5b065](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/fa5b0653bb38648a14165ac996852cefe99ec4ca))
* **ios:** add openinwebview ([#5](https://github.com/ionic-team/capacitor-os-inappbrowser/issues/5)) ([1fc3485](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/1fc3485fa3571f9152040a73672d98120be4626a))
* **ios:** close ([#8](https://github.com/ionic-team/capacitor-os-inappbrowser/issues/8)) ([075cb45](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/075cb4574d7a44cfd66ac6602193fa579f98b67f))
* **ios:** fix error code and messages ([#18](https://github.com/ionic-team/capacitor-os-inappbrowser/issues/18)) ([2508dec](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/2508decd90dab0ebd9381992ed15295ac53669c5))
* **ios:** webview error page ([0677a20](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/0677a20680cc49d7a19cb9212ff94cfed3c1782e))
* swap xcframework for cocoapod + update android aar ([521ce27](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/521ce2784c0e51ba2699cb8c468f3b7677ea9393))
* update android lib ([816866c](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/816866c489929fba83e623d57ae547a33bf6723e))
* update capacitor bridge with new version of OSInAppBrowserLib-Android ([65a1e1a](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/65a1e1ac299e9455a685e2b83d15afbd9b3fecab))
* update dependency to OSInAppBrowserLib-Android library ([503eb86](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/503eb86a300da008620fa93722b8524249794622))
* update xcframework ([b4d26c8](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/b4d26c84b3697c1cbfb62809e1a8cee0c394664d))

# [1.0.0-dev.6](https://github.com/ionic-team/capacitor-os-inappbrowser/compare/v1.0.0-dev.5...v1.0.0-dev.6) (2024-08-21)


### Features

* swap xcframework for cocoapod + update android aar ([ea7f639](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/ea7f639dfd745138bacc267f5e164ae2e5bbe3ba))

# [1.0.0-dev.5](https://github.com/ionic-team/capacitor-os-inappbrowser/compare/v1.0.0-dev.4...v1.0.0-dev.5) (2024-08-15)


### Bug Fixes

* podspec not published ([17d1417](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/17d1417562148590ac1db4b97bfe48662f8c341e))

# [1.0.0-dev.4](https://github.com/ionic-team/capacitor-os-inappbrowser/compare/v1.0.0-dev.3...v1.0.0-dev.4) (2024-08-14)


### Bug Fixes

* android dep ref ([f02d5e1](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/f02d5e14565eeed9c078e22f503776c032dd1359))

# [1.0.0-dev.3](https://github.com/ionic-team/capacitor-os-inappbrowser/compare/v1.0.0-dev.2...v1.0.0-dev.3) (2024-07-25)


### Bug Fixes

* more ci fixes ([d39fb72](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/d39fb729b3a005f472cc82efc566b516881ad8de))

# [1.0.0-dev.2](https://github.com/ionic-team/capacitor-os-inappbrowser/compare/v1.0.0-dev.1...v1.0.0-dev.2) (2024-07-25)


### Bug Fixes

* ci release process ([effccbd](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/effccbd917a4e8077214efdc8ccc10d23d5e519f))

# 1.0.0-dev.1 (2024-07-25)


### Bug Fixes

* capacitor bridge ([5021349](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/50213495b200c58857d0b66ac38f6828dda91ddb))
* decodeIfPresent for optional param ([29d4356](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/29d4356e813068943b8bc97cfbddbd4fb0289eef))
* use correct parameter for openInWebView in definitions.ts ([94e36cd](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/94e36cd000d74b486d7f7c02e38edf5176b0d882))


### Features

* add documentation for isSchemeValid function ([2f39e9e](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/2f39e9eb1e4143d8ec96a8ba4075a5bab5a2100e))
* add external browser options to sample app ([6f621f6](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/6f621f6f75c1ff304d06c6426d51e2f7e32ca7d5))
* add webview customizations ([9ba1d27](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/9ba1d27ec6212f31f2bde39d47d14d4e5fbe6a5f))
* **android:** implement open with external browser ([150404b](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/150404bf0c232ead5da6a37486da291343d92172))
* check if url scheme is valid before trying to open it ([119d4d0](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/119d4d01863026e022471b89c6e42a439c453ebf))
* implement browserPageLoaded and browserFinished events ([e70ab0c](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/e70ab0c708e770e3ca773d0a20c44f0b507d32ef))
* implement event listeners for CustomTabs ([00071db](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/00071db7ac5d7052a61c3a11e78ab8df6bf64dbb))
* implement openInWebView for Android ([70ad5e5](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/70ad5e50ad18a144238d5e13c4022f61ba79915d))
* **ios:** add openInExternalBrowser ([#1](https://github.com/ionic-team/capacitor-os-inappbrowser/issues/1)) ([17a7c59](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/17a7c594c5d8fb61027a9ebe1955499a0edbf683))
* **ios:** add openInSystemBrowser ([#3](https://github.com/ionic-team/capacitor-os-inappbrowser/issues/3)) ([fa5b065](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/fa5b0653bb38648a14165ac996852cefe99ec4ca))
* **ios:** add openinwebview ([#5](https://github.com/ionic-team/capacitor-os-inappbrowser/issues/5)) ([1fc3485](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/1fc3485fa3571f9152040a73672d98120be4626a))
* **ios:** close ([#8](https://github.com/ionic-team/capacitor-os-inappbrowser/issues/8)) ([075cb45](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/075cb4574d7a44cfd66ac6602193fa579f98b67f))
* **ios:** fix error code and messages ([#18](https://github.com/ionic-team/capacitor-os-inappbrowser/issues/18)) ([2508dec](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/2508decd90dab0ebd9381992ed15295ac53669c5))
* **ios:** webview error page ([0677a20](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/0677a20680cc49d7a19cb9212ff94cfed3c1782e))
* update android lib ([816866c](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/816866c489929fba83e623d57ae547a33bf6723e))
* update capacitor bridge with new version of OSInAppBrowserLib-Android ([65a1e1a](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/65a1e1ac299e9455a685e2b83d15afbd9b3fecab))
* update dependency to OSInAppBrowserLib-Android library ([503eb86](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/503eb86a300da008620fa93722b8524249794622))
* update xcframework ([b4d26c8](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/b4d26c84b3697c1cbfb62809e1a8cee0c394664d))
17 changes: 13 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -41,12 +41,21 @@ Check formatting and code quality, autoformat/autofix if possible.
This template is integrated with ESLint, Prettier, and SwiftLint. Using these tools is completely optional, but the [Capacitor Community](https://github.com/capacitor-community/) strives to have consistent code style and structure for easier cooperation.
## Commits/PR's

Commits and PR's should use the `conventional-commits` format so the release process can version and create changelog correctly.
## Publishing
There is a `prepublishOnly` hook in `package.json` which prepares the plugin before publishing, so all you need to do is run:
Publishing is automated based on the branch committed to. When a commit or merge is made to a branch a release that corresponds with the branch will be created:
| Branch Name | Build Type | NPM Tag | Example NPM Version |
|---|---|---|---|
| dev | dev | dev | @capacitor/[email protected] |
| next | next (these are betas/alphas) | next | @capacitor/[email protected] |
| main | latest | latest | @capacitor/[email protected] |
```shell
npm publish
```
Dev work should be done by creating and merging PR's into the `dev` branch until a feature set is complete enough to then merge the `dev` branch into the `next` branch where it becomes a beta/alpha tagged under `next` for testing teams to use before full release. Upon completed testing the `next` branch is merged into `main` for a full release to be made. The `main` branch should then be merged into `dev` and `next` to keep them up to date with the latest code base.

> **Note**: The [`files`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#files) array in `package.json` specifies which files get published. If you rename files/directories or add files elsewhere, you may need to update it.
Original file line number Diff line number Diff line change
@@ -3,17 +3,16 @@ require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

Pod::Spec.new do |s|
s.name = 'CapacitorOsInappbrowser'
s.name = 'CapacitorInappbrowser'
s.version = package['version']
s.summary = package['description']
s.license = package['license']
s.homepage = package['repository']['url']
s.author = package['author']
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
#s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
s.source_files = 'ios/Sources/InAppBrowserPlugin/*.{swift,h,m,c,cc,mm,cpp}'
s.vendored_frameworks = 'ios/Sources/InAppBrowserPlugin/OSInAppBrowserLib.xcframework'
s.ios.deployment_target = '13.0'
s.dependency 'OSInAppBrowserLib', spec='~> 1.0'
s.dependency 'Capacitor'
s.swift_version = '5.1'
end
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -2,11 +2,11 @@
import PackageDescription

let package = Package(
name: "CapacitorOsInappbrowser",
name: "CapacitorInappbrowser",
platforms: [.iOS(.v13)],
products: [
.library(
name: "CapacitorOsInappbrowser",
name: "CapacitorInappbrowser",
targets: ["InAppBrowserPlugin"])
],
dependencies: [
264 changes: 182 additions & 82 deletions README.md

Large diffs are not rendered by default.

25 changes: 24 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -10,6 +10,17 @@ buildscript {
repositories {
google()
mavenCentral()
maven {
url 'https://pkgs.dev.azure.com/OutSystemsRD/9e79bc5b-69b2-4476-9ca5-d67594972a52/_packaging/PublicArtifactRepository/maven/v1'
name 'Azure'
credentials {
username = "optional"
password = ""
}
content {
includeGroup "com.github.outsystems"
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.2'
@@ -48,12 +59,24 @@ android {
repositories {
google()
mavenCentral()
maven {
url 'https://pkgs.dev.azure.com/OutSystemsRD/9e79bc5b-69b2-4476-9ca5-d67594972a52/_packaging/PublicArtifactRepository/maven/v1'
name 'Azure'
credentials {
username = "optional"
password = ""
}
content {
includeGroup "com.github.outsystems"
}
}
}


dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'])
// implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':capacitor-android')
implementation "com.github.outsystems:osinappbrowser-android:1.+@aar"
implementation 'androidx.browser:browser:1.8.0'
implementation "androidx.constraintlayout:constraintlayout:2.2.0-alpha13"
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
Binary file removed android/libs/OSInAppBrowserLib-debug.aar
Binary file not shown.
54 changes: 54 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
import tseslint from '@typescript-eslint/eslint-plugin';
import tseslintparser from '@typescript-eslint/parser';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import eslintjs from '@eslint/js';
*/

const tseslint = require('@typescript-eslint/eslint-plugin');
const tseslintparser = require('@typescript-eslint/parser');
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
const eslintjs = require('@eslint/js');

module.exports = [
{
files: ['**/*.ts'],
ignores: ['node_modules', 'dist/**/*', 'build/**/*', 'example-app/**/*'],
languageOptions: {
parser: tseslintparser,
},
plugins: {
'@typescript-eslint': tseslint,
},
rules: {
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/ban-types': 'error',
'no-array-constructor': 'off',
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-duplicate-enum-values': 'error',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'no-loss-of-precision': 'off',
'@typescript-eslint/no-loss-of-precision': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/triple-slash-reference': 'error',
// https://eslint.org/docs/rules/
'no-fallthrough': 'off', // https://github.com/ionic-team/eslint-config/issues/7
'no-constant-condition': 'off',

// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/docs/rules
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': ['warn', { allowArgumentsExplicitlyTypedAsAny: true }],
},
},
eslintjs.configs.recommended,
eslintPluginPrettierRecommended,
];
2 changes: 1 addition & 1 deletion example-app/android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ dependencies {
implementation project(':capacitor-app')
implementation project(':capacitor-haptics')
implementation project(':capacitor-keyboard')
implementation project(':capacitor-os-inappbrowser')
implementation project(':capacitor-inappbrowser')
implementation project(':capacitor-status-bar')

}
11 changes: 11 additions & 0 deletions example-app/android/build.gradle
Original file line number Diff line number Diff line change
@@ -21,6 +21,17 @@ allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://pkgs.dev.azure.com/OutSystemsRD/9e79bc5b-69b2-4476-9ca5-d67594972a52/_packaging/PublicArtifactRepository/maven/v1'
name 'Azure'
credentials {
username = "optional"
password = ""
}
content {
includeGroup "com.github.outsystems"
}
}
}
}

4 changes: 2 additions & 2 deletions example-app/android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ project(':capacitor-haptics').projectDir = new File('../node_modules/@capacitor/
include ':capacitor-keyboard'
project(':capacitor-keyboard').projectDir = new File('../node_modules/@capacitor/keyboard/android')

include ':capacitor-os-inappbrowser'
project(':capacitor-os-inappbrowser').projectDir = new File('../node_modules/@capacitor/os-inappbrowser/android')
include ':capacitor-inappbrowser'
project(':capacitor-inappbrowser').projectDir = new File('../node_modules/@capacitor/inappbrowser/android')

include ':capacitor-status-bar'
project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android')
8 changes: 6 additions & 2 deletions example-app/ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -349,12 +349,13 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = EVSWK8BA55;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = io.ionic.starter;
PRODUCT_BUNDLE_IDENTIFIER = com.outsystems.rd;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 5.0;
@@ -367,14 +368,17 @@
baseConfigurationReference = AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = F898TC6427;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = io.ionic.starter;
PRODUCT_BUNDLE_IDENTIFIER = com.outsystems.rd;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
2 changes: 1 addition & 1 deletion example-app/ios/App/App/Info.plist
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>example-app</string>
<string>example-app</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
2 changes: 1 addition & 1 deletion example-app/ios/App/Podfile
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ def capacitor_pods
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics'
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'
pod 'CapacitorOsInappbrowser', :path => '../../..'
pod 'CapacitorInappbrowser', :path => '../../..'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
end

2,998 changes: 1,894 additions & 1,104 deletions example-app/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions example-app/package.json
Original file line number Diff line number Diff line change
@@ -14,11 +14,11 @@
"dependencies": {
"@capacitor/android": "^6.0.0",
"@capacitor/app": "6.0.0",
"@capacitor/core": "6.0.0",
"@capacitor/core": "^6.0.0",
"@capacitor/haptics": "6.0.0",
"@capacitor/ios": "^6.0.0",
"@capacitor/keyboard": "6.0.0",
"@capacitor/os-inappbrowser": "file:../",
"@capacitor/inappbrowser": "file:../",
"@capacitor/status-bar": "6.0.0",
"@ionic/react": "^8.0.0",
"@ionic/react-router": "^8.0.0",
2 changes: 1 addition & 1 deletion example-app/src/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IonButton, IonContent, IonHeader, IonInput, IonPage, IonTitle, IonToolbar } from '@ionic/react';
import { InAppBrowser, DefaultSystemBrowserOptions, DefaultWebViewOptions, DefaultAndroidWebViewOptions, DismissStyle, iOSViewStyle, iOSAnimation, ToolbarPosition, AndroidViewStyle, AndroidAnimation } from '@capacitor/os-inappbrowser';
import { InAppBrowser, DefaultSystemBrowserOptions, DefaultWebViewOptions, DefaultAndroidWebViewOptions, DismissStyle, iOSViewStyle, iOSAnimation, ToolbarPosition, AndroidViewStyle, AndroidAnimation } from '@capacitor/inappbrowser';
import './Home.css';

const Home: React.FC = () => {
68 changes: 34 additions & 34 deletions ios/Sources/InAppBrowserPlugin/InAppBrowserPlugin.swift
Original file line number Diff line number Diff line change
@@ -18,75 +18,75 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
.init(name: "openInWebView", returnType: CAPPluginReturnPromise),
.init(name: "close", returnType: CAPPluginReturnPromise)
]

private var plugin: OSInAppBrowserEngine?
private var openedViewController: UIViewController?

override public func load() {
self.plugin = .init()
}

@objc func openInExternalBrowser(_ call: CAPPluginCall) {
if self.plugin == nil {
self.load()
}

guard let plugin else {
return self.error(call, type: .bridgeNotInitialised)
}

let target = OSInAppBrowserTarget.externalBrowser

let urlString = call.getString("url", "")
guard self.isSchemeValid(urlString) else { return self.error(call, type: .invalidURLScheme) }

guard let url = URL(string: urlString)
else { return self.error(call, type: .inputArgumentsIssue(target: target)) }

delegateExternalBrowser(plugin, url, call)
}

@objc func openInSystemBrowser(_ call: CAPPluginCall) {
if self.plugin == nil {
self.load()
}

guard let plugin else {
return self.error(call, type: .bridgeNotInitialised)
}

let target = OSInAppBrowserTarget.systemBrowser

func delegateSystemBrowser(_ url: URL, _ options: OSIABSystemBrowserOptions) {
DispatchQueue.main.async {
plugin.openSystemBrowser(url, options, { [weak self] event, viewControllerToOpen in
self?.handleResult(event, for: call, checking: viewControllerToOpen, error: .failedToOpen(url: url.absoluteString, onTarget: target))
})
}
}

let urlString = call.getString("url", "")
guard self.isSchemeValid(urlString) else { return self.error(call, type: .invalidURLScheme) }

guard
let options: OSInAppBrowserSystemBrowserModel = self.createModel(for: call.getObject("options")),
let url = URL(string: urlString)
else { return self.error(call, type: .inputArgumentsIssue(target: target)) }

delegateSystemBrowser(url, options.toSystemBrowserOptions())
}

@objc func openInWebView(_ call: CAPPluginCall) {
if self.plugin == nil {
self.load()
}

guard let plugin else {
return self.error(call, type: .bridgeNotInitialised)
}

let target = OSInAppBrowserTarget.webView

func delegateWebView(_ url: URL, _ options: OSIABWebViewOptions) {
DispatchQueue.main.async {
plugin.openWebView(
@@ -106,27 +106,27 @@ public class InAppBrowserPlugin: CAPPlugin, CAPBridgedPlugin {
)
}
}

let urlString = call.getString("url", "")
guard self.isSchemeValid(urlString) else { return self.error(call, type: .invalidURLScheme) }

guard
let options: OSInAppBrowserWebViewModel = self.createModel(for: call.getObject("options")),
let url = URL(string: urlString)
else { return self.error(call, type: .inputArgumentsIssue(target: target)) }

delegateWebView(url, options.toWebViewOptions())
}

@objc func close(_ call: CAPPluginCall) {
if self.plugin == nil {
self.load()
}

if self.plugin == nil {
return self.error(call, type: .bridgeNotInitialised)
}

if let openedViewController {
DispatchQueue.main.async {
openedViewController.dismiss(animated: true) { [weak self] in
@@ -144,7 +144,7 @@ private extension InAppBrowserPlugin {
DispatchQueue.main.async {
plugin.openExternalBrowser(url, { [weak self] success in
guard let self else { return }

if success {
self.success(call)
} else {
@@ -153,7 +153,7 @@ private extension InAppBrowserPlugin {
})
}
}

func handleResult(_ event: OSIABEventType?, for call: CAPPluginCall, checking viewController: UIViewController?, error: OSInAppBrowserError) {
if let event {
if event == .pageClosed {
@@ -179,27 +179,27 @@ private extension InAppBrowserPlugin {
else { return nil }
return argumentsModel
}

func present(_ viewController: UIViewController, _ completionHandler: (() -> Void)?) {
let showNewViewController: () -> Void = {
self.bridge?.viewController?.present(viewController, animated: true, completion: completionHandler)
}

if let presentedViewController = self.bridge?.viewController?.presentedViewController, presentedViewController == self.openedViewController {
presentedViewController.dismiss(animated: true, completion: showNewViewController)
} else {
showNewViewController()
}
}

func isSchemeValid(_ urlScheme: String) -> Bool {
["http://", "https://"].contains(where: urlScheme.hasPrefix)
}

func success(_ call: CAPPluginCall) {
call.resolve()
}

func error(_ call: CAPPluginCall, type errorType: OSInAppBrowserError) {
call.reject(errorType.description)
}
@@ -210,7 +210,7 @@ private extension OSInAppBrowserEngine {
let router = OSIABApplicationRouterAdapter(UIApplication.shared)
self.openExternalBrowser(url, routerDelegate: router, completionHandler)
}

func openSystemBrowser(_ url: URL, _ options: OSIABSystemBrowserOptions, _ completionHandler: @escaping (OSIABEventType?, UIViewController?) -> Void) {
let router = OSIABSafariViewControllerRouterAdapter(
options,
@@ -219,7 +219,7 @@ private extension OSInAppBrowserEngine {
)
self.openSystemBrowser(url, routerDelegate: router) { completionHandler(nil, $0) }
}

func openWebView(
_ url: URL,
_ options: OSIABWebViewOptions,
10 changes: 5 additions & 5 deletions ios/Sources/InAppBrowserPlugin/OSInAppBrowserError.swift
Original file line number Diff line number Diff line change
@@ -10,10 +10,10 @@ enum OSInAppBrowserError: Error {
case inputArgumentsIssue(target: OSInAppBrowserTarget)
case failedToOpen(url: String, onTarget: OSInAppBrowserTarget)
case noBrowserToClose

var description: String {
let result: String

switch self {
case .bridgeNotInitialised:
result = "Capacitor bridge isn't initialized."
@@ -25,20 +25,20 @@ enum OSInAppBrowserError: Error {
case .systemBrowser: "openInSystemBrowser"
case .webView: "openInWebView"
}

result = "The '\(targetString)' input parameters aren't valid."
case .failedToOpen(url: let url, onTarget: let target):
let targetString = switch target {
case .externalBrowser: "External browser"
case .systemBrowser: "SafariViewController"
case .webView: "The WebView"
}

result = "\(targetString) couldn't open the following URL: '\(url)'"
case .noBrowserToClose:
result = "There's no browser view to close."
}

return result
}
}

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.
Loading

0 comments on commit 67f1aff

Please sign in to comment.