File indexing completed on 2024-05-12 04:45:59

0001 #ifndef ANDROIDINTERFACE_H
0002 #define ANDROIDINTERFACE_H
0003 
0004 #include "abstractinterface.h"
0005 #include <QObject>
0006 
0007 class AndroidInterface : public AbstractInterface
0008 {
0009     Q_OBJECT
0010 public:
0011     enum GET_TYPE : uint_fast8_t { CACHED, FETCH };
0012 
0013     static AndroidInterface *getInstance();
0014 
0015     QVariantList getCallLogs();
0016 
0017     FMH::MODEL_LIST getAccounts(const GET_TYPE &type = GET_TYPE::CACHED);
0018     FMH::MODEL getContact(const QString &id) override final;
0019     void getContacts(const GET_TYPE &type = GET_TYPE::CACHED);
0020     void getContacts() override final;
0021     bool insertContact(const FMH::MODEL &contact) override final;
0022     bool updateContact(const QString &id, const FMH::MODEL &contact) override final;
0023     bool removeContact(const QString &id) override final;
0024 
0025     static QImage contactPhoto(const QString &id);
0026     static void addContact(const QString &name, const QString &tel, const QString &tel2, const QString &tel3, const QString &email, const QString &title, const QString &org, const QString &photo, const QString &account, const QString &accountType);
0027     static void updateContact(const QString &id, const QString &field, const QString &value);
0028 
0029     static void call(const QString &tel);
0030     static void sendSMS(const QString &tel, const QString &subject, const QString &message);
0031     static void shareContact(const QString &id);
0032 
0033 
0034 private:
0035     inline static AndroidInterface *instance = nullptr;
0036     FMH::MODEL_LIST m_contacts;
0037     FMH::MODEL_LIST m_accounts;
0038 
0039     void fetchContacts();
0040     FMH::MODEL_LIST fetchAccounts();
0041 
0042 public slots:
0043 };
0044 
0045 #endif // ANDROIDINTERFACE_H