Commit 1155d35a by Demid Merzlyakov

NotificationExtension code and entitlements.

parent bac388fa
......@@ -526,6 +526,7 @@
CE849DB52638C33600DEFFBD /* OneWeatherNotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = OneWeatherNotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
CE849DB72638C33600DEFFBD /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
CE849DB92638C33600DEFFBD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
CE849DE82638C59800DEFFBD /* OneWeatherNotificationServiceExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = OneWeatherNotificationServiceExtension.entitlements; sourceTree = "<group>"; };
CE89628B26175D8D00CA274A /* regenerate_objects.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = regenerate_objects.sh; sourceTree = "<group>"; };
CE89629126175DF400CA274A /* _CoreAirQuality.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = _CoreAirQuality.swift; sourceTree = "<group>"; };
CE89629326175DF400CA274A /* _CorePollutant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = _CorePollutant.swift; sourceTree = "<group>"; };
......@@ -1369,6 +1370,7 @@
CE849DB62638C33600DEFFBD /* OneWeatherNotificationServiceExtension */ = {
isa = PBXGroup;
children = (
CE849DE82638C59800DEFFBD /* OneWeatherNotificationServiceExtension.entitlements */,
CE849DB72638C33600DEFFBD /* NotificationService.swift */,
CE849DB92638C33600DEFFBD /* Info.plist */,
);
......@@ -2279,6 +2281,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7082B26061BEBA910124DD8A /* Pods-OneWeatherNotificationServiceExtension.debug.xcconfig */;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = OneWeatherNotificationServiceExtension/OneWeatherNotificationServiceExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 24W4XMQ38L;
INFOPLIST_FILE = OneWeatherNotificationServiceExtension/Info.plist;
......@@ -2300,6 +2303,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = FD761FE0D947B3A79121A941 /* Pods-OneWeatherNotificationServiceExtension.release.xcconfig */;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = OneWeatherNotificationServiceExtension/OneWeatherNotificationServiceExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 24W4XMQ38L;
INFOPLIST_FILE = OneWeatherNotificationServiceExtension/Info.plist;
......
......@@ -6,6 +6,7 @@
//
import UserNotifications
import MORichNotification
class NotificationService: UNNotificationServiceExtension {
......@@ -13,15 +14,13 @@ class NotificationService: UNNotificationServiceExtension {
var bestAttemptContent: UNMutableNotificationContent?
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
MORichNotification.setAppGroupID("group.com.onelouder.oneweather.MoEngage")
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
if let bestAttemptContent = bestAttemptContent {
// Modify the notification content here...
bestAttemptContent.title = "\(bestAttemptContent.title) [modified]"
contentHandler(bestAttemptContent)
}
MORichNotification.handle(request, withContentHandler: contentHandler)
}
override func serviceExtensionTimeWillExpire() {
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.onelouder.oneweather.MoEngage</string>
<string>group.com.onelouder.oneweather</string>
</array>
</dict>
</plist>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment