@@ -8,14 +8,15 @@ namespace Fuse.Reactive.FuseJS
88 @scriptmodule FuseJS/Phone
99
1010 The Phone API allows you to launch your device's built-in
11- phone app and make calls.
11+ phone app and make calls or send messages .
1212
1313 You need to add a reference to `"Fuse.Launcher"` in your project file to use this feature.
1414
1515 ## Example
1616 ```js
1717 var phone = require("FuseJS/Phone");
1818 phone.call("+47 123 45 678");
19+ phone.sms("+47 123 45 678", "Hi there");
1920 ```
2021 */
2122 public sealed class Phone : NativeModule
@@ -25,6 +26,7 @@ namespace Fuse.Reactive.FuseJS
2526 {
2627 Resource . SetGlobalKey ( _instance = this , "FuseJS/Phone" ) ;
2728 AddMember ( new NativeFunction ( "call" , Call ) ) ;
29+ AddMember ( new NativeFunction ( "sms" , Sms ) ) ;
2830 }
2931
3032 /**
@@ -39,10 +41,31 @@ namespace Fuse.Reactive.FuseJS
3941 phone.call("+47 123 45 678");
4042 ```
4143 */
42- public static object Call ( Scripting . Context context , object [ ] args )
44+ public static object Call ( Context context , object [ ] args )
4345 {
44- string callString = ( string ) args [ 0 ] ;
45- Fuse . LauncherImpl . PhoneLauncher . LaunchCall ( callString ) ;
46+ string phoneNumber = ( string ) args [ 0 ] ;
47+ Fuse . LauncherImpl . PhoneLauncher . LaunchCall ( phoneNumber ) ;
48+ return null ;
49+ }
50+
51+ /**
52+ @scriptmethod sms(number, body)
53+ @param number (String) The number to to send a message
54+ @param body (String) The message to to send
55+
56+ Launches your device's messages app with the specified number.
57+
58+ ## Example
59+ ```js
60+ var phone = require("FuseJS/Phone");
61+ phone.sms("+47 123 45 678", "Hi there");
62+ ```
63+ */
64+ public static object Sms ( Context context , object [ ] args )
65+ {
66+ string phoneNumber = ( string ) args [ 0 ] ;
67+ string body = args . Length > 1 ? ( string ) args [ 1 ] : null ;
68+ Fuse . LauncherImpl . PhoneLauncher . LaunchSms ( phoneNumber , body ) ;
4669 return null ;
4770 }
4871 }
0 commit comments