From 6cd7ea1f34a80d4866314fb905de41f330b19028 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 2 Sep 2021 14:53:31 +0300 Subject: [PATCH] add phone functions #2 --- README.md | 4 +++- README_ru.md | 4 +++- samples/dialer-sample.lua | 12 ++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2646512..7bb3a77 100644 --- a/README.md +++ b/README.md @@ -154,10 +154,12 @@ Calendar table format: * `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; +* `phone:show_contact_dialog(id)` - open contact dialog; Contacts table format: -* `lookupKey` - unique contact identifier; +* `id` - contact id; +* `lookup_key` - unique contact identifier; * `name` - contact name; * `number` - contact number. diff --git a/README_ru.md b/README_ru.md index d121957..f690323 100644 --- a/README_ru.md +++ b/README_ru.md @@ -154,10 +154,12 @@ ui:show_context_menu({ * `phone:get_contacts()` - возвращает таблицу телефонных контактов; * `phone:make_call(number)` - набрать номер в диалере; * `phone:send_sms(number, [text])` - открыть приложение СМС и ввети номер, опционально ввести текст; +* `phone:show_contact_dialog(id)` - показать диалог контакта; Формат таблицы контактов: -* `lookupKey` - уникальный идентификтор контакта; +* `id` - ID контакта; +* `lookup_key` - уникальный идентификтор контакта; * `name` - имя контакта; * `number` - номер контакта. diff --git a/samples/dialer-sample.lua b/samples/dialer-sample.lua index 85a361c..e6c0d56 100644 --- a/samples/dialer-sample.lua +++ b/samples/dialer-sample.lua @@ -1,11 +1,19 @@ function on_resume() - ui:show_lines({ "Make call 123", "Send SMS 123" }) + ui:show_lines({ + "Make call 123", + "Send SMS 123", + "Show dialog" + }) end function on_click(idx) if idx == 1 then phone:make_call("123") - else + elseif idx == 2 then phone:send_sms("123", "Test") + else + local first_contact = phone:get_contacts()[1] + phone:show_contact_dialog(first_contact.id) end end +