Browse Source

Load AppName and Version for UserAgent from plist.

Thomas Buck 11 years ago
parent
commit
12a1b274ad
3 changed files with 13 additions and 6 deletions
  1. 3
    0
      RedditBar/Reddit.h
  2. 9
    5
      RedditBar/Reddit.m
  3. 1
    1
      RedditBar/RedditBar-Info.plist

+ 3
- 0
RedditBar/Reddit.h View File

34
 @property (atomic, retain) NSString *username;
34
 @property (atomic, retain) NSString *username;
35
 @property (atomic, retain) NSString *modhash;
35
 @property (atomic, retain) NSString *modhash;
36
 @property (atomic, retain) NSString *password;
36
 @property (atomic, retain) NSString *password;
37
+@property (atomic, retain) NSString *version;
38
+@property (atomic, retain) NSString *appName;
39
+@property (atomic, retain) NSString *author;
37
 @property (atomic) NSInteger length;
40
 @property (atomic) NSInteger length;
38
 @property (atomic, retain) NSArray *subreddits;
41
 @property (atomic, retain) NSArray *subreddits;
39
 
42
 

+ 9
- 5
RedditBar/Reddit.m View File

31
 
31
 
32
 @implementation Reddit
32
 @implementation Reddit
33
 
33
 
34
-NSString *version = @"1.0.0";
35
-NSString *author = @"xythobuz";
36
-NSString *appName = @"RedditBar";
37
-
38
 NSInteger maxTitleLength = 50;
34
 NSInteger maxTitleLength = 50;
39
 NSString *replaceTextForTitle = @"...";
35
 NSString *replaceTextForTitle = @"...";
36
+#define AUTHOR @"xythobuz"
40
 
37
 
41
-@synthesize username, modhash, password, length, subreddits;
38
+@synthesize username, modhash, password, version, appName, author, length, subreddits;
42
 
39
 
43
 -(id)initWithUsername:(NSString *)name Modhash:(NSString *)hash Length:(NSInteger)leng {
40
 -(id)initWithUsername:(NSString *)name Modhash:(NSString *)hash Length:(NSInteger)leng {
44
     self = [super init];
41
     self = [super init];
47
         modhash = hash;
44
         modhash = hash;
48
         password = nil;
45
         password = nil;
49
         length = leng;
46
         length = leng;
47
+        version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
48
+        appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
49
+        author = AUTHOR;
50
     }
50
     }
51
     return self;
51
     return self;
52
 }
52
 }
57
         username = name;
57
         username = name;
58
         modhash = nil;
58
         modhash = nil;
59
         password = pass;
59
         password = pass;
60
+        length = 0;
61
+        version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
62
+        appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
63
+        author = AUTHOR;
60
     }
64
     }
61
     return self;
65
     return self;
62
 }
66
 }

+ 1
- 1
RedditBar/RedditBar-Info.plist View File

21
 	<key>CFBundleSignature</key>
21
 	<key>CFBundleSignature</key>
22
 	<string>????</string>
22
 	<string>????</string>
23
 	<key>CFBundleVersion</key>
23
 	<key>CFBundleVersion</key>
24
-	<string>156</string>
24
+	<string>157</string>
25
 	<key>LSApplicationCategoryType</key>
25
 	<key>LSApplicationCategoryType</key>
26
 	<string>public.app-category.utilities</string>
26
 	<string>public.app-category.utilities</string>
27
 	<key>LSMinimumSystemVersion</key>
27
 	<key>LSMinimumSystemVersion</key>

Loading…
Cancel
Save