awesome-cordova-plugins/src/plugins/sms.ts

66 lines
1.4 KiB
TypeScript
Raw Normal View History

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
*/
2016-03-14 08:39:40 +08:00
replaceLineBreaks? : boolean,
2016-03-07 02:23:30 +08:00
2016-03-14 08:39:40 +08:00
android? : smsOptionsAndroid
2016-03-07 02:23:30 +08:00
}
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.
*/
2016-03-14 08:39:40 +08:00
intent? : string
2016-03-07 02:23:30 +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
* ```ts
* import {SMS} from 'ionic-native';
*
*
2016-03-07 02:23:30 +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-15 01:38:35 +08:00
repo: 'https://github.com/cordova-sms/cordova-sms-plugin',
platforms: ['Android', 'iOS', 'Windows Phone 8']
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()
static send(
number: string | string[],
message: string,
options?: smsOptions
): Promise<any> { return }
2016-03-07 02:23:30 +08:00
}