This repository has been archived by the owner on Oct 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
621 changed files
with
11,620 additions
and
227 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,6 +173,8 @@ Issue Date: 20/12/2007 | |
|
||
#endif | ||
|
||
#include "aestab.h" | ||
|
||
#if defined(__cplusplus) | ||
extern "C" | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?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>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>ServiceExtension</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>XPC!</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>NSExtension</key> | ||
<dict> | ||
<key>NSExtensionPointIdentifier</key> | ||
<string>com.apple.usernotifications.service</string> | ||
<key>NSExtensionPrincipalClass</key> | ||
<string>NotificationService</string> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// NotificationService.h | ||
// ServiceExtension | ||
// | ||
// Created by rongcloud on 2018/11/26. | ||
// Copyright © 2018 RongCloud. All rights reserved. | ||
// | ||
|
||
#import <UserNotifications/UserNotifications.h> | ||
|
||
@interface NotificationService : UNNotificationServiceExtension | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// | ||
// NotificationService.m | ||
// ServiceExtension | ||
// | ||
// Created by rongcloud on 2018/11/26. | ||
// Copyright © 2018 RongCloud. All rights reserved. | ||
// | ||
|
||
#import "NotificationService.h" | ||
#import <RongIMKit/RongIMKit.h> | ||
|
||
@interface NotificationService () | ||
|
||
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver); | ||
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent; | ||
|
||
@end | ||
|
||
@implementation NotificationService | ||
|
||
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler { | ||
|
||
UNNotificationContent *content1 = request.content; | ||
NSDictionary *userInfo = content1.userInfo; | ||
NSDictionary *aps = [userInfo objectForKey:@"aps"]; | ||
NSString *category = [aps objectForKey:@"category"]; | ||
if (aps && category && [category isEqualToString:@"RC:RcCmd"]) { | ||
NSString *appData = [userInfo objectForKey:@"appData"]; | ||
NSDictionary *appDataDic = [NSJSONSerialization JSONObjectWithData:[appData dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:nil]; | ||
NSString *idString = [appDataDic objectForKey:@"rc-dlt-identifier"]; | ||
if (idString) { | ||
[[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler:^(NSArray<UNNotification *> * _Nonnull notifications) { | ||
if (notifications.count == 0) { | ||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
self.contentHandler = contentHandler; | ||
self.bestAttemptContent = [request.content mutableCopy]; | ||
self.contentHandler(self.bestAttemptContent); | ||
}); | ||
return; | ||
} | ||
|
||
for (UNNotification *notice in notifications) { | ||
UNNotificationRequest *request = notice.request; | ||
UNNotificationContent *content = request.content; | ||
NSDictionary *userInfo1 = content.userInfo; | ||
NSString *identifier = userInfo1[@"rc"][@"id"]; | ||
if ([idString isEqualToString:identifier]) { | ||
[[UNUserNotificationCenter currentNotificationCenter] removeDeliveredNotificationsWithIdentifiers:@[request.identifier]]; | ||
} | ||
} | ||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
self.contentHandler = contentHandler; | ||
self.bestAttemptContent = [request.content mutableCopy]; | ||
self.contentHandler(self.bestAttemptContent); | ||
|
||
}); | ||
|
||
}]; | ||
} | ||
} else { | ||
self.contentHandler = contentHandler; | ||
self.bestAttemptContent = [request.content mutableCopy]; | ||
self.contentHandler(self.bestAttemptContent); | ||
} | ||
} | ||
|
||
- (void)serviceExtensionTimeWillExpire { | ||
// Called just before the extension will be terminated by the system. | ||
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used. | ||
self.contentHandler(self.bestAttemptContent); | ||
} | ||
|
||
@end |
Oops, something went wrong.