2016-03-07 02:23:30 +08:00
|
|
|
import {Plugin, Cordova} from './plugin';
|
|
|
|
|
2016-03-13 08:18:08 +08:00
|
|
|
/**
|
|
|
|
* Options for sending an SMS
|
|
|
|
*/
|
2016-03-07 02:23:30 +08:00
|
|
|
export interface smsOptions {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set to true to replace \n by a new line. Default: false
|
|
|
|
*/
|
|
|
|
replaceLineBreaks : boolean,
|
|
|
|
|
|
|
|
android : smsOptionsAndroid
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface smsOptionsAndroid {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set to "INTENT" to send SMS with the native android SMS messaging. Leaving it empty will send the SMS without opening any app.
|
|
|
|
*/
|
|
|
|
intent : string
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-03-13 07:30:16 +08:00
|
|
|
* @name SMS
|
|
|
|
* @description
|
2016-03-07 02:23:30 +08:00
|
|
|
*
|
|
|
|
* Requires Cordova plugin: cordova-plugin-sms. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin).
|
|
|
|
*
|
|
|
|
* @usage
|
2016-03-13 07:30:16 +08:00
|
|
|
* ```ts
|
2016-03-07 02:23:30 +08:00
|
|
|
*
|
2016-03-13 07:30:16 +08:00
|
|
|
* // Send a text message using default options
|
2016-03-13 07:33:10 +08:00
|
|
|
* SMS.send('416123456','Hello world!');
|
2016-03-07 02:23:30 +08:00
|
|
|
*
|
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
@Plugin({
|
2016-03-13 07:33:10 +08:00
|
|
|
plugin: 'cordova-sms-plugin',
|
|
|
|
pluginRef: 'sms',
|
2016-03-13 16:08:39 +08:00
|
|
|
repo: 'https://github.com/cordova-sms/cordova-sms-plugin'
|
2016-03-07 02:23:30 +08:00
|
|
|
})
|
|
|
|
export class SMS {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends sms to a number
|
2016-03-13 08:18:08 +08:00
|
|
|
* @param number {string|Array<string>} Phone number
|
|
|
|
* @param message {string} Message
|
|
|
|
* @param options {smsOptions} Options
|
|
|
|
* @returns {Promise<any>} Resolves promise when the SMS has been sent
|
2016-03-07 02:23:30 +08:00
|
|
|
*/
|
2016-03-07 03:51:26 +08:00
|
|
|
@Cordova()
|
2016-03-11 05:48:20 +08:00
|
|
|
static send(
|
|
|
|
number: string | string[],
|
|
|
|
message: string,
|
|
|
|
options?: smsOptions
|
|
|
|
): Promise<any> { return }
|
2016-03-07 02:23:30 +08:00
|
|
|
|
|
|
|
}
|