This repository was archived by the owner on Sep 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathICPGithubCommits.m
More file actions
127 lines (100 loc) · 2.94 KB
/
ICPGithubCommits.m
File metadata and controls
127 lines (100 loc) · 2.94 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
//
// ICPGithubCommits.m
// Sample Inline Media Plugin
//
// Created by Codeux Software, LLC on 10/28/17.
// Copyright © 2017 Codeux Software, LLC. All rights reserved.
//
#import "ICPGithubCommits.h"
@implementation ICPGithubCommits
- (void)_performAction
{
/* You can access the original URL in the payload.
You can also modify its contents to have the
result treated differently. */
ICLPayloadMutable *payload = self.payload;
NSDictionary *templateAttributes =
@{
@"uniqueIdentifier" : payload.uniqueIdentifier,
};
NSError *templateRenderError = nil;
NSString *html = [self.template renderObject:templateAttributes error:&templateRenderError];
if (html) {
/* The -html property is non-nil */
payload.html = html;
}
[self finalizeWithError:templateRenderError];
}
+ (nullable SEL)actionForURL:(NSURL *)url
{
/*
if ( URL WE ARE NOT INTERESTED IN ) {
return nil;
}
*/
return @selector(_performAction);
}
+ (nullable ICLInlineContentModuleActionBlock)actionBlockForURL:(NSURL *)url
{
/* You don't have to define this method unless you intend to use it.
It is present in this subclass to show that it exists.
See ICLInlineContentModule.h for description. */
return nil;
}
+ (NSArray<NSString *> *)domains
{
return @[
@"github.com",
@"www.github.com"
];
}
- (nullable NSArray<NSURL *> *)styleResources
{
/* The main NSBundle will always be the host service because
plugins are loaded into same memory of the service.
You therefore have to find the bundle for this class if you
want to access any resources that it comes with. */
return @[
[[NSBundle bundleForClass:self.class] URLForResource:@"ICPGithubCommits" withExtension:@"css"]
];
}
- (nullable NSArray<NSURL *> *)scriptResources
{
/* You don't have to define this method unless you intend to use it.
It is present in this subclass to show that it exists.
See ICLInlineContentModule.h for description. */
return nil;
}
- (nullable NSURL *)templateURL
{
return [[NSBundle bundleForClass:self.class] URLForResource:@"ICPGithubCommits" withExtension:@"mustache"];
}
- (nullable NSString *)entrypoint
{
/* You don't have to define this method unless you intend to use it.
It is present in this subclass to show that it exists.
See ICLInlineContentModule.h for description. */
return nil;
}
+ (BOOL)contentUntrusted
{
/* You don't have to define this method unless you intend to use it.
It is present in this subclass to show that it exists.
See ICLInlineContentModule.h for description. */
return NO;
}
+ (BOOL)contentImageOrVideo
{
/* You don't have to define this method unless you intend to use it.
It is present in this subclass to show that it exists.
See ICLInlineContentModule.h for description. */
return NO;
}
+ (BOOL)contentNotSafeForWork
{
/* You don't have to define this method unless you intend to use it.
It is present in this subclass to show that it exists.
See ICLInlineContentModule.h for description. */
return NO;
}
@end