forked from haxpor/Potatso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Potatso.m
50 lines (38 loc) · 1.42 KB
/
Potatso.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
//
// PotatsoManager.m
// Potatso
//
// Created by LEI on 4/4/16.
// Copyright © 2016 TouchingApp. All rights reserved.
//
#import "Potatso.h"
@implementation Potatso
+ (NSString *) sharedGroupIdentifier {
// fixed issue 13: if value isn't fixed, but use value from [[NSBundle mainBundle] bundleIdentifier], occasionally the app will fail to connect. So we fixed it via harded-code value as users dont have to customize this value anyway.
return @"group.io.wasin.potatso";
}
+ (NSURL *)sharedUrl {
return [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:[self sharedGroupIdentifier]];
}
+ (NSURL *)sharedDatabaseUrl {
return [[self sharedUrl] URLByAppendingPathComponent:@"potatso.realm"];
}
+ (NSUserDefaults *)sharedUserDefaults {
return [[NSUserDefaults alloc] initWithSuiteName:[self sharedGroupIdentifier]];
}
+ (NSURL * _Nonnull)sharedGeneralConfUrl {
return [[Potatso sharedUrl] URLByAppendingPathComponent:@"general.xxx"];
}
+ (NSURL *)sharedSocksConfUrl {
return [[Potatso sharedUrl] URLByAppendingPathComponent:@"socks.xxx"];
}
+ (NSURL *)sharedProxyConfUrl {
return [[Potatso sharedUrl] URLByAppendingPathComponent:@"proxy.xxx"];
}
+ (NSURL *)sharedHttpProxyConfUrl {
return [[Potatso sharedUrl] URLByAppendingPathComponent:@"http.xxx"];
}
+ (NSURL * _Nonnull)sharedLogUrl {
return [[Potatso sharedUrl] URLByAppendingPathComponent:@"tunnel.log"];
}
@end