• 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_LOGD("called");
27     return DelayedSingleton<ReminderRequestClient>::GetInstance()->PublishReminder(reminder, reminderId);
28 }
29 
UpdateReminder(const int32_t reminderId,const ReminderRequest & reminder)30 ErrCode ReminderHelper::UpdateReminder(const int32_t reminderId, const ReminderRequest& reminder)
31 {
32     ANSR_LOGD("called");
33     return DelayedSingleton<ReminderRequestClient>::GetInstance()->UpdateReminder(reminderId, reminder);
34 }
35 
CancelReminder(const int32_t reminderId)36 ErrCode ReminderHelper::CancelReminder(const int32_t reminderId)
37 {
38     ANSR_LOGD("called");
39     return DelayedSingleton<ReminderRequestClient>::GetInstance()->CancelReminder(reminderId);
40 }
41 
CancelAllReminders()42 ErrCode ReminderHelper::CancelAllReminders()
43 {
44     ANSR_LOGD("called");
45     return DelayedSingleton<ReminderRequestClient>::GetInstance()->CancelAllReminders();
46 }
47 
GetValidReminders(std::vector<ReminderRequestAdaptation> & validReminders)48 ErrCode ReminderHelper::GetValidReminders(std::vector<ReminderRequestAdaptation> &validReminders)
49 {
50     ANSR_LOGD("called");
51     return DelayedSingleton<ReminderRequestClient>::GetInstance()->GetValidReminders(validReminders);
52 }
53 
AddNotificationSlot(const NotificationSlot & slot)54 ErrCode ReminderHelper::AddNotificationSlot(const NotificationSlot &slot)
55 {
56     ANSR_LOGD("called");
57     return DelayedSingleton<ReminderRequestClient>::GetInstance()->AddNotificationSlot(slot);
58 }
59 
RemoveNotificationSlot(const NotificationConstant::SlotType & slotType)60 ErrCode ReminderHelper::RemoveNotificationSlot(const NotificationConstant::SlotType &slotType)
61 {
62     ANSR_LOGD("called");
63     return DelayedSingleton<ReminderRequestClient>::GetInstance()->RemoveNotificationSlot(slotType);
64 }
65 
AddExcludeDate(const int32_t reminderId,const int64_t date)66 ErrCode ReminderHelper::AddExcludeDate(const int32_t reminderId, const int64_t date)
67 {
68     ANSR_LOGD("called");
69     return DelayedSingleton<ReminderRequestClient>::GetInstance()->AddExcludeDate(reminderId, date);
70 }
71 
DelExcludeDates(const int32_t reminderId)72 ErrCode ReminderHelper::DelExcludeDates(const int32_t reminderId)
73 {
74     ANSR_LOGD("called");
75     return DelayedSingleton<ReminderRequestClient>::GetInstance()->DelExcludeDates(reminderId);
76 }
77 
GetExcludeDates(const int32_t reminderId,std::vector<int64_t> & dates)78 ErrCode ReminderHelper::GetExcludeDates(const int32_t reminderId, std::vector<int64_t>& dates)
79 {
80     ANSR_LOGD("called");
81     return DelayedSingleton<ReminderRequestClient>::GetInstance()->GetExcludeDates(reminderId, dates);
82 }
83 
StartReminderAgentService()84 void ReminderHelper::StartReminderAgentService()
85 {
86     ANSR_LOGD("called");
87     DelayedSingleton<ReminderRequestClient>::GetInstance()->StartReminderAgentService();
88 }
89 }
90 }