-
Notifications
You must be signed in to change notification settings - Fork 436
Expand file tree
/
Copy pathAppNotification.cpp
More file actions
136 lines (113 loc) · 3.76 KB
/
AppNotification.cpp
File metadata and controls
136 lines (113 loc) · 3.76 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.
#include "pch.h"
#include "AppNotification.h"
#include "Microsoft.Windows.AppNotifications.AppNotification.g.cpp"
#include "AppNotificationConferencingConfig.h"
using namespace winrt::Windows::Data::Xml::Dom;
namespace winrt::Microsoft::Windows::AppNotifications::implementation
{
AppNotification::AppNotification(hstring const& payload)
{
XmlDocument xmlDocument{};
// We call LoadXml to verify the payload is xml
xmlDocument.LoadXml(payload);
m_payload = payload;
}
hstring AppNotification::Tag()
{
auto lock{ m_lock.lock_shared() };
return m_tag;
}
void AppNotification::Tag(hstring const& tag)
{
auto lock{ m_lock.lock_exclusive() };
m_tag = tag;
}
hstring AppNotification::Group()
{
auto lock{ m_lock.lock_shared() };
return m_group;
}
void AppNotification::Group(hstring const& group)
{
auto lock{ m_lock.lock_exclusive() };
m_group = group;
}
uint32_t AppNotification::Id()
{
auto lock{ m_lock.lock_shared() };
return m_notificationId;
}
hstring AppNotification::Payload()
{
auto lock{ m_lock.lock_shared() };
return m_payload;
}
winrt::Microsoft::Windows::AppNotifications::AppNotificationProgressData AppNotification::Progress()
{
auto lock{ m_lock.lock_shared() };
return m_progressData;
}
void AppNotification::Progress(winrt::Microsoft::Windows::AppNotifications::AppNotificationProgressData const& progressData)
{
auto lock{ m_lock.lock_exclusive() };
m_progressData = progressData;
}
winrt::Windows::Foundation::DateTime AppNotification::Expiration()
{
auto lock{ m_lock.lock_shared() };
return m_expirationTime;
}
void AppNotification::Expiration(winrt::Windows::Foundation::DateTime const& expirationTime)
{
auto lock{ m_lock.lock_exclusive() };
m_expirationTime = expirationTime;
}
bool AppNotification::ExpiresOnReboot()
{
auto lock{ m_lock.lock_shared() };
return m_expiresOnReboot;
}
void AppNotification::ExpiresOnReboot(bool expiresOnReboot)
{
auto lock{ m_lock.lock_exclusive() };
m_expiresOnReboot = expiresOnReboot;
}
winrt::Microsoft::Windows::AppNotifications::AppNotificationPriority AppNotification::Priority()
{
auto lock{ m_lock.lock_shared() };
return m_priority;
}
void AppNotification::Priority(winrt::Microsoft::Windows::AppNotifications::AppNotificationPriority const& priority)
{
auto lock{ m_lock.lock_exclusive() };
m_priority = priority;
}
bool AppNotification::SuppressDisplay()
{
auto lock{ m_lock.lock_shared() };
return m_suppressDisplay;
}
void AppNotification::SuppressDisplay(bool suppressDisplay)
{
auto lock{ m_lock.lock_exclusive() };
m_suppressDisplay = suppressDisplay;
}
void AppNotification::SetNotificationId(uint32_t id)
{
auto lock{ m_lock.lock_exclusive() };
m_notificationId = id;
}
winrt::Microsoft::Windows::AppNotifications::AppNotificationConferencingConfig AppNotification::ConferencingConfig()
{
auto lock{ m_lock.lock_shared() };
return m_conferencingConfig;
}
void AppNotification::ConferencingConfig(winrt::Microsoft::Windows::AppNotifications::AppNotificationConferencingConfig const& conferencingConfig)
{
THROW_HR_IF(E_NOTIMPL, !AppNotificationConferencingConfig::IsCallingPreviewSupported());
auto lock{ m_lock.lock_exclusive() };
m_conferencingConfig = conferencingConfig;
}
}