LMMS
Loading...
Searching...
No Matches
juce_PushNotifications.cpp
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
30#if ! JUCE_ANDROID && ! JUCE_IOS && ! JUCE_MAC
32#endif
33
73
74//==============================================================================
76
78 #if JUCE_PUSH_NOTIFICATIONS
79 : pimpl (new Pimpl (*this))
80 #endif
81{
82}
83
84PushNotifications::~PushNotifications() { clearSingletonInstance(); }
85
88
90{
91 #if JUCE_PUSH_NOTIFICATIONS && (JUCE_IOS || JUCE_MAC)
92 pimpl->requestPermissionsWithSettings (settings);
93 #else
94 ignoreUnused (settings);
95 listeners.call ([] (Listener& l) { l.notificationSettingsReceived ({}); });
96 #endif
97}
98
100{
101 #if JUCE_PUSH_NOTIFICATIONS && (JUCE_IOS || JUCE_MAC)
102 pimpl->requestSettingsUsed();
103 #else
104 listeners.call ([] (Listener& l) { l.notificationSettingsReceived ({}); });
105 #endif
106}
107
109{
110 #if JUCE_PUSH_NOTIFICATIONS
111 return pimpl->areNotificationsEnabled();
112 #else
113 return false;
114 #endif
115}
116
118{
119 #if JUCE_PUSH_NOTIFICATIONS
120 pimpl->getDeliveredNotifications();
121 #endif
122}
123
125{
126 #if JUCE_PUSH_NOTIFICATIONS
127 pimpl->removeAllDeliveredNotifications();
128 #endif
129}
130
132{
133 #if JUCE_PUSH_NOTIFICATIONS
134 return pimpl->getDeviceToken();
135 #else
136 return {};
137 #endif
138}
139
141{
142 #if JUCE_PUSH_NOTIFICATIONS
143 pimpl->setupChannels (groups, channels);
144 #else
145 ignoreUnused (groups, channels);
146 #endif
147}
148
150{
151 #if JUCE_PUSH_NOTIFICATIONS
152 pimpl->getPendingLocalNotifications();
153 #endif
154}
155
157{
158 #if JUCE_PUSH_NOTIFICATIONS
159 pimpl->removeAllPendingLocalNotifications();
160 #endif
161}
162
164{
165 #if JUCE_PUSH_NOTIFICATIONS
166 pimpl->subscribeToTopic (topic);
167 #else
168 ignoreUnused (topic);
169 #endif
170}
171
173{
174 #if JUCE_PUSH_NOTIFICATIONS
175 pimpl->unsubscribeFromTopic (topic);
176 #else
177 ignoreUnused (topic);
178 #endif
179}
180
181
183{
184 #if JUCE_PUSH_NOTIFICATIONS
185 pimpl->sendLocalNotification (n);
186 #else
187 ignoreUnused (n);
188 #endif
189}
190
192{
193 #if JUCE_PUSH_NOTIFICATIONS
194 pimpl->removeDeliveredNotification (identifier);
195 #else
196 ignoreUnused (identifier);
197 #endif
198}
199
201{
202 #if JUCE_PUSH_NOTIFICATIONS
203 pimpl->removePendingLocalNotification (identifier);
204 #else
205 ignoreUnused (identifier);
206 #endif
207}
208
210 const String& collapseKey,
211 const String& messageId,
212 const String& messageType,
213 int timeToLive,
214 const StringPairArray& additionalData)
215{
216 #if JUCE_PUSH_NOTIFICATIONS
217 pimpl->sendUpstreamMessage (serverSenderId,
218 collapseKey,
219 messageId,
220 messageType,
221 timeToLive,
222 additionalData);
223 #else
224 ignoreUnused (serverSenderId, collapseKey, messageId, messageType);
225 ignoreUnused (timeToLive, additionalData);
226 #endif
227}
228
229} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
#define nullptr
Definition DistrhoDefines.h:75
Definition juce_Array.h:56
void setupChannels(const Array< ChannelGroup > &groups, const Array< Channel > &channels)
Definition juce_PushNotifications.cpp:140
ListenerList< PushNotifications::Listener > listeners
Definition juce_PushNotifications.h:698
void removePendingLocalNotification(const String &identifier)
Definition juce_PushNotifications.cpp:200
void getPendingLocalNotifications() const
Definition juce_PushNotifications.cpp:149
void addListener(Listener *l)
Definition juce_PushNotifications.cpp:86
void removeAllPendingLocalNotifications()
Definition juce_PushNotifications.cpp:156
void subscribeToTopic(const String &topic)
Definition juce_PushNotifications.cpp:163
void getDeliveredNotifications() const
Definition juce_PushNotifications.cpp:117
void removeAllDeliveredNotifications()
Definition juce_PushNotifications.cpp:124
void removeDeliveredNotification(const String &identifier)
Definition juce_PushNotifications.cpp:191
bool areNotificationsEnabled() const
Definition juce_PushNotifications.cpp:108
~PushNotifications() override
Definition juce_PushNotifications.cpp:84
void sendUpstreamMessage(const String &serverSenderId, const String &collapseKey, const String &messageId, const String &messageType, int timeToLive, const StringPairArray &additionalData)
Definition juce_PushNotifications.cpp:209
PushNotifications()
Definition juce_PushNotifications.cpp:77
void sendLocalNotification(const Notification &notification)
Definition juce_PushNotifications.cpp:182
void removeListener(Listener *l)
Definition juce_PushNotifications.cpp:87
void unsubscribeFromTopic(const String &topic)
Definition juce_PushNotifications.cpp:172
void requestSettingsUsed()
Definition juce_PushNotifications.cpp:99
void requestPermissionsWithSettings(const Settings &settings)
Definition juce_PushNotifications.cpp:89
String getDeviceToken() const
Definition juce_PushNotifications.cpp:131
Definition juce_String.h:53
Definition juce_StringPairArray.h:35
int * l
Definition inflate.c:1579
#define JUCE_IMPLEMENT_SINGLETON(Classname)
Definition juce_Singleton.h:201
Definition carla_juce.cpp:31
void ignoreUnused(Types &&...) noexcept
Definition juce_MathsFunctions.h:333
Definition juce_PushNotifications.h:594
Definition juce_PushNotifications.h:55
Image largeIcon
Definition juce_PushNotifications.h:175
BadgeIconType badgeIconType
Definition juce_PushNotifications.h:305
Progress progress
Definition juce_PushNotifications.h:193
Colour accentColour
Definition juce_PushNotifications.h:252
String body
Definition juce_PushNotifications.h:117
String icon
Definition juce_PushNotifications.h:167
bool localOnly
Definition juce_PushNotifications.h:275
Array< int > vibrationPattern
Definition juce_PushNotifications.h:266
String groupId
Definition juce_PushNotifications.h:123
TimestampVisibility timestampVisibility
Definition juce_PushNotifications.h:295
Array< Action > actions
Definition juce_PushNotifications.h:179
String channelId
Definition juce_PushNotifications.h:172
bool repeat
Definition juce_PushNotifications.h:158
int timeoutAfterMs
Definition juce_PushNotifications.h:319
GroupAlertBehaviour groupAlertBehaviour
Definition juce_PushNotifications.h:317
double triggerIntervalSec
Definition juce_PushNotifications.h:157
bool alertOnlyOnce
Definition juce_PushNotifications.h:283
int badgeNumber
Definition juce_PushNotifications.h:127
String tickerText
Definition juce_PushNotifications.h:177
Type type
Definition juce_PushNotifications.h:230
String title
Definition juce_PushNotifications.h:116
String subtitle
Definition juce_PushNotifications.h:118
String person
Definition juce_PushNotifications.h:226
bool groupSummary
Definition juce_PushNotifications.h:249
String identifier
Definition juce_PushNotifications.h:113
bool shouldAutoCancel
Definition juce_PushNotifications.h:273
var properties
Definition juce_PushNotifications.h:147
bool ongoing
Definition juce_PushNotifications.h:278
Priority priority
Definition juce_PushNotifications.h:231
String category
Definition juce_PushNotifications.h:155
std::unique_ptr< Notification > publicVersion
Definition juce_PushNotifications.h:243
bool isValid() const noexcept
Definition juce_PushNotifications.cpp:31
LockScreenAppearance lockScreenAppearance
Definition juce_PushNotifications.h:241
String groupSortKey
Definition juce_PushNotifications.h:248
LedBlinkPattern ledBlinkPattern
Definition juce_PushNotifications.h:264
URL soundToPlay
Definition juce_PushNotifications.h:128
Colour ledColour
Definition juce_PushNotifications.h:254
Definition juce_mac_PushNotifications.cpp:357
Definition juce_PushNotifications.h:388
int n
Definition crypt.c:458
#define const
Definition zconf.h:137