From 9c6b2e3486ee933cbfb71574270b54c36141338f Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 2 Sep 2021 14:03:09 +0300 Subject: [PATCH] add phone functions --- README.md | 12 ++++++++++++ README_ru.md | 12 ++++++++++++ samples/dialer-sample.lua | 11 +++++++++++ 3 files changed, 35 insertions(+) create mode 100644 samples/dialer-sample.lua diff --git a/README.md b/README.md index ad4be45..2646512 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,18 @@ Calendar table format: * `name` - name of the calendar; * `color` - color of the calendar in the format #XXXXXXXX. +# Phone + +* `phone:get_contacts()` - returns table of phone contacts; +* `phone:make_call(number)` - dial the number in the dialer; +* `phone:send_sms(number, [text])` - open SMS application and enter the number, optionally enter text; + +Contacts table format: + +* `lookupKey` - unique contact identifier; +* `name` - contact name; +* `number` - contact number. + # Settings * `settings:get()` - returns the settings table in an array of words format; diff --git a/README_ru.md b/README_ru.md index 7f20a71..d121957 100644 --- a/README_ru.md +++ b/README_ru.md @@ -149,6 +149,18 @@ ui:show_context_menu({ * `name` - название календаря; * `color` - цвет календаря в фолрмате #XXXXXX. +# Телефон + +* `phone:get_contacts()` - возвращает таблицу телефонных контактов; +* `phone:make_call(number)` - набрать номер в диалере; +* `phone:send_sms(number, [text])` - открыть приложение СМС и ввети номер, опционально ввести текст; + +Формат таблицы контактов: + +* `lookupKey` - уникальный идентификтор контакта; +* `name` - имя контакта; +* `number` - номер контакта. + # Настройки * `settings:get()` - возвращает таблицу настроек в формате массива слов; diff --git a/samples/dialer-sample.lua b/samples/dialer-sample.lua new file mode 100644 index 0000000..85a361c --- /dev/null +++ b/samples/dialer-sample.lua @@ -0,0 +1,11 @@ +function on_resume() + ui:show_lines({ "Make call 123", "Send SMS 123" }) +end + +function on_click(idx) + if idx == 1 then + phone:make_call("123") + else + phone:send_sms("123", "Test") + end +end