Skip to content

Commit

Permalink
Merge pull request #101 from proyecto26/develop
Browse files Browse the repository at this point in the history
Release 3.2.0
  • Loading branch information
jdnichollsc authored Aug 2, 2022
2 parents 8015148 + 186c412 commit 31d9d7e
Show file tree
Hide file tree
Showing 114 changed files with 7,204 additions and 25,612 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ patreon: proyecto26
open_collective: proyecto26
ko_fi: proyecto26
tidelift: npm/nativescript-inappbrowser
liberapay: jdnichollsc
liberapay: proyecto26
custom: paypal.me/jdnichollsc
6 changes: 3 additions & 3 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ letter.

### Please, provide the following version numbers that your issue occurs with:

- CLI: (run `tns --version` to fetch it)
- CLI: (run `ns --version` to fetch it)
- Cross-platform modules: (check the 'version' attribute in the
`node_modules/tns-core-modules/package.json` file in your project)
- Runtime(s): (look for the `"tns-android"` and `"tns-ios"` properties in the `package.json` file of your project)
`node_modules/@nativescript/core/package.json` file in your project)
- Runtime(s): (look for the `"@nativescript/android"` and `"@nativescript/ios"` properties in the `package.json` file of your project)
- Plugin(s): (look for the version numbers in the `package.json` file of your
project and paste your dependencies and devDependencies here)

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.js
*.js.map
*.log
*.aar
src/*.d.ts
!src/index.d.ts
!src/references.d.ts
Expand Down
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ matrix:
language: node_js
node_js: "10"
jdk: oraclejdk8
script: cd src && npm run build && cd ../demo && npm i && tns build ios --bundle --env.uglify
script: cd src && npm run build && cd ../demo && npm i && ns build ios --bundle --env.uglify
- language: android
os: linux
env:
- WebPack="Android"
jdk: oraclejdk8
before_install: nvm install 10
script: cd src && npm run build && cd ../demo && npm i && tns build android --bundle --env.uglify --env.snapshot
script: cd src && npm run build && cd ../demo && npm i && ns build android --bundle --env.uglify --env.snapshot
- language: android
env:
- BuildAndroid="28"
os: linux
jdk: oraclejdk8
before_install: nvm install 10
script:
- cd src && npm i && npm run tsc && cd ../demo && tns build android
- cd src && npm i && npm run tsc && cd ../demo && ns build android
- os: osx
env:
- BuildiOS="12"
Expand All @@ -38,7 +38,7 @@ matrix:
node_js: "10"
jdk: oraclejdk8
script:
- cd src && npm i && npm run tsc && cd ../demo && tns build ios
- cd src && npm i && npm run tsc && cd ../demo && ns build ios

# TODO: Include unit tests...
# - os: linux
Expand Down Expand Up @@ -75,5 +75,5 @@ before_install:

install:
- echo no | npm install -g nativescript
- tns usage-reporting disable
- tns error-reporting disable
- ns usage-reporting disable
- ns error-reporting disable
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ in case of vulnerabilities.

## [Unreleased]

## [3.2.0] - 2022-08-02

### Added
- Add custom size option to iOS formSheet Modal by [@ShaneMckenna23](https://github.com/ShaneMckenna23) ([#91](https://github.com/proyecto26/nativescript-inappbrowser/pull/91)).
- Add `includeReferrer` to allow adding android package name as referrer for website to track by [@vincent-paing](https://github.com/vincent-paing) ([#95](https://github.com/proyecto26/nativescript-inappbrowser/pull/95)).
- Add `warmup` and `mayLaunchUrl` functions for optimization in Android by [@vincent-paing](https://github.com/vincent-paing) ([#97](https://github.com/proyecto26/nativescript-inappbrowser/pull/97)).

### Fixed
- Complete migration to ns8 and fix build issues by [@rigor789](https://github.com/rigor789) ([#92](https://github.com/proyecto26/nativescript-inappbrowser/pull/92)).
- Fix support for `Metadata Filtering` from Android by [@jcassidyav](https://github.com/jcassidyav) ([#93](https://github.com/proyecto26/nativescript-inappbrowser/pull/93)).
- Avoid stringifying null redirect url by [@rmartin48](https://github.com/rmartin48) ([#99](https://github.com/proyecto26/nativescript-inappbrowser/pull/99)).
- Fix auth redirection logic by [@jdnichollsc](https://github.com/jdnichollsc) ([#100](https://github.com/proyecto26/nativescript-inappbrowser/pull/100)).

### Removed
- Remove `QUERY_ALL_PACKAGES` permission by [@edusperoni](https://github.com/edusperoni) ([#87](https://github.com/proyecto26/nativescript-inappbrowser/pull/87)).

## [3.1.2] - 2021-06-28

### Fixed
Expand Down Expand Up @@ -107,7 +123,8 @@ in case of vulnerabilities.
- Methods to open and close external urls to authenticate the user **(openAuth, closeAuth)** using deep linking.
- `isAvailable` method to detect if the device supports the plugin.

[Unreleased]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v3.1.2...HEAD
[Unreleased]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v3.2.0...HEAD
[3.2.0]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v3.1.2...v3.2.0
[3.1.2]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v3.1.1...v3.1.2
[3.1.1]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v3.1.0...v3.1.1
[3.1.0]: https://github.com/proyecto26/nativescript-inappbrowser/compare/v3.0.2...v3.1.0
Expand Down
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Share your awesome project [here](https://github.com/proyecto26/nativescript-ina
## Getting started

```javascript
tns plugin add nativescript-inappbrowser
ns plugin add nativescript-inappbrowser
```

### Manual installation
Expand Down Expand Up @@ -92,6 +92,9 @@ Methods | Action
`openAuth` | Opens the url with Safari in a modal on iOS using **SFAuthenticationSession/ASWebAuthenticationSession**, and Chrome in a new custom tab on Android. On iOS, the user will be asked whether to allow the app to authenticate using the given url **(OAuth flow with deep linking redirection)**.
`closeAuth` | Dismisses the current authentication session.
`isAvailable` | Detect if the device supports this plugin.
`onStart` | Initialize a bound background service so the application can communicate its intention to the browser. After the service is connected, the client can be used to Warms up the browser to make navigation faster and indicates that a given URL may be loaded in the future. - Android Only.
`warmup` | Warm up the browser process - Android Only.
`mayLaunchUrl` | Tells the browser of a likely future navigation to a URL. The most likely URL has to be specified first. Optionally, a list of other likely URLs can be provided. They are treated as less likely than the first one, and have to be sorted in decreasing priority order. These additional URLs may be ignored. All previous calls to this method will be deprioritized - Android Only.

### iOS Options

Expand All @@ -107,6 +110,7 @@ Property | Description
`modalEnabled` (Boolean) | Present the **SafariViewController** modally or as push instead. [`true`/`false`]
`enableBarCollapsing` (Boolean) | Determines whether the browser's tool bars will collapse or not. [`true`/`false`]
`ephemeralWebSession` (Boolean) | Prevent re-use cookies of previous session (openAuth only) [`true`/`false`]
`formSheetPreferredContentSize` (Object) | Custom size for iPad `formSheet` modals [`{width: 400, height: 500}`]

### Android Options
Property | Description
Expand All @@ -124,6 +128,7 @@ Property | Description
`hasBackButton` (Boolean) | Sets a back arrow instead of the default `X` icon to close the custom tab. [`true`/`false`]
`browserPackage` (String) | Package name of a browser to be used to handle Custom Tabs.
`showInRecents` (Boolean) | Determining whether browsed website should be shown as separate entry in Android recents/multitasking view. [`true`/`false`]
`includeReferrer` (Boolean) | Determining whether to include your package name as referrer for the website to track. [`true`/`false`]

### Demo

Expand Down Expand Up @@ -192,6 +197,36 @@ import { InAppBrowser } from 'nativescript-inappbrowser';
...
```

### Android Optimizations

On Android, you can warmup the in app browser client to make it launch siginificantly faster. To do so, add the following to your [Custom Android Activity](https://docs.nativescript.org/advanced-concepts.html#extending-android-activity).

```ts
import { InAppBrowser } from "nativescript-inappbrowser";
@NativeClass()
@JavaProxy("org.nativescript.demo.MainActivity")
export class Activity extends androidx.appcompat.app.AppCompatActivity {
public onStart(): void {
// InAppBrowser initialization for CustomTabsServiceConnection
InAppBrowser.onStart();
}
}
```

You can further optimize performance and pre-render pages [by providing the urls that the user is likely to open](https://developer.chrome.com/docs/android/custom-tabs/best-practices/#pre-render-content).

```ts
constructor() {
super();
// Do not call this every time the component render
InAppBrowser.mayLaunchUrl(this._url, [
"https://twitter.com/NativeScript",
"https://github.com/NativeScript/NativeScript",
"https://openjsf.org"
]);
}
```

### Authentication Flow using Deep Linking

In order to redirect back to your application from a web browser, you must specify a unique URI to your app. To do this,
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions demo/App_Resources/Android/native-api-usage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"whitelist-plugins-usages": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
android:launchMode="singleTask">

<activity
android:name="com.tns.NativeScriptActivity"
android:name="org.nativescript.demo.MainActivity"
android:label="@string/title_activity_kimera"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|locale|uiMode"
android:theme="@style/LaunchScreenTheme">
android:theme="@style/LaunchScreenTheme"
android:exported="true">

<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions demo/App_Resources/iOS/native-api-usage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"whitelist-plugins-usages": true
}
98 changes: 98 additions & 0 deletions demo/app/activity.android.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import {
Application,
setActivityCallbacks,
AndroidActivityCallbacks,
} from "@nativescript/core";
import { InAppBrowser } from "nativescript-inappbrowser";

@NativeClass()
@JavaProxy("org.nativescript.demo.MainActivity")
export class Activity extends androidx.appcompat.app.AppCompatActivity {
public isNativeScriptActivity;

private _callbacks: AndroidActivityCallbacks;

public onCreate(savedInstanceState: android.os.Bundle): void {
Application.android.init(this.getApplication());
// Set the isNativeScriptActivity in onCreate (as done in the original NativeScript activity code)
// The JS constructor might not be called because the activity is created from Android.
this.isNativeScriptActivity = true;
if (!this._callbacks) {
setActivityCallbacks(this);
}

this._callbacks.onCreate(
this,
savedInstanceState,
this.getIntent(),
super.onCreate
);
}

public onNewIntent(intent: android.content.Intent): void {
this._callbacks.onNewIntent(
this,
intent,
super.setIntent,
super.onNewIntent
);
}

public onSaveInstanceState(outState: android.os.Bundle): void {
this._callbacks.onSaveInstanceState(
this,
outState,
super.onSaveInstanceState
);
}

public onStart(): void {
this._callbacks.onStart(this, super.onStart);
// InAppBrowser initialization (Connect to the Custom Tabs service)
InAppBrowser.onStart();
}

public onStop(): void {
this._callbacks.onStop(this, super.onStop);
}

public onDestroy(): void {
this._callbacks.onDestroy(this, super.onDestroy);
}

public onPostResume(): void {
this._callbacks.onPostResume(this, super.onPostResume);
}

public onBackPressed(): void {
this._callbacks.onBackPressed(this, super.onBackPressed);
}

public onRequestPermissionsResult(
requestCode: number,
permissions: Array<string>,
grantResults: Array<number>
): void {
this._callbacks.onRequestPermissionsResult(
this,
requestCode,
permissions,
grantResults,
undefined /*TODO: Enable if needed*/
);
}

