-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BandsintownContactPhotoProvider.m
executable file
·39 lines (30 loc) · 1.22 KB
/
BandsintownContactPhotoProvider.m
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
#import "BandsintownContactPhotoProvider.h"
@interface UNNotificationAttachment
-(NSURL *)URL;
@end
@interface UNNotificationContent
-(NSArray *)attachments;
@end
@interface UNNotificationRequest
-(UNNotificationContent *)content;
@end
@interface UNNotification
-(UNNotificationRequest *)request;
@end
@interface NCNotificationRequest
-(NSString *)threadIdentifier;
-(UNNotification *)userNotification;
@end
@implementation BandsintownContactPhotoProvider
- (DDNotificationContactPhotoPromiseOffer *)contactPhotoPromiseOfferForNotification:(DDUserNotification *)notification {
NCNotificationRequest *request = [notification request];
UNNotification *userNotification = [request userNotification];
UNNotificationRequest *notificationRequest = [userNotification request];
UNNotificationContent *content = [notificationRequest content];
UNNotificationAttachment *attachment = [content attachments][0];
if (!attachment) return nil;
NSString *imageURL = [attachment URL].path;
UIImage *image = [UIImage imageWithContentsOfFile:imageURL];
return [NSClassFromString(@"DDNotificationContactPhotoPromiseOffer") offerInstantlyResolvingPromiseWithPhotoIdentifier:imageURL image:image];
}
@end