-
Notifications
You must be signed in to change notification settings - Fork 0
/
ASSKStoreActivity.m
executable file
·83 lines (66 loc) · 1.86 KB
/
ASSKStoreActivity.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
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
//
// Made by Aled Samuel 2015
//
#import "ASSKStoreActivity.h"
@implementation ASSKStoreActivity
- (NSString *)activityType
{
return NSStringFromClass([self class]);
}
- (UIImage *)activityImage
{
NSString *activityType = [self activityType];
NSString *filename = [NSString stringWithFormat:@"%@.bundle/%@", activityType, activityType];
if ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] == NSOrderedAscending)
{
// iOS6 icon from iconfinder.com and added by @banaslee
filename = [filename stringByAppendingString:@"-iOS6"];
}
return [UIImage imageNamed:filename];
}
- (NSString *)activityTitle
{
//return NSLocalizedStringFromTableInBundle(@"Open in Safari", NSStringFromClass([self class]), [self bundle], nil);
return @"Open SKStore Modal";
}
- (BOOL)canPerformWithActivityItems:(NSArray *)activityItems
{
for (id activityItem in activityItems)
{
if ([activityItem isKindOfClass:[NSURL class]] && [[UIApplication sharedApplication] canOpenURL:activityItem])
{
return YES;
}
}
return NO;
}
- (void)prepareWithActivityItems:(NSArray *)activityItems
{
for (id activityItem in activityItems)
{
if ([activityItem isKindOfClass:[NSURL class]] && [[UIApplication sharedApplication] canOpenURL:activityItem])
{
self.url = activityItem;
}
}
}
- (void)performActivity
{
bool completed = NO;
if (self.url)
{
// Lol what even
completed = YES;
}
[self activityDidFinish:completed];
}
- (NSBundle *)bundle
{
NSURL *bundleURL = [[NSBundle mainBundle] URLForResource:NSStringFromClass([self class]) withExtension:@"bundle"];
if (bundleURL)
{
return [NSBundle bundleWithURL:bundleURL];
}
return [NSBundle mainBundle];
}
@end