1 /*
2  * Copyright (C) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef MMS_PDU_SERVICE_H
17 #define MMS_PDU_SERVICE_H
18 
19 #include "datashare_helper.h"
20 #include "datashare_predicates.h"
21 #include "iservice_registry.h"
22 #include "system_ability_definition.h"
23 
24 namespace OHOS {
25 namespace Telephony {
26 class MmsPersistHelper {
27 public:
28     MmsPersistHelper() = default;
29     ~MmsPersistHelper() = default;
30     std::string GetMmsPdu(const std::string &dbUrl);
31     void DeleteMmsPdu(const std::string &dbUrl);
32     bool InsertMmsPdu(const std::string &mmsPdu, std::string &dbUrl);
33 
34 private:
35     std::shared_ptr<DataShare::DataShareHelper> CreateSmsHelper();
36     std::shared_ptr<DataShare::DataShareHelper> CreateDataAHelper(
37         int32_t systemAbilityId, const std::string &dataAbilityUri) const;
38     bool QueryMmsPdu(const std::string &dbUrl);
39     void SetMmsPdu(const std::string &mmsPdu);
40     std::vector<std::string> SplitPdu(const std::string &mmsPdu);
41     std::vector<std::string> SplitUrl(std::string url);
42 
43 private:
44     std::string mmsPdu_;
45     std::shared_ptr<DataShare::DataShareHelper> mmsPduDataShareHelper_ = nullptr;
46 };
47 } // namespace Telephony
48 } // namespace OHOS
49 #endif