• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 #include "reminder_helper.h"
17 
18 #include "ans_log_wrapper.h"
19 #include "reminder_request_client.h"
20 #include "singleton.h"
21 
22 namespace OHOS {
23 namespace Notification {
PublishReminder(const ReminderRequest & reminder,int32_t & reminderId)24 ErrCode ReminderHelper::PublishReminder(const ReminderRequest& reminder, int32_t& reminderId)
25 {
26     ANSR_LOGI("PublishReminder start");
27     return DelayedSingleton<ReminderRequestClient>::GetInstance()->PublishReminder(reminder, reminderId);
28 }
29 
CancelReminder(const int32_t reminderId)30 ErrCode ReminderHelper::CancelReminder(const int32_t reminderId)
31 {
32     ANSR_LOGI("CancelReminder start");
33     return DelayedSingleton<ReminderRequestClient>::GetInstance()->CancelReminder(reminderId);
34 }
35 
CancelAllReminders()36 ErrCode ReminderHelper::CancelAllReminders()
37 {
38     ANSR_LOGI("CancelAllReminders start");
39     return DelayedSingleton<ReminderRequestClient>::GetInstance()->CancelAllReminders();
40 }
41 
GetValidReminders(std::vector<ReminderRequestAdaptation> & validReminders)42 ErrCode ReminderHelper::GetValidReminders(std::vector<ReminderRequestAdaptation> &validReminders)
43 {
44     ANSR_LOGI("GetValidReminders start");
45     return DelayedSingleton<ReminderRequestClient>::GetInstance()->GetValidReminders(validReminders);
46 }
47 
AddNotificationSlot(const NotificationSlot & slot)48 ErrCode ReminderHelper::AddNotificationSlot(const NotificationSlot &slot)
49 {
50     ANSR_LOGI("AddNotificationSlot start");
51     return DelayedSingleton<ReminderRequestClient>::GetInstance()->AddNotificationSlot(slot);
52 }
53 
RemoveNotificationSlot(const NotificationConstant::SlotType & slotType)54 ErrCode ReminderHelper::RemoveNotificationSlot(const NotificationConstant::SlotType &slotType)
55 {
56     ANSR_LOGI("RemoveNotificationSlot start");
57     return DelayedSingleton<ReminderRequestClient>::GetInstance()->RemoveNotificationSlot(slotType);
58 }
59 
AddExcludeDate(const int32_t reminderId,const int64_t date)60 ErrCode ReminderHelper::AddExcludeDate(const int32_t reminderId, const int64_t date)
61 {
62     ANSR_LOGI("AddExcludeDate start");
63     return DelayedSingleton<ReminderRequestClient>::GetInstance()->AddExcludeDate(reminderId, date);
64 }
65 
DelExcludeDates(const int32_t reminderId)66 ErrCode ReminderHelper::DelExcludeDates(const int32_t reminderId)
67 {
68     ANSR_LOGI("DelExcludeDates start");
69     return DelayedSingleton<ReminderRequestClient>::GetInstance()->DelExcludeDates(reminderId);
70 }
71 
GetExcludeDates(const int32_t reminderId,std::vector<int64_t> & dates)72 ErrCode ReminderHelper::GetExcludeDates(const int32_t reminderId, std::vector<int64_t>& dates)
73 {
74     ANSR_LOGI("GetExcludeDates start");
75     return DelayedSingleton<ReminderRequestClient>::GetInstance()->GetExcludeDates(reminderId, dates);
76 }
77 
StartReminderAgentService()78 void ReminderHelper::StartReminderAgentService()
79 {
80     ANSR_LOGI("StartReminderAgentService call");
81     DelayedSingleton<ReminderRequestClient>::GetInstance()->StartReminderAgentService();
82 }
83 }
84 }