65 lines
1.4 KiB
TypeScript
Raw Normal View History

2016-07-17 20:09:07 +02:00
import { Cordova, Plugin } from './plugin';
2016-03-06 13:23:30 -05:00
2016-03-12 19:18:08 -05:00
/**
* Options for sending an SMS
*/
export interface SmsOptions {
2016-03-06 13:23:30 -05:00
/**
* Set to true to replace \n by a new line. Default: false
*/
replaceLineBreaks?: boolean;
2016-03-06 13:23:30 -05:00
android?: SmsOptionsAndroid;
2016-03-06 13:23:30 -05:00
}
export interface SmsOptionsAndroid {
2016-03-06 13:23:30 -05:00
/**
* 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-06 13:23:30 -05:00
}
/**
* @name SMS
* @description
2016-03-06 13:23:30 -05: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
* ```typescript
* import { SMS } from 'ionic-native';
*
2016-03-06 13:23:30 -05:00
*
* // Send a text message using default options
* SMS.send('416123456', 'Hello world!');
2016-03-06 13:23:30 -05:00
* ```
*/
@Plugin({
2016-03-12 18:33:10 -05:00
plugin: 'cordova-sms-plugin',
pluginRef: 'sms',
2016-03-14 13:38:35 -04:00
repo: 'https://github.com/cordova-sms/cordova-sms-plugin',
platforms: ['Android', 'iOS', 'Windows Phone 8']
2016-03-06 13:23:30 -05:00
})
export class SMS {
/**
* Sends sms to a number
* @param phoneNumber {string|Array<string>} Phone number
2016-03-12 19:18:08 -05:00
* @param message {string} Message
* @param options {SmsOptions} Options
2016-03-12 19:18:08 -05:00
* @returns {Promise<any>} Resolves promise when the SMS has been sent
2016-03-06 13:23:30 -05:00
*/
2016-03-06 14:51:26 -05:00
@Cordova()
static send(
phoneNumber: string | string[],
message: string,
options?: SmsOptions
2016-07-17 20:09:07 +02:00
): Promise<any> { return; }
2016-03-06 13:23:30 -05:00
}