mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(android): implement a 'activityNewIntent' event
This commit is contained in:
committed by
Martin Yankov
parent
2d63c9f276
commit
3efc06ed98
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user