mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-07-24 06:55:37 -04:00
Use specialized class to to pass phone number between apps and services instead of ambigious std::string. Introduced class (utils::PhoneNumber) wraps calls to libphonenumber providing more convienient interface. However using libphonenumber directly may be resource hungry in terms of stack, heap and cpu usage, so helper class has been introduced to pass information about phone numbers (utils::PhoneNumber::View). It is designed to maintain integrity thus can be created from an instance of utils::PhoneNumber only or moved/copied to. Add new field to the calllog db holding e164 formatted number. Both entered and e164 numbers will be needed to be able to match with contacts correctly. Add constexpr information about country codes (utils::country).
48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
#include "Options.hpp"
|
|
#include <UiCommonActions.hpp>
|
|
#include <cassert>
|
|
#include <i18/i18.hpp>
|
|
|
|
namespace gui::options
|
|
{
|
|
using namespace app;
|
|
|
|
Option call(Application *app, CallOperation callOperation, const ContactRecord &contact)
|
|
{
|
|
assert(app != nullptr);
|
|
return {UTF8(utils::localize.get("sms_call_text")) + contact.primaryName,
|
|
[app, contact, callOperation](gui::Item &item) { return app::call(app, contact); },
|
|
gui::Arrow::Enabled};
|
|
}
|
|
|
|
Option contact(Application *app,
|
|
ContactOperation contactOperation,
|
|
const ContactRecord &contactRec,
|
|
gui::Arrow arrow)
|
|
{
|
|
assert(app != nullptr);
|
|
|
|
std::string str;
|
|
switch (contactOperation) {
|
|
case ContactOperation::Details:
|
|
str = utils::localize.get("app_options_contact_details");
|
|
break;
|
|
|
|
case ContactOperation::Add:
|
|
str = utils::localize.get("app_options_contact_add");
|
|
break;
|
|
|
|
case ContactOperation::Edit:
|
|
str = utils::localize.get("app_options_contact_edit");
|
|
break;
|
|
|
|
default:
|
|
str = utils::localize.get("app_options_invalid_option");
|
|
LOG_WARN("ContactOperation %d not supported", static_cast<int>(contactOperation));
|
|
break;
|
|
}
|
|
|
|
return {str, [=](gui::Item &item) { return app::contact(app, contactOperation, contactRec); }, arrow};
|
|
}
|
|
} // namespace gui::options
|