~aleteoryx/muditaos

ref: a3aa441b0fbb94956cdafaebd92b15b5c93da59f muditaos/module-apps/notifications/NotificationData.cpp -rw-r--r-- 1.7 KiB
a3aa441b — Bartosz Cichocki [EGD-6682] Fix BT name change bug 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "NotificationData.hpp"

uint32_t notifications::Notification::priorityPool = 0;

using namespace notifications;

Notification::Notification(NotificationType type, NotificationPriority priorityType) : type{type}
{
    switch (priorityType) {
    case NotificationPriority::Next:
        if (priorityPool == highestPriority) {
            priorityPool = 0;
        }
        priority = ++priorityPool;
        break;
    case NotificationPriority::Highest:
        priority = highestPriority;
        break;
    case NotificationPriority::Lowest:
        priority = lowestPriority;
        break;
    }
}

auto Notification::getType() const noexcept -> NotificationType
{
    return type;
}

auto Notification::getPriority() const noexcept -> uint32_t
{
    return priority;
}

NotSeenSMSNotification::NotSeenSMSNotification(unsigned value)
    : Notification(NotificationType::NotSeenSms), value{value}
{}

auto NotSeenSMSNotification::getValue() const noexcept -> unsigned
{
    return value;
}

NotSeenCallNotification::NotSeenCallNotification(unsigned value, std::unique_ptr<ContactRecord> record)
    : Notification(NotificationType::NotSeenCall), value{value}, record{std::move(record)}
{}

bool NotSeenCallNotification::hasRecord() const noexcept
{
    return record != nullptr;
}

auto NotSeenCallNotification::getRecord() const noexcept -> const std::unique_ptr<ContactRecord> &
{
    return record;
}

auto NotSeenCallNotification::getValue() const noexcept -> unsigned
{
    return value;
}

TetheringNotification::TetheringNotification() : Notification(NotificationType::Tethering)
{}