| 1 |
''' |
| 2 |
IOS Sms |
| 3 |
---------- |
| 4 |
''' |
| 5 |
|
| 6 |
from plyer.facades import Sms |
| 7 |
from pyobjus import autoclass, objc_str |
| 8 |
from pyobjus.dylib_manager import load_framework |
| 9 |
|
| 10 |
NSURL = autoclass('NSURL') |
| 11 |
NSString = autoclass('NSString') |
| 12 |
UIApplication = autoclass('UIApplication') |
| 13 |
load_framework('/System/Library/Frameworks/MessageUI.framework') |
| 14 |
|
| 15 |
|
| 16 |
class IOSSms(Sms): |
| 17 |
|
| 18 |
def _send(self, **kwargs): |
| 19 |
''' |
| 20 |
This method provides sending messages to recipients. |
| 21 |
|
| 22 |
Expects 2 parameters in kwargs: |
| 23 |
- recipient: String type |
| 24 |
- message: String type |
| 25 |
|
| 26 |
Opens a message interface with recipient and message information. |
| 27 |
''' |
| 28 |
recipient = kwargs.get('recipient') |
| 29 |
message = kwargs.get('message') |
| 30 |
url = "sms:" |
| 31 |
if recipient: |
| 32 |
|
| 33 |
url += str(recipient) |
| 34 |
if message: |
| 35 |
|
| 36 |
pass |
| 37 |
|
| 38 |
nsurl = NSURL.alloc().initWithString_(objc_str(url)) |
| 39 |
UIApplication.sharedApplication().openURL_(nsurl) |
| 40 |
|
| 41 |
|
| 42 |
def instance(): |
| 43 |
return IOSSms() |