diff --git a/src/index.ts b/src/index.ts index fb3cf9ddc6..3a37548380 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,6 +20,7 @@ import { Brightness } from './plugins/brightness'; import { BLE } from './plugins/ble'; import { BluetoothSerial } from './plugins/bluetoothserial'; import { Calendar } from './plugins/calendar'; +import { CallNumber } from './plugins/call-number'; import { Camera } from './plugins/camera'; import { CameraPreview } from './plugins/camera-preview'; import { CardIO } from './plugins/card-io'; @@ -143,6 +144,7 @@ BatteryStatus, Brightness, BLE, BluetoothSerial, +CallNumber, CameraPreview, Clipboard, CodePush, @@ -208,6 +210,7 @@ window['IonicNative'] = { BLE: BLE, BluetoothSerial: BluetoothSerial, Calendar: Calendar, + CallNumber: CallNumber, Camera: Camera, CameraPreview: CameraPreview, CardIO: CardIO, diff --git a/src/plugins/call-number.ts b/src/plugins/call-number.ts new file mode 100644 index 0000000000..ef5e0e2818 --- /dev/null +++ b/src/plugins/call-number.ts @@ -0,0 +1,36 @@ +import { Plugin, Cordova } from './plugin'; + +/** + * @name CallNumber + * @description + * Call a number directly from your Cordova/Ionic application. + * + * @usage + * ``` + * import {CallNumber} from 'ionic-native'; + * + * CallNumber.callNumber(18001010101, true) + * .then(() => console.log('Launched dialer!')) + * .catch(() => console.log('Error launching dialer')); + * + * ``` + */ +@Plugin({ + plugin: 'call-number', + pluginRef: 'plugins.CallNumber', + repo: 'https://github.com/Rohfosho/CordovaCallNumberPlugin', + platforms: ['iOS', 'Android'] +}) +export class CallNumber { + /** + * Calls a phone number + * @param numberToCall {number} The phone number to call + * @param bypassAppChooser {boolean} Set to true to bypass the app chooser and go directly to dialer + */ + @Cordova({ + callbackOrder: 'reverse' + }) + static callNumber(numberToCall: number, bypassAppChooser: boolean): Promise { + return; + } +}