diff --git a/.travis.yml b/.travis.yml
index 18898fb4f..253ceadc9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,22 @@
-language: node_js
-node_js:
-- '6'
+env:
+ global:
+ - DATE=$(date +%Y-%m-%d)
+ - PACKAGE_VERSION=$DATE-$TRAVIS_BUILD_NUMBER
+language: objective-c
+osx_image: xcode9.3
+install:
+ - brew update
+ - brew cask install android-sdk
+ # Suppress output of sdkmanager to keep log under the 4MB limit of travis-ci
+ - yes | sdkmanager "platforms;android-28" >/dev/null
+ - yes | sdkmanager "build-tools;28.0.3" >/dev/null
+ - yes | sdkmanager "extras;android;m2repository" >/dev/null
before_script:
-- npm install -g grunt-cli
-- npm install
+ - export ANDROID_HOME=/usr/local/share/android-sdk
+ - npm install -g grunt-cli
+ - npm install
script:
-- grunt default
-- (cd tns-platform-declarations && npm pack)
+- npm run setup-widgets
+- npm run setup
+- npm run tsc
+- npm run tslint
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 704a46a4e..3bd7f8cc0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+## [5.3.1](https://github.com/NativeScript/NativeScript/compare/5.3.0...5.3.1) (2019-03-28)
+
+
+### Bug Fixes
+
+* revert fromUrl deprecate warning ([#7082](https://github.com/NativeScript/NativeScript/issues/7082)) ([0a45540](https://github.com/NativeScript/NativeScript/commit/0a45540))
+
+
# [5.3.0](https://github.com/NativeScript/NativeScript/compare/5.2.1...5.3.0) (2019-03-21)
diff --git a/apps/app/ui-tests-app/button/button-border.css b/apps/app/ui-tests-app/button/button-border.css
index 644d827a6..3b404e027 100644
--- a/apps/app/ui-tests-app/button/button-border.css
+++ b/apps/app/ui-tests-app/button/button-border.css
@@ -46,7 +46,7 @@ Button {
}
#s10 {
- border-width: 5 0; border-color: black;
+ border-width: 5 0; border-color: black; background-color: white;
}
#s11 {
diff --git a/apps/app/ui-tests-app/css/pixels.xml b/apps/app/ui-tests-app/css/pixels.xml
index b2b61157d..30f25d526 100644
--- a/apps/app/ui-tests-app/css/pixels.xml
+++ b/apps/app/ui-tests-app/css/pixels.xml
@@ -4,7 +4,7 @@
-
+
@@ -12,7 +12,7 @@
-
+
@@ -32,7 +32,7 @@
-
+
@@ -40,7 +40,7 @@
-
+
diff --git a/apps/app/ui-tests-app/flexbox/flexbox.css b/apps/app/ui-tests-app/flexbox/flexbox.css
index 65d8ae62b..9f2bc32fc 100644
--- a/apps/app/ui-tests-app/flexbox/flexbox.css
+++ b/apps/app/ui-tests-app/flexbox/flexbox.css
@@ -22,6 +22,7 @@
.control Button {
border-width: 1 1 0 0;
border-color: gray;
+ background-color: white;
font-size: 9;
padding: 0;
height: 0;
diff --git a/apps/app/ui-tests-app/issues/issue-3113.css b/apps/app/ui-tests-app/issues/issue-3113.css
index dec0844d3..3a3cab238 100644
--- a/apps/app/ui-tests-app/issues/issue-3113.css
+++ b/apps/app/ui-tests-app/issues/issue-3113.css
@@ -1,13 +1,16 @@
#button1 {
- border-color: rgba(0, 0, 0, 0);
+ border-color: transparent;
border-width: 3;
+ background-color: white;
}
#button2 {
border-color: rgba(0, 0, 0, 0.5);
border-width: 3;
+ background-color: white;
}
#button3 {
border-width: 3;
+ background-color: white;
}
\ No newline at end of file
diff --git a/package.json b/package.json
index 1490478c2..f65b9780f 100644
--- a/package.json
+++ b/package.json
@@ -46,6 +46,7 @@
"typescript": "^3.1.6"
},
"scripts": {
+ "setup-widgets": "( cd tns-core-modules-widgets && sh build.sh ) && npm run dev-link-tns-core-modules-widgets",
"setup": "npm run dev-link-tns-platform-declarations && npm run dev-link-tns-core-modules && npm run dev-link-tests && npm run dev-link-apps && npm run dev-link-e2e-modal",
"tsc": "node --max_old_space_size=4096 ./node_modules/typescript/bin/tsc",
"ci": "tsc && npm run tslint && npm run ci-apps && npm run ci-e2e && npm run ci-tests",
@@ -67,6 +68,7 @@
"dev-tsc-all": "npm run dev-tsc-tns-platform-declarations && npm run tsc && npm run dev-tsc-tests && npm run dev-tsc-apps && && npm run dev-tsc-e2e",
"dev-link-tns-platform-declarations": "cd tns-platform-declarations && npm link",
"dev-link-tns-core-modules": "cd tns-core-modules && npm link",
+ "dev-link-tns-core-modules-widgets": "(cd tns-core-modules-widgets/dist/package && npm link) && (cd tns-core-modules && npm link tns-core-modules-widgets)",
"dev-link-tests": "cd tests && npm link tns-platform-declarations && npm link tns-core-modules",
"dev-link-apps": "cd apps && npm link tns-platform-declarations && npm link tns-core-modules",
"dev-link-e2e-modal": "cd e2e && cd modal-navigation && npm link tns-platform-declarations && npm link tns-core-modules",
@@ -77,7 +79,7 @@
"test-ios": "tns run ios --path tests --justlaunch --no-watch",
"test-watch-android": "npm run pretest && concurrently --kill-others \"npm run tsc-tiw\" \"tns livesync android --path tests --watch\"",
"test-watch-ios": "npm run pretest && concurrently --kill-others \"npm run tsc-tiw\" \"tns livesync ios --path tests --watch\"",
- "prepublish": "echo \"Development reminder: npm run setup\n\"",
+ "prepublish": "echo \"Development reminder for setup\n - tns-core-modules: npm run setup\n - tns-core-modules-widgets: npm run setup-widgets\n\"",
"typedoc": "typedoc --tsconfig tsconfig.typedoc.json --out bin/dist/apiref --includeDeclarations --name NativeScript --theme ./node_modules/nativescript-typedoc-theme --excludeExternals --externalPattern \"**/+(tns-core-modules|module).d.ts\"",
"dev-typedoc": "npm run typedoc && cd bin/dist/apiref && http-server",
"test-tsc-es2016": "npm run tsc -- -p tsconfig.public.es2016.json",
diff --git a/tests/app/app/app.ts b/tests/app/app/app.ts
index a0e348269..4e6e9330a 100644
--- a/tests/app/app/app.ts
+++ b/tests/app/app/app.ts
@@ -135,6 +135,10 @@ if (application.android) {
console.log("Event: " + args.eventName + ", Activity: " + args.activity);
// Set args.cancel = true to cancel back navigation and do something custom.
});
+
+ application.android.on(application.AndroidApplication.activityNewIntentEvent, function (args: application.AndroidActivityNewIntentEventData) {
+ console.log("Event: " + args.eventName + ", Activity: " + args.activity + ", Intent: " + args.intent);
+ });
}
var time;
diff --git a/tns-core-modules-widgets/CODE_OF_CONDUCT.md b/tns-core-modules-widgets/CODE_OF_CONDUCT.md
deleted file mode 100644
index 1c845d0b1..000000000
--- a/tns-core-modules-widgets/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,83 +0,0 @@
-# NativeScript Community Code of Conduct
-
-Our community members come from all walks of life and are all at different stages of their personal and professional journeys. To support everyone, we've prepared a short code of conduct. Our mission is best served in an environment that is friendly, safe, and accepting; free from intimidation or harassment.
-
-Towards this end, certain behaviors and practices will not be tolerated.
-
-## tl;dr
-
-- Be respectful.
-- We're here to help.
-- Abusive behavior is never tolerated.
-- Violations of this code may result in swift and permanent expulsion from the NativeScript community channels.
-
-## Administrators
-
-- Dan Wilson (@DanWilson on Slack)
-- Jen Looper (@jen.looper on Slack)
-- TJ VanToll (@tjvantoll on Slack)
-
-## Scope
-
-We expect all members of the NativeScript community, including administrators, users, facilitators, and vendors to abide by this Code of Conduct at all times in our community venues, online and in person, and in one-on-one communications pertaining to NativeScript affairs.
-
-This policy covers the usage of the NativeScript Slack community, as well as the NativeScript support forums, NativeScript GitHub repositories, the NativeScript website, and any NativeScript-related events. This Code of Conduct is in addition to, and does not in any way nullify or invalidate, any other terms or conditions related to use of NativeScript.
-
-The definitions of various subjective terms such as "discriminatory", "hateful", or "confusing" will be decided at the sole discretion of the NativeScript administrators.
-
-## Friendly, Harassment-Free Space
-
-We are committed to providing a friendly, safe, and welcoming environment for all, regardless of gender identity, sexual orientation, disability, ethnicity, religion, age, physical appearance, body size, race, or similar personal characteristics.
-
-We ask that you please respect that people have differences of opinion regarding technical choices, and acknowledge that every design or implementation choice carries a trade-off and numerous costs. There is seldom a single right answer. A difference of technology preferences is never a license to be rude.
-
-Any spamming, trolling, flaming, baiting, or other attention-stealing behaviour is not welcome, and will not be tolerated.
-
-Harassing other users of NativeScript is never tolerated, whether via public or private media.
-
-Avoid using offensive or harassing package names, nicknames, or other identifiers that might detract from a friendly, safe, and welcoming environment for all.
-
-Harassment includes, but is not limited to: harmful or prejudicial verbal or written comments related to gender identity, sexual orientation, disability, ethnicity, religion, age, physical appearance, body size, race, or similar personal characteristics; inappropriate use of nudity, sexual images, and/or sexually explicit language in public spaces; threats of physical or non-physical harm; deliberate intimidation, stalking or following; harassing photography or recording; sustained disruption of talks or other events; inappropriate physical contact; and unwelcome sexual attention.
-
-## Acceptable Content
-
-The NativeScript administrators reserve the right to make judgement calls about what is and isn't appropriate in published content. These are guidelines to help you be successful in our community.
-
-Content must contain something applicable to the previously stated goals of the NativeScript community. "Spamming", that is, publishing any form of content that is not applicable, is not allowed.
-
-Content must not contain illegal or infringing content. You should only publish content to NativeScript properties if you have the right to do so. This includes complying with all software license agreements or other intellectual property restrictions. For example, redistributing an MIT-licensed module with the copyright notice removed, would not be allowed. You will be responsible for any violation of laws or others’ intellectual property rights.
-
-Content must not be malware. For example, content (code, video, pictures, words, etc.) which is designed to maliciously exploit or damage computer systems, is not allowed.
-
-Content name, description, and other visible metadata must not include abusive, inappropriate, or harassing content.
-
-## Reporting Violations of this Code of Conduct
-
-If you believe someone is harassing you or has otherwise violated this Code of Conduct, please contact the administrators and send us an abuse report. If this is the initial report of a problem, please include as much detail as possible. It is easiest for us to address issues when we have more context.
-
-## Consequences
-
-All content published to the NativeScript community channels is hosted at the sole discretion of the NativeScript administrators.
-
-Unacceptable behavior from any community member, including sponsors, employees, customers, or others with decision-making authority, will not be tolerated.
-
-Anyone asked to stop unacceptable behavior is expected to comply immediately.
-
-If a community member engages in unacceptable behavior, the NativeScript administrators may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning (and without refund in the case of a paid event or service).
-
-## Addressing Grievances
-
-If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify the administrators. We will do our best to ensure that your grievance is handled appropriately.
-
-In general, we will choose the course of action that we judge as being most in the interest of fostering a safe and friendly community.
-
-## Contact Info
-Please contact Dan Wilson @DanWilson if you need to report a problem or address a grievance related to an abuse report.
-
-You are also encouraged to contact us if you are curious about something that might be "on the line" between appropriate and inappropriate content. We are happy to provide guidance to help you be a successful part of our community.
-
-## Credit and License
-
-This Code of Conduct borrows heavily from the WADE Code of Conduct, which is derived from the NodeBots Code of Conduct, which in turn borrows from the npm Code of Conduct, which was derived from the Stumptown Syndicate Citizen's Code of Conduct, and the Rust Project Code of Conduct.
-
-This document may be reused under a Creative Commons Attribution-ShareAlike License.
\ No newline at end of file
diff --git a/tns-core-modules-widgets/CONTRIBUTING.md b/tns-core-modules-widgets/CONTRIBUTING.md
deleted file mode 100644
index 1f7aaa709..000000000
--- a/tns-core-modules-widgets/CONTRIBUTING.md
+++ /dev/null
@@ -1,78 +0,0 @@
-# Contributing to NativeScript Core Modules Widgets
-
-:+1: First of all, thank you for taking the time to contribute! :+1:
-
-Here are some guides on how to do that:
-
-
-
-- [Code of Conduct](#code-of-conduct)
-- [Reporting Bugs](#reporting-bugs)
-- [Requesting Features](#requesting-features)
-- [Submitting a PR](#submitting-a-pr)
-- [Where to Start](#where-to-start)
-
-
-
-## Code of Conduct
-Help us keep a healthy and open community. We expect all participants in this project to adhere to the [NativeScript Code Of Conduct](https://github.com/NativeScript/codeofconduct).
-
-
-## Reporting Bugs
-
-1. Always update to the most recent master release; the bug may already be resolved.
-2. Search for similar issues in the issues list for this repo; it may already be an identified problem.
-3. If this is a bug or problem that is clear, simple, and is unlikely to require any discussion -- it is OK to open an issue on GitHub with a reproduction of the bug including workflows and screenshots. If possible, submit a Pull Request with a failing test, entire application or module. If you'd rather take matters into your own hands, fix the bug yourself (jump down to the [Submitting a PR](#submitting-a-pr) section).
-
-## Requesting Features
-
-1. Use Github Issues to submit feature requests.
-2. First, search for a similar request and extend it if applicable. This way it would be easier for the community to track the features.
-3. When requesting a new feature, please provide as much detail as possible about why you need the feature in your apps. We prefer that you explain a need rather than explain a technical solution for it. That might trigger a nice conversation on finding the best and broadest technical solution to a specific need.
-
-## Submitting a PR
-
-Before you begin:
-* Read and sign the [NativeScript Contribution License Agreement](http://www.nativescript.org/cla).
-* Make sure there is an issue for the bug or feature you will be working on.
-
-Following these steps is the best way to get you code included in the project:
-
-1. Fork and clone the tns-core-modules-widgets repo:
-```bash
-git clone https://github.com//tns-core-modules-widgets.git
-# Navigate to the newly cloned directory
-cd tns-core-modules-widgets
-# Add an "upstream" remote pointing to the original repo.
-git remote add upstream https://github.com/NativeScript/tns-core-modules-widgets.git
-```
-
-2. Read our [development workflow guide](DevelopmentWorkflow.md) for local setup:
-
-3. Create a branch for your PR
-```bash
-git checkout -b master
-```
-
-4. The fun part! Make your code changes. Make sure you:
- - Follow the [code conventions guide](https://github.com/NativeScript/NativeScript/blob/master/CodingConvention.md).
- - Write unit tests for your fix or feature.
-
-5. Before you submit your PR:
- - Rebase your changes to the latest master: `git pull --rebase upstream master`.
- - Ensure all unit test are green. Check [running unit tests](DevelopmentWorkflow.md#running-the-tests).
- - Ensure your changes pass tslint validation. (run `npm run tslint` in the root of the repo).
-
-6. Push your fork. If you have rebased you might have to use force-push your branch:
-```
-git push origin --force
-```
-
-7. [Submit your pull request](https://github.com/NativeScript/tns-core-modules-widgets/compare). Please, fill in the Pull Request template - it will help us better understand the PR and increase the chances of it getting merged quickly.
-
-It's our turn from there on! We will review the PR and discuss changes you might have to make before merging it! Thanks!
-
-
-## Where to Start
-
-If you want to contribute, but you are not sure where to start - look for issues labeled [`help wanted`](https://github.com/NativeScript/tns-core-modules-widgets/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22).
diff --git a/tns-core-modules-widgets/README.md b/tns-core-modules-widgets/README.md
index dfc75b6d3..beb40cfb1 100644
--- a/tns-core-modules-widgets/README.md
+++ b/tns-core-modules-widgets/README.md
@@ -1,7 +1,7 @@
# NativeScript Core Modules Widgets
-[](https://travis-ci.org/NativeScript/tns-core-modules-widgets)
+[](https://travis-ci.org/NativeScript/NativeScript)
-This repository contains the source code of the `tns-core-modules-widgets` library. This library represents native code (Java and Objective-C) used by the NativeScript [`core modules`](https://github.com/NativeScript/NativeScript/tree/master/tns-core-modules).
+This library represents native code (Java and Objective-C) used by the NativeScript [`core modules`](https://github.com/NativeScript/NativeScript/tree/master/tns-core-modules-widgets).
[NativeScript](https://www.nativescript.org/) is a framework which enables developers to write truly native mobile applications for Android and iOS using JavaScript and CSS.
diff --git a/tns-core-modules-widgets/android/widgets/src/main/java/org/nativescript/widgets/BorderDrawable.java b/tns-core-modules-widgets/android/widgets/src/main/java/org/nativescript/widgets/BorderDrawable.java
index 3608a195d..247caa6a6 100644
--- a/tns-core-modules-widgets/android/widgets/src/main/java/org/nativescript/widgets/BorderDrawable.java
+++ b/tns-core-modules-widgets/android/widgets/src/main/java/org/nativescript/widgets/BorderDrawable.java
@@ -8,6 +8,7 @@ import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
+import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PointF;
@@ -16,6 +17,7 @@ import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.Shader;
+import android.support.annotation.NonNull;
import org.nativescript.widgets.image.BitmapOwner;
import org.nativescript.widgets.image.Fetcher;
@@ -804,6 +806,23 @@ public class BorderDrawable extends ColorDrawable implements BitmapOwner {
return drawable;
}
+ @Override
+ public void getOutline(@NonNull Outline outline) {
+ if (android.os.Build.VERSION.SDK_INT >= 21) {
+ Path backgroundPath = new Path();
+ float[] backgroundRadii = {
+ Math.max(0, borderTopLeftRadius), Math.max(0, borderTopLeftRadius),
+ Math.max(0, borderTopRightRadius), Math.max(0, borderTopRightRadius),
+ Math.max(0, borderBottomRightRadius), Math.max(0, borderBottomRightRadius),
+ Math.max(0, borderBottomLeftRadius), Math.max(0, borderBottomLeftRadius)
+ };
+ backgroundPath.addRoundRect(new RectF(getBounds()), backgroundRadii, Path.Direction.CW);
+ outline.setConvexPath(backgroundPath);
+ } else {
+ throw new IllegalStateException("Method supported on API 21 or higher");
+ }
+ }
+
private class BackgroundDrawParams {
private boolean repeatX = true;
private boolean repeatY = true;
diff --git a/tns-core-modules-widgets/package.json b/tns-core-modules-widgets/package.json
index 40de1be3c..50ed097f7 100644
--- a/tns-core-modules-widgets/package.json
+++ b/tns-core-modules-widgets/package.json
@@ -7,18 +7,18 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/NativeScript/android-widgets.git"
+ "url": "https://github.com/NativeScript/NativeScript"
},
"author": "NativeScript team",
"license": "Apache-2.0",
"bugs": {
- "url": "https://github.com/NativeScript/android-widgets/issues"
+ "url": "https://github.com/NativeScript/NativeScript/issues"
},
- "homepage": "https://github.com/NativeScript/android-widgets#readme",
+ "homepage": "https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules-widgets#readme",
"nativescript": {
"platforms": {
- "ios": "4.0.0",
- "android": "4.0.0"
+ "ios": "5.0.0",
+ "android": "5.0.0"
}
}
}
diff --git a/tns-core-modules/application/application.android.ts b/tns-core-modules/application/application.android.ts
index 1d2f0c76b..f0588976d 100644
--- a/tns-core-modules/application/application.android.ts
+++ b/tns-core-modules/application/application.android.ts
@@ -1,6 +1,6 @@
import {
AndroidActivityBundleEventData, AndroidActivityEventData, ApplicationEventData, OrientationChangedEventData,
- AndroidApplication as AndroidApplicationDefinition,
+ AndroidApplication as AndroidApplicationDefinition, AndroidActivityNewIntentEventData,
AndroidActivityResultEventData, AndroidActivityBackPressedEventData, AndroidActivityRequestPermissionsEventData
} from ".";
@@ -25,6 +25,7 @@ const ActivityStopped = "activityStopped";
const SaveActivityState = "saveActivityState";
const ActivityResult = "activityResult";
const ActivityBackPressed = "activityBackPressed";
+const ActivityNewIntent = "activityNewIntent";
const ActivityRequestPermissions = "activityRequestPermissions";
export class AndroidApplication extends Observable implements AndroidApplicationDefinition {
@@ -37,6 +38,7 @@ export class AndroidApplication extends Observable implements AndroidApplication
public static saveActivityStateEvent = SaveActivityState;
public static activityResultEvent = ActivityResult;
public static activityBackPressedEvent = ActivityBackPressed;
+ public static activityNewIntentEvent = ActivityNewIntent;
public static activityRequestPermissionsEvent = ActivityRequestPermissions;
public paused: boolean;
@@ -119,6 +121,7 @@ export interface AndroidApplication {
on(event: "saveActivityState", callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any);
on(event: "activityResult", callback: (args: AndroidActivityResultEventData) => void, thisArg?: any);
on(event: "activityBackPressed", callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any);
+ on(event: "activityNewIntent", callback: (args: AndroidActivityNewIntentEventData) => void, thisArg?: any);
on(event: "activityRequestPermissions", callback: (args: AndroidActivityRequestPermissionsEventData) => void, thisArg?: any);
}
@@ -131,9 +134,8 @@ let mainEntry: NavigationEntry;
let started = false;
// NOTE: for backwards compatibility. Remove for 4.0.0.
const createRootFrame = { value: true };
-export function start(entry?: NavigationEntry | string) {
- console.log("application.start() is deprecated; use application.run() instead");
+function _start(entry?: NavigationEntry | string) {
if (started) {
throw new Error("Application is already started.");
}
@@ -146,13 +148,18 @@ export function start(entry?: NavigationEntry | string) {
}
}
+export function start(entry?: NavigationEntry | string) {
+ console.log("application.start() is deprecated; use application.run() instead");
+ _start(entry);
+}
+
export function shouldCreateRootFrame(): boolean {
return createRootFrame.value;
}
export function run(entry?: NavigationEntry | string) {
createRootFrame.value = false;
- start(entry);
+ _start(entry);
}
const CALLBACKS = "_callbacks";
diff --git a/tns-core-modules/application/application.d.ts b/tns-core-modules/application/application.d.ts
index 346680879..f85972e8b 100644
--- a/tns-core-modules/application/application.d.ts
+++ b/tns-core-modules/application/application.d.ts
@@ -187,7 +187,7 @@ export function off(eventNames: string, callback?: any, thisArg?: any);
/**
* @deprecated use application.run() instead.
- *
+ *
* Call this method to start the application. Important: All code after this method call will not be executed!
*/
export function start(entry?: NavigationEntry | string);
@@ -371,6 +371,16 @@ export interface AndroidActivityResultEventData extends AndroidActivityEventData
intent: any /* android.content.Intent */;
}
+/**
+ * Data for the Android activity newIntent event.
+ */
+export interface AndroidActivityNewIntentEventData extends AndroidActivityEventData {
+ /**
+ * The intent.
+ */
+ intent: any /* android.content.Intent */;
+}
+
/**
* Data for the Android activity back pressed event.
*/
@@ -480,6 +490,11 @@ export class AndroidApplication extends Observable {
*/
on(event: "activityBackPressed", callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any);
+ /**
+ * This event is raised when the Android app was launched by an Intent with data.
+ */
+ on(event: "activityNewIntent", callback: (args: AndroidActivityNewIntentEventData) => void, thisArg?: any);
+
/**
* This event is raised when the Android activity requests permissions.
*/
@@ -530,6 +545,11 @@ export class AndroidApplication extends Observable {
*/
public static activityBackPressedEvent: string;
+ /**
+ * String value used when hooking to activityNewIntent event.
+ */
+ public static activityNewIntentEvent: string;
+
/**
* String value used when hooking to requestPermissions event.
*/
diff --git a/tns-core-modules/application/application.ios.ts b/tns-core-modules/application/application.ios.ts
index 4d05f90bf..c776fdcf4 100644
--- a/tns-core-modules/application/application.ios.ts
+++ b/tns-core-modules/application/application.ios.ts
@@ -275,16 +275,15 @@ function createRootView(v?: View) {
let rootView = v;
if (!rootView) {
// try to navigate to the mainEntry (if specified)
- if (mainEntry) {
+ if (!mainEntry) {
+ throw new Error("Main entry is missing. App cannot be started. Verify app bootstrap.");
+ } else {
if (createRootFrame.value) {
const frame = rootView = new Frame();
frame.navigate(mainEntry);
} else {
rootView = createViewFromEntry(mainEntry);
}
- } else {
- // TODO: Throw an exception?
- throw new Error("A Frame must be used to navigate to a Page.");
}
}
@@ -302,9 +301,7 @@ export function getRootView() {
// NOTE: for backwards compatibility. Remove for 4.0.0.
const createRootFrame = { value: true };
let started: boolean = false;
-export function start(entry?: string | NavigationEntry) {
- console.log("application.start() is deprecated; use application.run() instead");
-
+function _start(entry?: string | NavigationEntry) {
mainEntry = typeof entry === "string" ? { moduleName: entry } : entry;
started = true;
@@ -336,9 +333,14 @@ export function start(entry?: string | NavigationEntry) {
}
}
+export function start(entry?: string | NavigationEntry) {
+ console.log("application.start() is deprecated; use application.run() instead");
+ _start(entry);
+}
+
export function run(entry?: string | NavigationEntry) {
createRootFrame.value = false;
- start(entry);
+ _start(entry);
}
export function _resetRootView(entry?: NavigationEntry | string) {
diff --git a/tns-core-modules/image-source/image-source.android.ts b/tns-core-modules/image-source/image-source.android.ts
index 56140ba5e..175495321 100644
--- a/tns-core-modules/image-source/image-source.android.ts
+++ b/tns-core-modules/image-source/image-source.android.ts
@@ -246,8 +246,6 @@ export function fromNativeSource(source: any): ImageSource {
}
export function fromUrl(url: string): Promise {
- console.log("imageSource.fromUrl(url) is deprecated; use http.getImage(url) instead");
-
ensureHttp();
return http.getImage(url);
}
diff --git a/tns-core-modules/image-source/image-source.ios.ts b/tns-core-modules/image-source/image-source.ios.ts
index be18c1056..b7ff6531b 100644
--- a/tns-core-modules/image-source/image-source.ios.ts
+++ b/tns-core-modules/image-source/image-source.ios.ts
@@ -237,8 +237,6 @@ export function fromNativeSource(source: any): ImageSource {
}
export function fromUrl(url: string): Promise {
- console.log("imageSource.fromUrl(url) is deprecated; use http.getImage(url) instead");
-
ensureHttp();
return http.getImage(url);
}
diff --git a/tns-core-modules/package.json b/tns-core-modules/package.json
index 934818024..91a26be78 100644
--- a/tns-core-modules/package.json
+++ b/tns-core-modules/package.json
@@ -38,8 +38,8 @@
},
"nativescript": {
"platforms": {
- "ios": "4.0.0",
- "android": "4.0.0"
+ "ios": "5.0.0",
+ "android": "5.0.0"
}
},
"snapshot": {
diff --git a/tns-core-modules/ui/core/view/view-common.ts b/tns-core-modules/ui/core/view/view-common.ts
index 1f14c34d6..9dfab6815 100644
--- a/tns-core-modules/ui/core/view/view-common.ts
+++ b/tns-core-modules/ui/core/view/view-common.ts
@@ -259,7 +259,14 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
if (args.length === 2) {
options = args[1];
} else {
- // TODO: Add deprecation warning
+ if (args[0] instanceof ViewCommon) {
+ console.log("showModal(view: ViewBase, context: any, closeCallback: Function, fullscreen?: boolean, animated?: boolean, stretched?: boolean) " +
+ "is deprecated. Use showModal(view: ViewBase, modalOptions: ShowModalOptions) instead.");
+ } else {
+ console.log("showModal(moduleName: string, context: any, closeCallback: Function, fullscreen?: boolean, animated?: boolean, stretched?: boolean) " +
+ "is deprecated. Use showModal(moduleName: string, modalOptions: ShowModalOptions) instead.");
+ }
+
options = {
context: args[1],
closeCallback: args[2],
diff --git a/tns-core-modules/ui/core/view/view.ios.ts b/tns-core-modules/ui/core/view/view.ios.ts
index 53281f20e..c733f9066 100644
--- a/tns-core-modules/ui/core/view/view.ios.ts
+++ b/tns-core-modules/ui/core/view/view.ios.ts
@@ -904,6 +904,14 @@ export namespace ios {
return controller;
}
+ public viewDidLoad(): void {
+ super.viewDidLoad();
+
+ // Unify translucent and opaque bars layout
+ // this.edgesForExtendedLayout = UIRectEdgeBottom;
+ this.extendedLayoutIncludesOpaqueBars = true;
+ }
+
public viewWillLayoutSubviews(): void {
super.viewWillLayoutSubviews();
const owner = this.owner.get();
@@ -959,9 +967,6 @@ export namespace ios {
return;
}
- // Unify translucent and opaque bars layout
- this.extendedLayoutIncludesOpaqueBars = true;
-
updateAutoAdjustScrollInsets(this, owner);
if (!owner.parent) {
diff --git a/tns-core-modules/ui/frame/activity.android.ts b/tns-core-modules/ui/frame/activity.android.ts
index 946ca63df..9a4b9ce84 100644
--- a/tns-core-modules/ui/frame/activity.android.ts
+++ b/tns-core-modules/ui/frame/activity.android.ts
@@ -26,12 +26,11 @@ class NativeScriptActivity extends android.support.v7.app.AppCompatActivity {
setActivityCallbacks(this);
}
- this._callbacks.onCreate(this, savedInstanceState, super.onCreate);
+ this._callbacks.onCreate(this, savedInstanceState, this.getIntent(), super.onCreate);
}
public onNewIntent(intent: android.content.Intent): void {
- super.onNewIntent(intent);
- super.setIntent(intent);
+ this._callbacks.onNewIntent(this, intent, super.setIntent, super.onNewIntent);
}
public onSaveInstanceState(outState: android.os.Bundle): void {
diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts
index 387c9b193..f878f1709 100644
--- a/tns-core-modules/ui/frame/frame.android.ts
+++ b/tns-core-modules/ui/frame/frame.android.ts
@@ -944,11 +944,19 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
}
@profile
- public onCreate(activity: android.support.v7.app.AppCompatActivity, savedInstanceState: android.os.Bundle, superFunc: Function): void {
+ public onCreate(activity: android.support.v7.app.AppCompatActivity, savedInstanceState: android.os.Bundle, intentOrSuperFunc: android.content.Intent | Function, superFunc?: Function): void {
if (traceEnabled()) {
traceWrite(`Activity.onCreate(${savedInstanceState})`, traceCategories.NativeLifecycle);
}
+ const intent: android.content.Intent = superFunc ? intentOrSuperFunc : undefined;
+
+ if (!superFunc) {
+ console.log("AndroidActivityCallbacks.onCreate(activity: any, savedInstanceState: any, superFunc: Function) " +
+ "is deprecated. Use AndroidActivityCallbacks.onCreate(activity: any, savedInstanceState: any, intent: any, superFunc: Function) instead.");
+ superFunc = intentOrSuperFunc;
+ }
+
// If there is savedInstanceState this call will recreate all fragments that were previously in the navigation.
// We take care of associating them with a Page from our backstack in the onAttachFragment callback.
// If there is savedInstanceState and moduleLoaded is false we are restarted but process was killed.
@@ -966,6 +974,15 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
}
}
+ if (intent && intent.getAction()) {
+ application.android.notify({
+ eventName: application.AndroidApplication.activityNewIntentEvent,
+ object: application.android,
+ activity,
+ intent
+ });
+ }
+
this.setActivityContent(activity, savedInstanceState, true);
moduleLoaded = true;
}
@@ -982,6 +999,19 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
outState.putInt(ROOT_VIEW_ID_EXTRA, rootView._domId);
}
+ @profile
+ public onNewIntent(activity: android.support.v7.app.AppCompatActivity, intent: android.content.Intent, superSetIntentFunc: Function, superFunc: Function): void {
+ superFunc.call(activity, intent);
+ superSetIntentFunc.call(activity, intent);
+
+ application.android.notify({
+ eventName: application.AndroidApplication.activityNewIntentEvent,
+ object: application.android,
+ activity,
+ intent
+ });
+ }
+
@profile
public onStart(activity: any, superFunc: Function): void {
superFunc.call(activity);
@@ -1174,39 +1204,47 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
const intent = activity.getIntent();
if (fireLaunchEvent) {
+ // entry point for Angular and Vue frameworks
rootView = notifyLaunch(intent, savedInstanceState);
}
- if (shouldCreateRootFrame) {
- const extras = intent.getExtras();
- let frameId = -1;
-
- // We have extras when we call - new Frame().navigate();
- // savedInstanceState is used when activity is recreated.
- // NOTE: On API 23+ we get extras on first run.
- // Check changed - first try to get frameId from Extras if not from saveInstanceState.
- if (extras) {
- frameId = extras.getInt(INTENT_EXTRA, -1);
+ if (!rootView) {
+ // entry point for NS Core
+ if (!mainEntry) {
+ // Also handles scenarios with Angular and Vue where the notifyLaunch didn't return a root view.
+ throw new Error("Main entry is missing. App cannot be started. Verify app bootstrap.");
}
- if (savedInstanceState && frameId < 0) {
- frameId = savedInstanceState.getInt(INTENT_EXTRA, -1);
- }
+ if (shouldCreateRootFrame) {
+ const extras = intent.getExtras();
+ let frameId = -1;
- if (!rootView) {
- // If we have frameId from extras - we are starting a new activity from navigation (e.g. new Frame().navigate()))
- // Then we check if we have frameId from savedInstanceState - this happens when Activity is destroyed but app was not (e.g. suspend)
- rootView = getFrameByNumberId(frameId) || new Frame();
- }
+ // We have extras when we call - new Frame().navigate();
+ // savedInstanceState is used when activity is recreated.
+ // NOTE: On API 23+ we get extras on first run.
+ // Check changed - first try to get frameId from Extras if not from saveInstanceState.
+ if (extras) {
+ frameId = extras.getInt(INTENT_EXTRA, -1);
+ }
- if (rootView instanceof Frame) {
- rootView.navigate(mainEntry);
+ if (savedInstanceState && frameId < 0) {
+ frameId = savedInstanceState.getInt(INTENT_EXTRA, -1);
+ }
+
+ if (!rootView) {
+ // If we have frameId from extras - we are starting a new activity from navigation (e.g. new Frame().navigate()))
+ // Then we check if we have frameId from savedInstanceState - this happens when Activity is destroyed but app was not (e.g. suspend)
+ rootView = getFrameByNumberId(frameId) || new Frame();
+ }
+
+ if (rootView instanceof Frame) {
+ rootView.navigate(mainEntry);
+ } else {
+ throw new Error("A Frame must be used to navigate to a Page.");
+ }
} else {
- throw new Error("A Frame must be used to navigate to a Page.");
+ rootView = createViewFromEntry(mainEntry);
}
- } else {
- // Create the root view if the notifyLaunch didn't return it
- rootView = rootView || createViewFromEntry(mainEntry);
}
this._rootView = rootView;
diff --git a/tns-core-modules/ui/frame/frame.d.ts b/tns-core-modules/ui/frame/frame.d.ts
index ec3793fee..5983e9aa1 100644
--- a/tns-core-modules/ui/frame/frame.d.ts
+++ b/tns-core-modules/ui/frame/frame.d.ts
@@ -16,7 +16,7 @@ export * from "../page";
export class Frame extends View {
/**
* @deprecated
- *
+ *
* String value used when hooking to androidOptionSelected event (prefix `android` states that this event is available only in Android).
*/
public static androidOptionSelectedEvent: string;
@@ -33,7 +33,7 @@ export class Frame extends View {
canGoBack(): boolean;
/**
- * Navigates to a Page instance as described by the module name.
+ * Navigates to a Page instance as described by the module name.
* This method will require the module and will check for a Page property in the exports of the module.
* @param pageModuleName The name of the module to require starting from the application root.
* For example if you want to navigate to page called "myPage.js" in a folder called "subFolder" and your root folder is "app" you can call navigate method like this:
@@ -175,7 +175,7 @@ export class Frame extends View {
/**
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
- * @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
+ * @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
* @param callback - Callback function which will be executed when event is raised.
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
*/
@@ -210,7 +210,7 @@ export function goBack();
/**
* @deprecated use getFrameById() if you want to retrieve a frame different than the topmost one
- *
+ *
* Gets the frames stack.
*/
export function stack(): Array;
@@ -264,7 +264,7 @@ export interface NavigationEntry extends ViewEntry {
transitionAndroid?: NavigationTransition;
/**
- * True to record the navigation in the backstack, false otherwise.
+ * True to record the navigation in the backstack, false otherwise.
* If the parameter is set to false then the Page will be displayed but once navigated from it will not be able to be navigated back to.
*/
backstackVisible?: boolean;
@@ -350,7 +350,7 @@ export interface BackstackEntry {
}
/**
- * Represents the data passed to the androidOptionSelected event.
+ * Represents the data passed to the androidOptionSelected event.
* This event is raised by the Android OS when an option in the Activity's action bar has been selected.
*/
export interface AndroidOptionEventData extends EventData {
@@ -398,7 +398,7 @@ export interface AndroidFrame extends Observable {
/**
* @deprecated this property is not used internally
- *
+ *
* Gets or sets whether the page UI will be cached when navigating away from the page.
*/
cachePagesOnNavigate: boolean;
@@ -413,8 +413,12 @@ export interface AndroidFrame extends Observable {
export interface AndroidActivityCallbacks {
getRootView(): View;
resetActivityContent(activity: any): void;
-
+
+ /**
+ * @deprecated use onCreate(activity, savedInstanceState, intent, superFunc) instead.
+ */
onCreate(activity: any, savedInstanceState: any, superFunc: Function): void;
+ onCreate(activity: any, savedInstanceState: any, intent: any, superFunc: Function): void;
onSaveInstanceState(activity: any, outState: any, superFunc: Function): void;
onStart(activity: any, superFunc: Function): void;
onStop(activity: any, superFunc: Function): void;
@@ -423,6 +427,7 @@ export interface AndroidActivityCallbacks {
onBackPressed(activity: any, superFunc: Function): void;
onRequestPermissionsResult(activity: any, requestCode: number, permissions: Array, grantResults: Array, superFunc: Function): void;
onActivityResult(activity: any, requestCode: number, resultCode: number, data: any, superFunc: Function);
+ onNewIntent(activity: any, intent: any, superSetIntentFunc: Function, superFunc: Function): void;
}
export interface AndroidFragmentCallbacks {
diff --git a/tns-core-modules/ui/page/page.ios.ts b/tns-core-modules/ui/page/page.ios.ts
index 2c288be1d..9da43e2eb 100644
--- a/tns-core-modules/ui/page/page.ios.ts
+++ b/tns-core-modules/ui/page/page.ios.ts
@@ -68,6 +68,14 @@ class UIViewControllerImpl extends UIViewController {
return controller;
}
+ public viewDidLoad(): void {
+ super.viewDidLoad();
+
+ // Unify translucent and opaque bars layout
+ // this.edgesForExtendedLayout = UIRectEdgeBottom;
+ this.extendedLayoutIncludesOpaqueBars = true;
+ }
+
public viewWillAppear(animated: boolean): void {
super.viewWillAppear(animated);
const owner = this._owner.get();
@@ -100,9 +108,6 @@ class UIViewControllerImpl extends UIViewController {
frame._updateActionBar(owner);
}
- // Unify translucent and opaque bars layout
- this.extendedLayoutIncludesOpaqueBars = true;
-
// Set autoAdjustScrollInsets in will appear - as early as possible
iosView.updateAutoAdjustScrollInsets(this, owner);
diff --git a/tns-core-modules/ui/tab-view/tab-view.ios.ts b/tns-core-modules/ui/tab-view/tab-view.ios.ts
index 75d5f6b34..3201e9a2c 100644
--- a/tns-core-modules/ui/tab-view/tab-view.ios.ts
+++ b/tns-core-modules/ui/tab-view/tab-view.ios.ts
@@ -28,6 +28,14 @@ class UITabBarControllerImpl extends UITabBarController {
return handler;
}
+ public viewDidLoad(): void {
+ super.viewDidLoad();
+
+ // Unify translucent and opaque bars layout
+ // this.edgesForExtendedLayout = UIRectEdgeBottom;
+ this.extendedLayoutIncludesOpaqueBars = true;
+ }
+
@profile
public viewWillAppear(animated: boolean): void {
super.viewWillAppear(animated);
@@ -36,9 +44,6 @@ class UITabBarControllerImpl extends UITabBarController {
return;
}
- // Unify translucent and opaque bars layout
- this.extendedLayoutIncludesOpaqueBars = true;
-
iosView.updateAutoAdjustScrollInsets(this, owner);
if (!owner.parent) {