-
Notifications
You must be signed in to change notification settings - Fork 1
/
PurchaseStatsSettings.m
38 lines (29 loc) · 995 Bytes
/
PurchaseStatsSettings.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
#import "PurchaseStatsSettings.h"
@implementation PurchaseStatsSettings {
NSDictionary *_dictionary;
}
- (id)init {
if ((self = [super init])) {
_dictionary = [[NSDictionary alloc] initWithContentsOfFile:[[NSString stringWithFormat:@"~/Library/Preferences/%@.plist", SETTINGS_DOMAIN] stringByExpandingTildeInPath]];
}
return self;
}
- (NSString *)username {
return _dictionary[SETTINGS_KEY_USERNAME];
}
- (NSString *)password {
return _dictionary[SETTINGS_KEY_PASSWORD];
}
- (BOOL)autoRefresh {
return [_dictionary[SETTINGS_KEY_AUTOREFRESH] boolValue];
}
- (PurchaseStatsAuthProvider)authProvider {
return [_dictionary[SETTINGS_KEY_AUTH_PROVIDER] isEqualToString:@"Facebook"] ? PurchaseStatsAuthProviderFacebook : PurchaseStatsAuthProviderGoogle;
}
- (BOOL)isConfigured {
return self.username.length && self.password.length;
}
- (BOOL)isProductVisible:(NSString *)productURL {
return [(_dictionary[productURL] ?: @YES) boolValue];
}
@end