• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 "ans_notification.h"
20 #include "notification_helper.h"
21 #include "singleton.h"
22 
23 namespace OHOS {
24 namespace Notification {
PublishReminder(ReminderRequest & reminder)25 ErrCode ReminderHelper::PublishReminder(ReminderRequest &reminder)
26 {
27     ANSR_LOGI("PublishReminder start");
28     NotificationSlot slot(reminder.GetSlotType());
29     NotificationHelper::AddNotificationSlot(slot);
30     return DelayedSingleton<AnsNotification>::GetInstance()->PublishReminder(reminder);
31 }
32 
CancelReminder(const int32_t reminderId)33 ErrCode ReminderHelper::CancelReminder(const int32_t reminderId)
34 {
35     ANSR_LOGI("CancelReminder start");
36     return DelayedSingleton<AnsNotification>::GetInstance()->CancelReminder(reminderId);
37 }
38 
CancelAllReminders()39 ErrCode ReminderHelper::CancelAllReminders()
40 {
41     ANSR_LOGI("CancelAllReminders start");
42     return DelayedSingleton<AnsNotification>::GetInstance()->CancelAllReminders();
43 }
44 
GetValidReminders(std::vector<sptr<ReminderRequest>> & validReminders)45 ErrCode ReminderHelper::GetValidReminders(std::vector<sptr<ReminderRequest>> &validReminders)
46 {
47     ANSR_LOGI("GetValidReminders start");
48     return DelayedSingleton<AnsNotification>::GetInstance()->GetValidReminders(validReminders);
49 }
50 
AddNotificationSlot(const NotificationSlot & slot)51 ErrCode ReminderHelper::AddNotificationSlot(const NotificationSlot &slot)
52 {
53     ANSR_LOGI("AddNotificationSlot start");
54     return DelayedSingleton<AnsNotification>::GetInstance()->AddNotificationSlot(slot);
55 }
56 
RemoveNotificationSlot(const NotificationConstant::SlotType & slotType)57 ErrCode ReminderHelper::RemoveNotificationSlot(const NotificationConstant::SlotType &slotType)
58 {
59     ANSR_LOGI("RemoveNotificationSlot start");
60     return DelayedSingleton<AnsNotification>::GetInstance()->RemoveNotificationSlot(slotType);
61 }
62 }
63 }