Quellcode durchsuchen

Load AppName and Version for UserAgent from plist.

Thomas Buck vor 11 Jahren
Ursprung
Commit
12a1b274ad
3 geänderte Dateien mit 13 neuen und 6 gelöschten Zeilen
  1. 3
    0
      RedditBar/Reddit.h
  2. 9
    5
      RedditBar/Reddit.m
  3. 1
    1
      RedditBar/RedditBar-Info.plist

+ 3
- 0
RedditBar/Reddit.h Datei anzeigen

@@ -34,6 +34,9 @@
34 34
 @property (atomic, retain) NSString *username;
35 35
 @property (atomic, retain) NSString *modhash;
36 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 40
 @property (atomic) NSInteger length;
38 41
 @property (atomic, retain) NSArray *subreddits;
39 42
 

+ 9
- 5
RedditBar/Reddit.m Datei anzeigen

@@ -31,14 +31,11 @@
31 31
 
32 32
 @implementation Reddit
33 33
 
34
-NSString *version = @"1.0.0";
35
-NSString *author = @"xythobuz";
36
-NSString *appName = @"RedditBar";
37
-
38 34
 NSInteger maxTitleLength = 50;
39 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 40
 -(id)initWithUsername:(NSString *)name Modhash:(NSString *)hash Length:(NSInteger)leng {
44 41
     self = [super init];
@@ -47,6 +44,9 @@ NSString *replaceTextForTitle = @"...";
47 44
         modhash = hash;
48 45
         password = nil;
49 46
         length = leng;
47
+        version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
48
+        appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
49
+        author = AUTHOR;
50 50
     }
51 51
     return self;
52 52
 }
@@ -57,6 +57,10 @@ NSString *replaceTextForTitle = @"...";
57 57
         username = name;
58 58
         modhash = nil;
59 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 65
     return self;
62 66
 }

+ 1
- 1
RedditBar/RedditBar-Info.plist Datei anzeigen

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

Laden…
Abbrechen
Speichern