public onActivityResult(
requestCode: number,
resultCode: number,
data: android.content.Intent
): void {
this._callbacks.onActivityResult(
this,
requestCode,
resultCode,
data,
super.onActivityResult
);
}
}
62 changes: 31 additions & 31 deletions demo/app/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,36 @@ In many cases you may want to use the NativeScript core theme instead
of writing your own CSS rules. For a full list of class names in the theme
refer to http://docs.nativescript.org/ui/theme.
*/
@import '~nativescript-theme-core/css/core.css';
@import "nativescript-theme-core/css/core.css";

TextField {
border-width: 1;
border-color: gray;
height: 45;
margin-top: 5;
}
.content {
padding-left: 20;
padding-right: 20;
}
.p {
font-size: 14;
color: #333333;
margin: 5;
}
.my-button {
background-color: transparent;
border-radius: 5;
color: blue;
font-family: FontAwesome;
font-size: 18;
vertical-align: middle;
width: 80%;
}
.my-button:active {
color:black;
}
border-width: 1;
border-color: gray;
height: 45;
margin-top: 5;
}

.content {
padding-left: 20;
padding-right: 20;
}

.p {
font-size: 14;
color: #333333;
margin: 5;
}

.my-button {
background-color: transparent;
border-radius: 5;
color: blue;
font-family: FontAwesome;
font-size: 18;
vertical-align: middle;
width: 80%;
}

.my-button:active {
color: black;
}
6 changes: 3 additions & 3 deletions demo/app/home/home-page.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { EventData, Page } from '@nativescript/core';
import {HelloWorldModel} from './home-view-model';
import { EventData, Page } from "@nativescript/core";
import { HelloWorldModel } from "./home-view-model";

// Event handler for Page 'loaded' event attached in main-page.xml
export function pageLoaded(args: EventData) {
// Get the event sender
let page = <Page>args.object;
page.bindingContext = new HelloWorldModel();
}
}
2 changes: 1 addition & 1 deletion demo/app/home/home-page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
<Button text="Open link" class="my-button btn" tap="{{ openLink }}"></Button>
<Button text="Try deep linking" class="my-button btn" tap="{{ tryDeepLinking }}"></Button>
</StackLayout>
</Page>
</Page>
Loading

0 comments on commit 31d9d7e

Please sign in to comment.