Skip to content

Commit

Permalink
fix(web-intent): fix options param (#2450)
Browse files Browse the repository at this point in the history
* fix(web-intent): fix options param for startService, sendBroadcast, startActivityForResult, startActivity

* Update index.ts

* Update index.ts
  • Loading branch information
mcelotti authored and danielsogl committed Apr 12, 2018
1 parent 84e0aa1 commit 23b760b
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions src/@ionic-native/plugins/web-intent/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
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
* @description
Expand All @@ -25,6 +39,8 @@ import { Observable } from 'rxjs/Observable';
* this.webIntent.startActivity(options).then(onSuccess, onError);
*
* ```
* @interfaces
* IntentOptions
*/
@Plugin({
pluginName: 'WebIntent',
Expand Down Expand Up @@ -97,30 +113,21 @@ export class WebIntent extends IonicNativePlugin {

/**
* Launches an Android intent
* @param options {Object} { action: any, url: string, type?: string }
* @param options {IntentOptions}
* @returns {Promise<any>}
*/
@Cordova()
startActivity(options: {
action: any;
extras?: any;
url: string;
type?: string;
}): Promise<any> {
startActivity(options: IntentOptions): Promise<any> {
return;
}

/**
* 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>}
*/
@Cordova()
startActivityForResult(options: {
action: any;
url: string;
type?: string;
}): Promise<any> {
startActivityForResult(options: IntentOptions): Promise<any> {
return;
}

Expand Down Expand Up @@ -166,27 +173,21 @@ export class WebIntent extends IonicNativePlugin {

/**
* Sends a custom intent passing optional extras
* @param options {Object} { action: string, extras?: { option: boolean } }
* @param options {IntentOptions}
* @returns {Promise<any>}
*/
@Cordova()
sendBroadcast(options: {
action: string;
extras?: { option: boolean };
}): Promise<any> {
sendBroadcast(options: IntentOptions): Promise<any> {
return;
}

/**
* Request that a given application service be started
* @param options {Object} { action: string, extras?: { option: boolean } }
* @param options {IntentOptions}
* @returns {Promise<any>}
*/
@Cordova()
startService(options: {
action: string;
extras?: { option: boolean };
}): Promise<any> {
startService(options: IntentOptions): Promise<any> {
return;
}

Expand Down

0 comments on commit 23b760b

Please sign in to comment.