mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge branch 'master' into border-outline
This commit is contained in:
27
.travis.yml
27
.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
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
@@ -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:
|
||||
|
||||
<!-- TOC depthFrom:2 -->
|
||||
|
||||
- [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)
|
||||
|
||||
<!-- /TOC -->
|
||||
|
||||
## 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/<your-git-username>/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 <my-fix-branch> 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 <my-fix-branch> --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).
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
22
tns-core-modules/application/application.d.ts
vendored
22
tns-core-modules/application/application.d.ts
vendored
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
},
|
||||
"nativescript": {
|
||||
"platforms": {
|
||||
"ios": "4.0.0",
|
||||
"android": "4.0.0"
|
||||
"ios": "5.0.0",
|
||||
"android": "5.0.0"
|
||||
}
|
||||
},
|
||||
"snapshot": {
|
||||
|
||||
@@ -259,7 +259,14 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
||||
if (args.length === 2) {
|
||||
options = <ShowModalOptions>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],
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 ? <android.content.Intent>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 = <Function>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(<application.AndroidActivityNewIntentEventData>{
|
||||
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(<application.AndroidActivityNewIntentEventData>{
|
||||
eventName: application.AndroidApplication.activityNewIntentEvent,
|
||||
object: application.android,
|
||||
activity,
|
||||
intent
|
||||
});
|
||||
}
|
||||
|
||||
@profile
|
||||
public onStart(activity: any, superFunc: Function): void {
|
||||
superFunc.call(activity);
|
||||
@@ -1188,7 +1218,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
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.
|
||||
@@ -1196,17 +1226,17 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
if (extras) {
|
||||
frameId = extras.getInt(INTENT_EXTRA, -1);
|
||||
}
|
||||
|
||||
|
||||
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 {
|
||||
|
||||
21
tns-core-modules/ui/frame/frame.d.ts
vendored
21
tns-core-modules/ui/frame/frame.d.ts
vendored
@@ -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<Frame>;
|
||||
@@ -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<String>, grantResults: Array<number>, 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 {
|
||||
|
||||
Reference in New Issue
Block a user