mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-06-19 22:11:54 -04:00
* [EGD-2569] added # and * as numeric inputs * [EGD-2569] added '+' input sign * [EGD-2569] created defines with window names for call app * [EGD-2547] contact recognition during call * [EGD-2547] moved UiCommon * [fix][EGD-2547] fix for setting empty UTF string to text gui field * [EGD-2547] adding new contact from call enter window * [EGD-2547] minor clean up and added param validation * [EGD-2547] easier method to add contact * [EGD-2569] added new keyboard profile (numeric with special signs) Desktop is passing it properly to Call app. * [EGD-2569] added transaltor to enternumberwindow * [EGD-2569] reverted unnecessary changes [EGD-2569] revert [EGD-2569] revert of not needed changes * [EGD-2569] fix in phone.kprof * [EGD-2547] unified API to call and send sms * [EGD-2547] changed default to true * [EGD-2547] minor clean up. * [EGD-2569] revert changes in PinLockWindow.cpp * [EGD-2569][fix] eneter as null char * [EGD-2547] PR fixes [EGD-2547] code review fixes / refactored UiCommon [EGD-2547] more code review fixes [EGD-2547] rem not needed cast * [EGD-2547] PR fixes * [EGD-2547] splitting of UiCommon * [EGD-2547] typo fix * [EGD-2547] revereted one line conversion from char to string.
121 lines
4.2 KiB
C++
121 lines
4.2 KiB
C++
#include "UiCommonActions.hpp"
|
|
#include "application-call/ApplicationCall.hpp"
|
|
#include "application-call/data/CallSwitchData.hpp"
|
|
#include "application-messages/ApplicationMessages.hpp"
|
|
#include "application-messages/data/SMSdata.hpp"
|
|
#include "application-messages/windows/ThreadViewWindow.hpp"
|
|
#include "application-phonebook/ApplicationPhonebook.hpp"
|
|
#include "application-phonebook/data/PhonebookItemData.hpp"
|
|
#include "service-appmgr/ApplicationManager.hpp"
|
|
#include <cassert>
|
|
#include <i18/i18.hpp>
|
|
#include <log/log.hpp>
|
|
|
|
namespace app
|
|
{
|
|
bool call(Application *app, CallOperation callOperation, const ContactRecord &contact)
|
|
{
|
|
assert(app != nullptr);
|
|
|
|
if (contact.numbers.size() != 0)
|
|
{
|
|
return call(app, callOperation, contact.numbers[0].numberE164);
|
|
}
|
|
else
|
|
{
|
|
LOG_ERROR("No contact numbers!");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool call(Application *app, CallOperation callOperation, const std::string &e164number)
|
|
{
|
|
assert(app != nullptr);
|
|
const std::string window = window::name_enterNumber;
|
|
|
|
std::unique_ptr<CallSwitchData> data;
|
|
|
|
switch (callOperation)
|
|
{
|
|
case CallOperation::ExecuteCall: {
|
|
data = std::make_unique<ExecuteCallData>(e164number.c_str());
|
|
}
|
|
break;
|
|
case CallOperation::PrepareCall: {
|
|
data = std::make_unique<EnterNumberData>(e164number.c_str());
|
|
}
|
|
break;
|
|
default: {
|
|
LOG_ERROR("callOperation not supported %d", static_cast<uint32_t>(callOperation));
|
|
return false;
|
|
}
|
|
}
|
|
return sapm::ApplicationManager::messageSwitchApplication(app, name_call, window, std::move(data));
|
|
}
|
|
|
|
bool call(Application *app, CallOperation callOperation, uint32_t key)
|
|
{
|
|
std::string keyStr;
|
|
keyStr = key;
|
|
return call(app, callOperation, keyStr);
|
|
}
|
|
|
|
bool sms(Application *app, SmsOperation smsOperation, const ContactRecord &contact)
|
|
{
|
|
assert(app != nullptr);
|
|
// TODO return to current application doesn't change application window >_>
|
|
auto param = std::shared_ptr<ContactRecord>(new ContactRecord(contact));
|
|
switch (smsOperation)
|
|
{
|
|
case SmsOperation::Add: {
|
|
return sapm::ApplicationManager::messageSwitchApplication(app, name_messages, gui::name::window::thread_view,
|
|
std::make_unique<SMSSendRequest>(param));
|
|
}
|
|
default: {
|
|
LOG_ERROR("SmsOperation not supported %d", static_cast<uint32_t>(smsOperation));
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
bool sms(Application *app, SmsOperation smsOperation, const std::string &number)
|
|
{
|
|
assert(app != nullptr);
|
|
ContactRecord contactRec;
|
|
contactRec.numbers = std::vector<ContactRecord::Number>({ContactRecord::Number(number, number)});
|
|
return sms(app, smsOperation, contactRec);
|
|
}
|
|
|
|
bool contact(Application *app, ContactOperation contactOperation, const ContactRecord &contact)
|
|
{
|
|
assert(app != nullptr);
|
|
switch (contactOperation)
|
|
{
|
|
case ContactOperation::Add: {
|
|
return sapm::ApplicationManager::messageSwitchApplication(
|
|
app, name_phonebook, "New", std::make_unique<PhonebookItemData>(std::shared_ptr<ContactRecord>(new ContactRecord(contact))));
|
|
}
|
|
break;
|
|
case ContactOperation::Details: {
|
|
return sapm::ApplicationManager::messageSwitchApplication(
|
|
app, name_phonebook, "Contact", std::make_unique<PhonebookItemData>(std::shared_ptr<ContactRecord>(new ContactRecord(contact))));
|
|
}
|
|
break;
|
|
default: {
|
|
LOG_ERROR("ContactOperation not supported %d", static_cast<uint32_t>(contactOperation));
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
bool contact(Application *app, ContactOperation contactOperation, const std::string &number)
|
|
{
|
|
assert(app != nullptr);
|
|
|
|
ContactRecord contactRecord;
|
|
contactRecord.numbers = std::vector<ContactRecord::Number>({ContactRecord::Number(number, number)});
|
|
|
|
return contact(app, contactOperation, contactRecord);
|
|
}
|
|
} // namespace app
|