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)25ErrCode ReminderHelper::PublishReminder(ReminderRequest &reminder) 26 { 27 ANSR_LOGI("PublishReminder start"); 28 NotificationHelper::AddSlotByType(reminder.GetSlotType()); 29 return DelayedSingleton<AnsNotification>::GetInstance()->PublishReminder(reminder); 30 } 31 CancelReminder(const int32_t reminderId)32ErrCode ReminderHelper::CancelReminder(const int32_t reminderId) 33 { 34 ANSR_LOGI("CancelReminder start"); 35 return DelayedSingleton<AnsNotification>::GetInstance()->CancelReminder(reminderId); 36 } 37 CancelAllReminders()38ErrCode ReminderHelper::CancelAllReminders() 39 { 40 ANSR_LOGI("CancelAllReminders start"); 41 return DelayedSingleton<AnsNotification>::GetInstance()->CancelAllReminders(); 42 } 43 GetValidReminders(std::vector<sptr<ReminderRequest>> & validReminders)44ErrCode ReminderHelper::GetValidReminders(std::vector<sptr<ReminderRequest>> &validReminders) 45 { 46 ANSR_LOGI("GetValidReminders start"); 47 return DelayedSingleton<AnsNotification>::GetInstance()->GetValidReminders(validReminders); 48 } 49 AddNotificationSlot(const NotificationSlot & slot)50ErrCode ReminderHelper::AddNotificationSlot(const NotificationSlot &slot) 51 { 52 ANSR_LOGI("AddNotificationSlot start"); 53 return DelayedSingleton<AnsNotification>::GetInstance()->AddNotificationSlot(slot); 54 } 55 RemoveNotificationSlot(const NotificationConstant::SlotType & slotType)56ErrCode ReminderHelper::RemoveNotificationSlot(const NotificationConstant::SlotType &slotType) 57 { 58 ANSR_LOGI("RemoveNotificationSlot start"); 59 return DelayedSingleton<AnsNotification>::GetInstance()->RemoveNotificationSlot(slotType); 60 } 61 } 62 }