fix(web-intent): fix options param (#2450)

* fix(web-intent): fix options param for startService, sendBroadcast, startActivityForResult, startActivity

* Update index.ts

* Update index.ts
This commit is contained in:
mcelotti 2018-04-12 17:09:19 +02:00 committed by Daniel Sogl
parent 84e0aa1f94
commit 23b760bb01

View File

@ -2,6 +2,20 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
export interface IntentOptions {
requestCode?: number;
type?: string;
package?: string;
url?: string;
extras?: object;
action?: string;
component?: {
package: string;
class: string;
};
flags?: number[];
};
/** /**
* @name Web Intent * @name Web Intent
* @description * @description
@ -25,6 +39,8 @@ import { Observable } from 'rxjs/Observable';
* this.webIntent.startActivity(options).then(onSuccess, onError); * this.webIntent.startActivity(options).then(onSuccess, onError);
* *
* ``` * ```
* @interfaces
* IntentOptions
*/ */
@Plugin({ @Plugin({
pluginName: 'WebIntent', pluginName: 'WebIntent',
@ -97,30 +113,21 @@ export class WebIntent extends IonicNativePlugin {
/** /**
* Launches an Android intent * Launches an Android intent
* @param options {Object} { action: any, url: string, type?: string } * @param options {IntentOptions}
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
startActivity(options: { startActivity(options: IntentOptions): Promise<any> {
action: any;
extras?: any;
url: string;
type?: string;
}): Promise<any> {
return; return;
} }
/** /**
* Starts a new activity and return the result to the application * Starts a new activity and return the result to the application
* @param options {Object} { action: any, url: string, type?: string } * @param options {IntentOptions}
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
startActivityForResult(options: { startActivityForResult(options: IntentOptions): Promise<any> {
action: any;
url: string;
type?: string;
}): Promise<any> {
return; return;
} }
@ -166,27 +173,21 @@ export class WebIntent extends IonicNativePlugin {
/** /**
* Sends a custom intent passing optional extras * Sends a custom intent passing optional extras
* @param options {Object} { action: string, extras?: { option: boolean } } * @param options {IntentOptions}
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
sendBroadcast(options: { sendBroadcast(options: IntentOptions): Promise<any> {
action: string;
extras?: { option: boolean };
}): Promise<any> {
return; return;
} }
/** /**
* Request that a given application service be started * Request that a given application service be started
* @param options {Object} { action: string, extras?: { option: boolean } } * @param options {IntentOptions}
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
startService(options: { startService(options: IntentOptions): Promise<any> {
action: string;
extras?: { option: boolean };
}): Promise<any> {
return; return;
} }