1 /* 2 * Copyright (c) 2021-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 "notification_app_privileges.h" 17 18 namespace OHOS { 19 namespace Notification { NotificationAppPrivileges(const std::string & flagStr)20NotificationAppPrivileges::NotificationAppPrivileges(const std::string &flagStr) 21 { 22 if (flagStr.size() > LIVE_VIEW_ENABLED_SEQ && flagStr[LIVE_VIEW_ENABLED_SEQ] == '1') { 23 privileges_ |= 1 << LIVE_VIEW_ENABLED_SEQ; 24 } 25 if (flagStr.size() > BANNER_ENABLED_SEQ && flagStr[BANNER_ENABLED_SEQ] == '1') { 26 privileges_ |= 1 << BANNER_ENABLED_SEQ; 27 } 28 if (flagStr.size() > REMINDER_ENABLED_SEQ && flagStr[REMINDER_ENABLED_SEQ] == '1') { 29 privileges_ |= 1 << REMINDER_ENABLED_SEQ; 30 } 31 } IsLiveViewEnabled() const32bool NotificationAppPrivileges::IsLiveViewEnabled() const 33 { 34 if ((privileges_ & (1 << LIVE_VIEW_ENABLED_SEQ)) != 0) { 35 return true; 36 } 37 return false; 38 } IsBannerEnabled() const39bool NotificationAppPrivileges::IsBannerEnabled() const 40 { 41 if ((privileges_ & (1 << BANNER_ENABLED_SEQ)) != 0) { 42 return true; 43 } 44 return false; 45 } IsReminderEnabled() const46bool NotificationAppPrivileges::IsReminderEnabled() const 47 { 48 if ((privileges_ & (1 << REMINDER_ENABLED_SEQ)) != 0) { 49 return true; 50 } 51 return false; 52 } 53 } // namespace Notification 54 } // namespace OHOS