Merge lp:~rockstar/ubuntuone-ios-music/albumart-loading into lp:~ubuntuone-ios-client-team/ubuntuone-ios-music/moriarty
- albumart-loading
- Merge into moriarty
Proposed by
Paul Hummer
Status: | Merged |
---|---|
Merge reported by: | Paul Hummer |
Merged at revision: | not available |
Proposed branch: | lp:~rockstar/ubuntuone-ios-music/albumart-loading |
Merge into: | lp:~ubuntuone-ios-client-team/ubuntuone-ios-music/moriarty |
Prerequisite: | lp:~rockstar/ubuntuone-ios-music/dial-down |
Diff against target: |
705 lines (+226/-30) 19 files modified
Music/AppDelegate.h (+4/-0) Music/AppDelegate.m (+18/-2) Music/Categories/NSString+Extras.m (+5/-3) Music/Models/Album.h (+2/-2) Music/Models/Album.m (+12/-3) Music/Models/Artist.h (+1/-1) Music/Models/Artist.m (+9/-1) Music/Models/Song.h (+0/-1) Music/Models/Song.m (+17/-1) Music/Models/UOModel.h (+8/-0) Music/Models/UOModel.m (+31/-0) Music/Storyboard_iPhone.storyboard (+64/-11) Music/UOMusic.xcdatamodeld/UOMusic.xcdatamodel/contents (+4/-4) Music/Utilities/UOWebServiceController.m (+2/-0) Music/View Controllers/AlbumViewController.m (+8/-0) Music/View Controllers/ArtistViewController.m (+8/-0) Music/View Controllers/Table Cells/AlbumCell.m (+11/-0) Music/View Controllers/Table Cells/ArtistCell.m (+10/-0) Music/View Controllers/Table Cells/SongCell.m (+12/-1) |
To merge this branch: | bzr merge lp:~rockstar/ubuntuone-ios-music/albumart-loading |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michał Karnicki (community) | Approve | ||
Review via email: mp+141685@code.launchpad.net |
Commit message
Description of the change
This branch adds the album art fetching and display to the views in the places
they are prescribed. I think they're a little awkward now, but it's not
polishing time.
To post a comment you must log in.
Revision history for this message
Michał Karnicki (karni) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Music/AppDelegate.h' | |||
2 | --- Music/AppDelegate.h 2013-01-02 23:52:23 +0000 | |||
3 | +++ Music/AppDelegate.h 2013-01-02 23:52:23 +0000 | |||
4 | @@ -16,8 +16,12 @@ | |||
5 | 16 | @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; | 16 | @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; |
6 | 17 | @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; | 17 | @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; |
7 | 18 | 18 | ||
8 | 19 | @property (nonatomic, retain) NSOperationQueue *queue; | ||
9 | 20 | |||
10 | 19 | - (void)saveContext; | 21 | - (void)saveContext; |
11 | 20 | - (NSURL *)applicationDocumentsDirectory; | 22 | - (NSURL *)applicationDocumentsDirectory; |
12 | 23 | - (NSURL *)applicationCachesDirectory; | ||
13 | 24 | - (NSURL *)albumArtDirectory; | ||
14 | 21 | 25 | ||
15 | 22 | + (AppDelegate *)delegate; | 26 | + (AppDelegate *)delegate; |
16 | 23 | 27 | ||
17 | 24 | 28 | ||
18 | === modified file 'Music/AppDelegate.m' | |||
19 | --- Music/AppDelegate.m 2013-01-02 23:52:23 +0000 | |||
20 | +++ Music/AppDelegate.m 2013-01-02 23:52:23 +0000 | |||
21 | @@ -38,6 +38,7 @@ | |||
22 | 38 | 38 | ||
23 | 39 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | 39 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { |
24 | 40 | 40 | ||
25 | 41 | self.queue = [[NSOperationQueue alloc] init]; | ||
26 | 41 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | 42 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
27 | 42 | 43 | ||
28 | 43 | /* rockstar - WTF? This should just work with the target settings. */ | 44 | /* rockstar - WTF? This should just work with the target settings. */ |
29 | @@ -172,11 +173,26 @@ | |||
30 | 172 | #pragma mark - Application's Documents directory | 173 | #pragma mark - Application's Documents directory |
31 | 173 | 174 | ||
32 | 174 | // Returns the URL to the application's Documents directory. | 175 | // Returns the URL to the application's Documents directory. |
35 | 175 | - (NSURL *)applicationDocumentsDirectory | 176 | - (NSURL *)applicationDocumentsDirectory { |
34 | 176 | { | ||
36 | 177 | return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; | 177 | return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; |
37 | 178 | } | 178 | } |
38 | 179 | 179 | ||
39 | 180 | - (NSURL *)applicationCachesDirectory { | ||
40 | 181 | return [[[NSFileManager defaultManager] URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask] lastObject]; | ||
41 | 182 | } | ||
42 | 183 | |||
43 | 184 | - (NSURL *)albumArtDirectory { | ||
44 | 185 | NSURL *path = [[self applicationCachesDirectory] URLByAppendingPathComponent:@"albumArt"]; | ||
45 | 186 | if (![[NSFileManager defaultManager] fileExistsAtPath:[path path]]) { | ||
46 | 187 | NSError *error; | ||
47 | 188 | [[NSFileManager defaultManager] createDirectoryAtPath:[path path] withIntermediateDirectories:YES attributes:nil error:&error]; | ||
48 | 189 | if (error) { | ||
49 | 190 | abort(); | ||
50 | 191 | } | ||
51 | 192 | } | ||
52 | 193 | return path; | ||
53 | 194 | } | ||
54 | 195 | |||
55 | 180 | - (void)checkAuthentication { | 196 | - (void)checkAuthentication { |
56 | 181 | if (![[UOAuthManager sharedAuthManager] hasCredentials]) { | 197 | if (![[UOAuthManager sharedAuthManager] hasCredentials]) { |
57 | 182 | UITabBarController *rootViewController = (UITabBarController *)self.window.rootViewController; | 198 | UITabBarController *rootViewController = (UITabBarController *)self.window.rootViewController; |
58 | 183 | 199 | ||
59 | === modified file 'Music/Categories/NSString+Extras.m' | |||
60 | --- Music/Categories/NSString+Extras.m 2013-01-02 23:52:23 +0000 | |||
61 | +++ Music/Categories/NSString+Extras.m 2013-01-02 23:52:23 +0000 | |||
62 | @@ -45,9 +45,11 @@ | |||
63 | 45 | return [[self dearticlizedString] substringToIndex:1]; | 45 | return [[self dearticlizedString] substringToIndex:1]; |
64 | 46 | } | 46 | } |
65 | 47 | 47 | ||
69 | 48 | - (NSString *)urlParameterEncodedString; | 48 | - (NSString *)urlParameterEncodedString { |
70 | 49 | { | 49 | CFStringRef resultRef = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)self, NULL, (__bridge CFStringRef)@":/?#[]@!$&’()*+,;=", kCFStringEncodingUTF8); |
71 | 50 | NSString *result = (__bridge id)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)self, NULL, (__bridge CFStringRef)@":/?#[]@!$&’()*+,;=", kCFStringEncodingUTF8); | 50 | NSString *result = [(__bridge id)resultRef copy]; |
72 | 51 | CFRelease(resultRef); | ||
73 | 52 | |||
74 | 51 | return result; | 53 | return result; |
75 | 52 | } | 54 | } |
76 | 53 | 55 | ||
77 | 54 | 56 | ||
78 | === modified file 'Music/Models/Album.h' | |||
79 | --- Music/Models/Album.h 2013-01-02 23:52:23 +0000 | |||
80 | +++ Music/Models/Album.h 2013-01-02 23:52:23 +0000 | |||
81 | @@ -16,8 +16,7 @@ | |||
82 | 16 | @property (nonatomic, retain) NSString *albumId; | 16 | @property (nonatomic, retain) NSString *albumId; |
83 | 17 | @property (nonatomic, retain) NSString *title; | 17 | @property (nonatomic, retain) NSString *title; |
84 | 18 | @property (nonatomic, retain) NSString *url; | 18 | @property (nonatomic, retain) NSString *url; |
87 | 19 | @property (nonatomic, retain) NSString *artUrl; | 19 | @property (nonatomic, retain) NSString *artHash; |
86 | 20 | @property (nonatomic, retain) NSString *art; | ||
88 | 21 | 20 | ||
89 | 22 | @property (nonatomic, retain, readonly) NSString *dearticlizedTitle; | 21 | @property (nonatomic, retain, readonly) NSString *dearticlizedTitle; |
90 | 23 | @property (nonatomic, retain, readonly) NSString *index; | 22 | @property (nonatomic, retain, readonly) NSString *index; |
91 | @@ -26,4 +25,5 @@ | |||
92 | 26 | @property (nonatomic, retain, readonly) Artist *artist; | 25 | @property (nonatomic, retain, readonly) Artist *artist; |
93 | 27 | 26 | ||
94 | 28 | @property (nonatomic, retain) NSSet *songs; | 27 | @property (nonatomic, retain) NSSet *songs; |
95 | 28 | |||
96 | 29 | @end | 29 | @end |
97 | 30 | 30 | ||
98 | === modified file 'Music/Models/Album.m' | |||
99 | --- Music/Models/Album.m 2013-01-02 23:52:23 +0000 | |||
100 | +++ Music/Models/Album.m 2013-01-02 23:52:23 +0000 | |||
101 | @@ -11,13 +11,13 @@ | |||
102 | 11 | #import <RestKit/CoreData.h> | 11 | #import <RestKit/CoreData.h> |
103 | 12 | #import "Artist.h" | 12 | #import "Artist.h" |
104 | 13 | #import "NSString+Extras.h" | 13 | #import "NSString+Extras.h" |
105 | 14 | #import "AppDelegate.h" | ||
106 | 14 | 15 | ||
107 | 15 | @implementation Album | 16 | @implementation Album |
108 | 16 | @dynamic albumId; | 17 | @dynamic albumId; |
109 | 17 | @dynamic title; | 18 | @dynamic title; |
110 | 18 | @dynamic url; | 19 | @dynamic url; |
113 | 19 | @dynamic art; | 20 | @dynamic artHash; |
112 | 20 | @dynamic artUrl; | ||
114 | 21 | @dynamic dearticlizedTitle; | 21 | @dynamic dearticlizedTitle; |
115 | 22 | 22 | ||
116 | 23 | @synthesize index; | 23 | @synthesize index; |
117 | @@ -27,6 +27,8 @@ | |||
118 | 27 | 27 | ||
119 | 28 | @dynamic songs; | 28 | @dynamic songs; |
120 | 29 | 29 | ||
121 | 30 | #pragma mark - UOModel methods | ||
122 | 31 | |||
123 | 30 | + (RKEntityMapping *)objectMapping { | 32 | + (RKEntityMapping *)objectMapping { |
124 | 31 | RKObjectManager *manager = [RKObjectManager sharedManager]; | 33 | RKObjectManager *manager = [RKObjectManager sharedManager]; |
125 | 32 | 34 | ||
126 | @@ -35,7 +37,7 @@ | |||
127 | 35 | [mapping addAttributeMappingsFromDictionary:@{ | 37 | [mapping addAttributeMappingsFromDictionary:@{ |
128 | 36 | @"id": @"albumId", | 38 | @"id": @"albumId", |
129 | 37 | @"album_url": @"url", | 39 | @"album_url": @"url", |
131 | 38 | @"cover_art": @"art", | 40 | @"cover_art": @"artHash", |
132 | 39 | @"album_art_url": @"artUrl", | 41 | @"album_art_url": @"artUrl", |
133 | 40 | @"title": @"title", | 42 | @"title": @"title", |
134 | 41 | @"artist_id": @"artistId" | 43 | @"artist_id": @"artistId" |
135 | @@ -48,6 +50,12 @@ | |||
136 | 48 | return @"response.albums"; | 50 | return @"response.albums"; |
137 | 49 | } | 51 | } |
138 | 50 | 52 | ||
139 | 53 | - (NSString *)artPath { | ||
140 | 54 | return [[[[AppDelegate delegate] albumArtDirectory] URLByAppendingPathComponent:[NSString stringWithFormat:@"album-%@.jpg", self.albumId]] path]; | ||
141 | 55 | } | ||
142 | 56 | |||
143 | 57 | #pragma mark - Model specific methods | ||
144 | 58 | |||
145 | 51 | - (void)setTitle:(NSString *)title { | 59 | - (void)setTitle:(NSString *)title { |
146 | 52 | [self setPrimitiveValue:title forKey:@"title"]; | 60 | [self setPrimitiveValue:title forKey:@"title"]; |
147 | 53 | [self setValue:[[title dearticlizedString] uppercaseString] forKey:@"dearticlizedTitle"]; | 61 | [self setValue:[[title dearticlizedString] uppercaseString] forKey:@"dearticlizedTitle"]; |
148 | @@ -82,4 +90,5 @@ | |||
149 | 82 | return _index; | 90 | return _index; |
150 | 83 | } | 91 | } |
151 | 84 | 92 | ||
152 | 93 | |||
153 | 85 | @end | 94 | @end |
154 | 86 | 95 | ||
155 | === modified file 'Music/Models/Artist.h' | |||
156 | --- Music/Models/Artist.h 2013-01-02 23:52:23 +0000 | |||
157 | +++ Music/Models/Artist.h 2013-01-02 23:52:23 +0000 | |||
158 | @@ -15,10 +15,10 @@ | |||
159 | 15 | @property (nonatomic, retain) NSString *artistId; | 15 | @property (nonatomic, retain) NSString *artistId; |
160 | 16 | @property (nonatomic, retain) NSString *name; | 16 | @property (nonatomic, retain) NSString *name; |
161 | 17 | @property (nonatomic, retain) NSString *url; | 17 | @property (nonatomic, retain) NSString *url; |
162 | 18 | @property (nonatomic, retain) NSString *artUrl; | ||
163 | 19 | 18 | ||
164 | 20 | @property (nonatomic, retain, readonly) NSString *dearticlizedName; | 19 | @property (nonatomic, retain, readonly) NSString *dearticlizedName; |
165 | 21 | @property (nonatomic, retain, readonly) NSString *index; | 20 | @property (nonatomic, retain, readonly) NSString *index; |
166 | 22 | 21 | ||
167 | 23 | @property (nonatomic, retain) NSSet *albums; | 22 | @property (nonatomic, retain) NSSet *albums; |
168 | 23 | |||
169 | 24 | @end | 24 | @end |
170 | 25 | 25 | ||
171 | === modified file 'Music/Models/Artist.m' | |||
172 | --- Music/Models/Artist.m 2013-01-02 23:52:23 +0000 | |||
173 | +++ Music/Models/Artist.m 2013-01-02 23:52:23 +0000 | |||
174 | @@ -9,17 +9,19 @@ | |||
175 | 9 | #import "Artist.h" | 9 | #import "Artist.h" |
176 | 10 | #import <RestKit/RestKit.h> | 10 | #import <RestKit/RestKit.h> |
177 | 11 | #import "NSString+Extras.h" | 11 | #import "NSString+Extras.h" |
178 | 12 | #import "AppDelegate.h" | ||
179 | 12 | 13 | ||
180 | 13 | @implementation Artist | 14 | @implementation Artist |
181 | 14 | @dynamic artistId; | 15 | @dynamic artistId; |
182 | 15 | @dynamic name; | 16 | @dynamic name; |
183 | 16 | @dynamic url; | 17 | @dynamic url; |
184 | 17 | @dynamic artUrl; | ||
185 | 18 | @dynamic albums; | 18 | @dynamic albums; |
186 | 19 | @dynamic dearticlizedName; | 19 | @dynamic dearticlizedName; |
187 | 20 | 20 | ||
188 | 21 | @synthesize index; | 21 | @synthesize index; |
189 | 22 | 22 | ||
190 | 23 | #pragma mark - UOModel methods | ||
191 | 24 | |||
192 | 23 | + (RKEntityMapping *)objectMapping { | 25 | + (RKEntityMapping *)objectMapping { |
193 | 24 | RKObjectManager *manager = [RKObjectManager sharedManager]; | 26 | RKObjectManager *manager = [RKObjectManager sharedManager]; |
194 | 25 | 27 | ||
195 | @@ -38,6 +40,12 @@ | |||
196 | 38 | return @"response.artists"; | 40 | return @"response.artists"; |
197 | 39 | } | 41 | } |
198 | 40 | 42 | ||
199 | 43 | - (NSString *)artPath { | ||
200 | 44 | return [[[[AppDelegate delegate] albumArtDirectory] URLByAppendingPathComponent:[NSString stringWithFormat:@"artist-%@.jpg", self.artistId]] path]; | ||
201 | 45 | } | ||
202 | 46 | |||
203 | 47 | #pragma mark - Model specific methods | ||
204 | 48 | |||
205 | 41 | - (void)setName:(NSString *)name { | 49 | - (void)setName:(NSString *)name { |
206 | 42 | [self setPrimitiveValue:name forKey:@"name"]; | 50 | [self setPrimitiveValue:name forKey:@"name"]; |
207 | 43 | [self setValue:[[name dearticlizedString] uppercaseString] forKey:@"dearticlizedName"]; | 51 | [self setValue:[[name dearticlizedString] uppercaseString] forKey:@"dearticlizedName"]; |
208 | 44 | 52 | ||
209 | === modified file 'Music/Models/Song.h' | |||
210 | --- Music/Models/Song.h 2013-01-02 23:52:23 +0000 | |||
211 | +++ Music/Models/Song.h 2013-01-02 23:52:23 +0000 | |||
212 | @@ -15,7 +15,6 @@ | |||
213 | 15 | @interface Song : UOModel | 15 | @interface Song : UOModel |
214 | 16 | 16 | ||
215 | 17 | @property (nonatomic, retain) NSString *url; | 17 | @property (nonatomic, retain) NSString *url; |
216 | 18 | @property (nonatomic, retain) NSString *artUrl; | ||
217 | 19 | @property (nonatomic, retain) NSString *suffix; | 18 | @property (nonatomic, retain) NSString *suffix; |
218 | 20 | @property (nonatomic, retain) NSString *track; | 19 | @property (nonatomic, retain) NSString *track; |
219 | 21 | @property (nonatomic, retain) NSString *title; | 20 | @property (nonatomic, retain) NSString *title; |
220 | 22 | 21 | ||
221 | === modified file 'Music/Models/Song.m' | |||
222 | --- Music/Models/Song.m 2013-01-02 23:52:23 +0000 | |||
223 | +++ Music/Models/Song.m 2013-01-02 23:52:23 +0000 | |||
224 | @@ -11,11 +11,11 @@ | |||
225 | 11 | #import "Artist.h" | 11 | #import "Artist.h" |
226 | 12 | #import "Album.h" | 12 | #import "Album.h" |
227 | 13 | #import "NSString+Extras.h" | 13 | #import "NSString+Extras.h" |
228 | 14 | #import "AppDelegate.h" | ||
229 | 14 | 15 | ||
230 | 15 | @implementation Song | 16 | @implementation Song |
231 | 16 | 17 | ||
232 | 17 | @dynamic url; | 18 | @dynamic url; |
233 | 18 | @dynamic artUrl; | ||
234 | 19 | @dynamic suffix; | 19 | @dynamic suffix; |
235 | 20 | @dynamic track; | 20 | @dynamic track; |
236 | 21 | @dynamic title; | 21 | @dynamic title; |
237 | @@ -32,11 +32,15 @@ | |||
238 | 32 | @dynamic dearticlizedTitle; | 32 | @dynamic dearticlizedTitle; |
239 | 33 | 33 | ||
240 | 34 | @synthesize index; | 34 | @synthesize index; |
241 | 35 | /* Override to fall through to album's artUrl */ | ||
242 | 36 | @synthesize artUrl; | ||
243 | 35 | 37 | ||
244 | 36 | @dynamic album; | 38 | @dynamic album; |
245 | 37 | @dynamic artist; | 39 | @dynamic artist; |
246 | 38 | @dynamic albumArtist; | 40 | @dynamic albumArtist; |
247 | 39 | 41 | ||
248 | 42 | #pragma mark - UOModel methods | ||
249 | 43 | |||
250 | 40 | + (RKEntityMapping *)objectMapping { | 44 | + (RKEntityMapping *)objectMapping { |
251 | 41 | RKObjectManager *manager = [RKObjectManager sharedManager]; | 45 | RKObjectManager *manager = [RKObjectManager sharedManager]; |
252 | 42 | 46 | ||
253 | @@ -44,7 +48,9 @@ | |||
254 | 44 | [mapping setIdentificationAttributes:@[@"songId"]]; | 48 | [mapping setIdentificationAttributes:@[@"songId"]]; |
255 | 45 | [mapping addAttributeMappingsFromDictionary:@{ | 49 | [mapping addAttributeMappingsFromDictionary:@{ |
256 | 46 | @"song_url": @"url", | 50 | @"song_url": @"url", |
257 | 51 | /* Disabled, since we want to fall through to album's art. | ||
258 | 47 | @"song_art_url": @"artUrl", | 52 | @"song_art_url": @"artUrl", |
259 | 53 | */ | ||
260 | 48 | @"suffix": @"suffix", | 54 | @"suffix": @"suffix", |
261 | 49 | @"track": @"track", | 55 | @"track": @"track", |
262 | 50 | @"title": @"title", | 56 | @"title": @"title", |
263 | @@ -69,6 +75,16 @@ | |||
264 | 69 | return @"response.songs"; | 75 | return @"response.songs"; |
265 | 70 | } | 76 | } |
266 | 71 | 77 | ||
267 | 78 | - (NSString *)artPath { | ||
268 | 79 | return self.album.artPath; | ||
269 | 80 | } | ||
270 | 81 | |||
271 | 82 | #pragma mark - Model specific methods | ||
272 | 83 | |||
273 | 84 | - (NSString *)artUrl { | ||
274 | 85 | return self.album.artUrl; | ||
275 | 86 | } | ||
276 | 87 | |||
277 | 72 | - (void)setTitle:(NSString *)_title { | 88 | - (void)setTitle:(NSString *)_title { |
278 | 73 | [self setPrimitiveValue:_title forKey:@"title"]; | 89 | [self setPrimitiveValue:_title forKey:@"title"]; |
279 | 74 | [self setValue:[[_title dearticlizedString] uppercaseString] forKey:@"dearticlizedTitle"]; | 90 | [self setValue:[[_title dearticlizedString] uppercaseString] forKey:@"dearticlizedTitle"]; |
280 | 75 | 91 | ||
281 | === modified file 'Music/Models/UOModel.h' | |||
282 | --- Music/Models/UOModel.h 2013-01-02 23:52:23 +0000 | |||
283 | +++ Music/Models/UOModel.h 2013-01-02 23:52:23 +0000 | |||
284 | @@ -14,4 +14,12 @@ | |||
285 | 14 | + (void)registerMapping; | 14 | + (void)registerMapping; |
286 | 15 | + (RKEntityMapping *)objectMapping; | 15 | + (RKEntityMapping *)objectMapping; |
287 | 16 | + (NSString *)keyPath; | 16 | + (NSString *)keyPath; |
288 | 17 | |||
289 | 18 | /* Not used for playlist */ | ||
290 | 19 | @property (nonatomic, retain) NSString *artUrl; | ||
291 | 20 | |||
292 | 21 | /* Used for fetching art */ | ||
293 | 22 | @property (nonatomic, readonly) UIImage *art; | ||
294 | 23 | - (NSString *)artPath; | ||
295 | 24 | - (void)fetchArt:(void (^)(UIImage *))completionBlock; | ||
296 | 17 | @end | 25 | @end |
297 | 18 | 26 | ||
298 | === modified file 'Music/Models/UOModel.m' | |||
299 | --- Music/Models/UOModel.m 2013-01-02 23:52:23 +0000 | |||
300 | +++ Music/Models/UOModel.m 2013-01-02 23:52:23 +0000 | |||
301 | @@ -8,9 +8,13 @@ | |||
302 | 8 | 8 | ||
303 | 9 | #import "UOModel.h" | 9 | #import "UOModel.h" |
304 | 10 | #import <RestKit/RestKit.h> | 10 | #import <RestKit/RestKit.h> |
305 | 11 | #import "AppDelegate.h" | ||
306 | 12 | #import "UOAuthManager.h" | ||
307 | 11 | 13 | ||
308 | 12 | @implementation UOModel | 14 | @implementation UOModel |
309 | 13 | 15 | ||
310 | 16 | @dynamic artUrl; | ||
311 | 17 | |||
312 | 14 | + (void)registerMapping { | 18 | + (void)registerMapping { |
313 | 15 | RKObjectManager *manager = [RKObjectManager sharedManager]; | 19 | RKObjectManager *manager = [RKObjectManager sharedManager]; |
314 | 16 | 20 | ||
315 | @@ -32,4 +36,31 @@ | |||
316 | 32 | return @""; | 36 | return @""; |
317 | 33 | } | 37 | } |
318 | 34 | 38 | ||
319 | 39 | - (UIImage *)art { | ||
320 | 40 | NSString *path = [self artPath]; | ||
321 | 41 | if (![[NSFileManager defaultManager] fileExistsAtPath:path]) { | ||
322 | 42 | return nil; | ||
323 | 43 | } | ||
324 | 44 | return [UIImage imageWithContentsOfFile:path]; | ||
325 | 45 | } | ||
326 | 46 | |||
327 | 47 | - (void)fetchArt:(void (^)(UIImage *))completionBlock { | ||
328 | 48 | NSOperationQueue *queue = [[AppDelegate delegate] queue]; | ||
329 | 49 | NSString *path = [self artPath]; | ||
330 | 50 | NSURLRequest *echo = [UOAuthManager oauthRequestForPath:self.artUrl]; | ||
331 | 51 | NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:self.artUrl]]; | ||
332 | 52 | [request setHTTPMethod:@"GET"]; | ||
333 | 53 | [request addValue:[echo valueForHTTPHeaderField:@"Authorization"] forHTTPHeaderField:@"Authorization"]; | ||
334 | 54 | |||
335 | 55 | [NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) { | ||
336 | 56 | UIImage *image = [UIImage imageWithData:data]; | ||
337 | 57 | [UIImageJPEGRepresentation(image, 1) writeToFile:path atomically:YES]; | ||
338 | 58 | completionBlock(image); | ||
339 | 59 | }]; | ||
340 | 60 | } | ||
341 | 61 | |||
342 | 62 | - (NSString *)artPath { | ||
343 | 63 | return nil; | ||
344 | 64 | } | ||
345 | 65 | |||
346 | 35 | @end | 66 | @end |
347 | 36 | 67 | ||
348 | === modified file 'Music/Storyboard_iPhone.storyboard' | |||
349 | --- Music/Storyboard_iPhone.storyboard 2013-01-02 23:52:23 +0000 | |||
350 | +++ Music/Storyboard_iPhone.storyboard 2013-01-02 23:52:23 +0000 | |||
351 | @@ -36,7 +36,7 @@ | |||
352 | 36 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | 36 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
353 | 37 | <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 37 | <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
354 | 38 | <prototypes> | 38 | <prototypes> |
356 | 39 | <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="Wy4-11-qhh" detailTextLabel="PUO-bG-eLt" style="IBUITableViewCellStyleSubtitle" id="TCk-Kb-c61" customClass="ArtistCell"> | 39 | <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="Wy4-11-qhh" detailTextLabel="PUO-bG-eLt" imageView="EvX-DO-a8s" style="IBUITableViewCellStyleSubtitle" id="TCk-Kb-c61" customClass="ArtistCell"> |
357 | 40 | <rect key="frame" x="0.0" y="22" width="320" height="44"/> | 40 | <rect key="frame" x="0.0" y="22" width="320" height="44"/> |
358 | 41 | <autoresizingMask key="autoresizingMask"/> | 41 | <autoresizingMask key="autoresizingMask"/> |
359 | 42 | <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> | 42 | <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> |
360 | @@ -44,19 +44,23 @@ | |||
361 | 44 | <autoresizingMask key="autoresizingMask"/> | 44 | <autoresizingMask key="autoresizingMask"/> |
362 | 45 | <subviews> | 45 | <subviews> |
363 | 46 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Wy4-11-qhh"> | 46 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Wy4-11-qhh"> |
365 | 47 | <rect key="frame" x="10" y="2" width="38" height="22"/> | 47 | <rect key="frame" x="53" y="2" width="38" height="22"/> |
366 | 48 | <autoresizingMask key="autoresizingMask"/> | 48 | <autoresizingMask key="autoresizingMask"/> |
367 | 49 | <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/> | 49 | <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/> |
368 | 50 | <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> | 50 | <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> |
369 | 51 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> | 51 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> |
370 | 52 | </label> | 52 | </label> |
371 | 53 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="PUO-bG-eLt"> | 53 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="PUO-bG-eLt"> |
373 | 54 | <rect key="frame" x="10" y="24" width="47" height="18"/> | 54 | <rect key="frame" x="53" y="24" width="47" height="18"/> |
374 | 55 | <autoresizingMask key="autoresizingMask"/> | 55 | <autoresizingMask key="autoresizingMask"/> |
375 | 56 | <fontDescription key="fontDescription" type="system" pointSize="14"/> | 56 | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
376 | 57 | <color key="textColor" red="0.50196078431372548" green="0.50196078431372548" blue="0.50196078431372548" alpha="1" colorSpace="calibratedRGB"/> | 57 | <color key="textColor" red="0.50196078431372548" green="0.50196078431372548" blue="0.50196078431372548" alpha="1" colorSpace="calibratedRGB"/> |
377 | 58 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> | 58 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> |
378 | 59 | </label> | 59 | </label> |
379 | 60 | <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="default-album-art-120.png" id="EvX-DO-a8s"> | ||
380 | 61 | <rect key="frame" x="0.0" y="0.0" width="43" height="43"/> | ||
381 | 62 | <autoresizingMask key="autoresizingMask"/> | ||
382 | 63 | </imageView> | ||
383 | 60 | </subviews> | 64 | </subviews> |
384 | 61 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 65 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
385 | 62 | </view> | 66 | </view> |
386 | @@ -85,12 +89,32 @@ | |||
387 | 85 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | 89 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
388 | 86 | <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 90 | <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
389 | 87 | <prototypes> | 91 | <prototypes> |
391 | 88 | <tableViewCell contentMode="scaleToFill" selectionStyle="blue" indentationWidth="10" reuseIdentifier="Cell" id="Y5x-0G-rno" customClass="AlbumCell"> | 92 | <tableViewCell contentMode="scaleToFill" selectionStyle="blue" indentationWidth="10" reuseIdentifier="Cell" textLabel="G72-IX-jh9" detailTextLabel="VIc-Rn-YXm" imageView="F2l-py-JAO" style="IBUITableViewCellStyleSubtitle" id="Y5x-0G-rno" customClass="AlbumCell"> |
392 | 89 | <rect key="frame" x="0.0" y="22" width="320" height="44"/> | 93 | <rect key="frame" x="0.0" y="22" width="320" height="44"/> |
393 | 90 | <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | 94 | <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> |
394 | 91 | <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> | 95 | <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> |
395 | 92 | <rect key="frame" x="0.0" y="0.0" width="320" height="43"/> | 96 | <rect key="frame" x="0.0" y="0.0" width="320" height="43"/> |
396 | 93 | <autoresizingMask key="autoresizingMask"/> | 97 | <autoresizingMask key="autoresizingMask"/> |
397 | 98 | <subviews> | ||
398 | 99 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="G72-IX-jh9"> | ||
399 | 100 | <rect key="frame" x="53" y="2" width="38" height="22"/> | ||
400 | 101 | <autoresizingMask key="autoresizingMask"/> | ||
401 | 102 | <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/> | ||
402 | 103 | <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> | ||
403 | 104 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> | ||
404 | 105 | </label> | ||
405 | 106 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="VIc-Rn-YXm"> | ||
406 | 107 | <rect key="frame" x="53" y="24" width="47" height="18"/> | ||
407 | 108 | <autoresizingMask key="autoresizingMask"/> | ||
408 | 109 | <fontDescription key="fontDescription" type="system" pointSize="14"/> | ||
409 | 110 | <color key="textColor" red="0.50196078431372548" green="0.50196078431372548" blue="0.50196078431372548" alpha="1" colorSpace="calibratedRGB"/> | ||
410 | 111 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> | ||
411 | 112 | </label> | ||
412 | 113 | <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="default-album-art-120.png" id="F2l-py-JAO"> | ||
413 | 114 | <rect key="frame" x="0.0" y="0.0" width="43" height="43"/> | ||
414 | 115 | <autoresizingMask key="autoresizingMask"/> | ||
415 | 116 | </imageView> | ||
416 | 117 | </subviews> | ||
417 | 94 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 118 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
418 | 95 | </view> | 119 | </view> |
419 | 96 | <connections> | 120 | <connections> |
420 | @@ -146,12 +170,32 @@ | |||
421 | 146 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | 170 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
422 | 147 | <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 171 | <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
423 | 148 | <prototypes> | 172 | <prototypes> |
425 | 149 | <tableViewCell contentMode="scaleToFill" selectionStyle="blue" indentationWidth="10" reuseIdentifier="Cell" id="vAU-q1-3Z9" customClass="SongCell"> | 173 | <tableViewCell contentMode="scaleToFill" selectionStyle="blue" indentationWidth="10" reuseIdentifier="Cell" textLabel="0Be-Uu-e1M" detailTextLabel="cgX-vu-iNg" imageView="xX5-x4-y65" style="IBUITableViewCellStyleSubtitle" id="vAU-q1-3Z9" customClass="SongCell"> |
426 | 150 | <rect key="frame" x="0.0" y="22" width="320" height="44"/> | 174 | <rect key="frame" x="0.0" y="22" width="320" height="44"/> |
427 | 151 | <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | 175 | <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> |
428 | 152 | <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> | 176 | <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> |
429 | 153 | <rect key="frame" x="0.0" y="0.0" width="320" height="43"/> | 177 | <rect key="frame" x="0.0" y="0.0" width="320" height="43"/> |
430 | 154 | <autoresizingMask key="autoresizingMask"/> | 178 | <autoresizingMask key="autoresizingMask"/> |
431 | 179 | <subviews> | ||
432 | 180 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="0Be-Uu-e1M"> | ||
433 | 181 | <rect key="frame" x="53" y="2" width="38" height="22"/> | ||
434 | 182 | <autoresizingMask key="autoresizingMask"/> | ||
435 | 183 | <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/> | ||
436 | 184 | <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> | ||
437 | 185 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> | ||
438 | 186 | </label> | ||
439 | 187 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cgX-vu-iNg"> | ||
440 | 188 | <rect key="frame" x="53" y="24" width="47" height="18"/> | ||
441 | 189 | <autoresizingMask key="autoresizingMask"/> | ||
442 | 190 | <fontDescription key="fontDescription" type="system" pointSize="14"/> | ||
443 | 191 | <color key="textColor" red="0.50196078431372548" green="0.50196078431372548" blue="0.50196078431372548" alpha="1" colorSpace="calibratedRGB"/> | ||
444 | 192 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> | ||
445 | 193 | </label> | ||
446 | 194 | <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="default-album-art-120.png" id="xX5-x4-y65"> | ||
447 | 195 | <rect key="frame" x="0.0" y="0.0" width="43" height="43"/> | ||
448 | 196 | <autoresizingMask key="autoresizingMask"/> | ||
449 | 197 | </imageView> | ||
450 | 198 | </subviews> | ||
451 | 155 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 199 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
452 | 156 | </view> | 200 | </view> |
453 | 157 | </tableViewCell> | 201 | </tableViewCell> |
454 | @@ -218,7 +262,7 @@ | |||
455 | 218 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | 262 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
456 | 219 | <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 263 | <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
457 | 220 | <prototypes> | 264 | <prototypes> |
459 | 221 | <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="lHq-bS-Zm9" detailTextLabel="03B-YT-E7s" style="IBUITableViewCellStyleSubtitle" id="5s2-Qn-BOB" customClass="AlbumCell"> | 265 | <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="lHq-bS-Zm9" detailTextLabel="03B-YT-E7s" imageView="apM-jL-xHe" style="IBUITableViewCellStyleSubtitle" id="5s2-Qn-BOB" customClass="AlbumCell"> |
460 | 222 | <rect key="frame" x="0.0" y="22" width="320" height="44"/> | 266 | <rect key="frame" x="0.0" y="22" width="320" height="44"/> |
461 | 223 | <autoresizingMask key="autoresizingMask"/> | 267 | <autoresizingMask key="autoresizingMask"/> |
462 | 224 | <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> | 268 | <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> |
463 | @@ -226,19 +270,23 @@ | |||
464 | 226 | <autoresizingMask key="autoresizingMask"/> | 270 | <autoresizingMask key="autoresizingMask"/> |
465 | 227 | <subviews> | 271 | <subviews> |
466 | 228 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="lHq-bS-Zm9"> | 272 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="lHq-bS-Zm9"> |
468 | 229 | <rect key="frame" x="10" y="2" width="38" height="22"/> | 273 | <rect key="frame" x="53" y="2" width="38" height="22"/> |
469 | 230 | <autoresizingMask key="autoresizingMask"/> | 274 | <autoresizingMask key="autoresizingMask"/> |
470 | 231 | <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/> | 275 | <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/> |
471 | 232 | <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> | 276 | <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> |
472 | 233 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> | 277 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> |
473 | 234 | </label> | 278 | </label> |
474 | 235 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="03B-YT-E7s"> | 279 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="03B-YT-E7s"> |
476 | 236 | <rect key="frame" x="10" y="24" width="47" height="18"/> | 280 | <rect key="frame" x="53" y="24" width="47" height="18"/> |
477 | 237 | <autoresizingMask key="autoresizingMask"/> | 281 | <autoresizingMask key="autoresizingMask"/> |
478 | 238 | <fontDescription key="fontDescription" type="system" pointSize="14"/> | 282 | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
479 | 239 | <color key="textColor" red="0.50196078431372548" green="0.50196078431372548" blue="0.50196078431372548" alpha="1" colorSpace="calibratedRGB"/> | 283 | <color key="textColor" red="0.50196078431372548" green="0.50196078431372548" blue="0.50196078431372548" alpha="1" colorSpace="calibratedRGB"/> |
480 | 240 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> | 284 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> |
481 | 241 | </label> | 285 | </label> |
482 | 286 | <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="default-album-art-120.png" id="apM-jL-xHe"> | ||
483 | 287 | <rect key="frame" x="0.0" y="0.0" width="43" height="43"/> | ||
484 | 288 | <autoresizingMask key="autoresizingMask"/> | ||
485 | 289 | </imageView> | ||
486 | 242 | </subviews> | 290 | </subviews> |
487 | 243 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 291 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
488 | 244 | </view> | 292 | </view> |
489 | @@ -263,7 +311,7 @@ | |||
490 | 263 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | 311 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
491 | 264 | <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | 312 | <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
492 | 265 | <prototypes> | 313 | <prototypes> |
494 | 266 | <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="OwY-7W-CUV" detailTextLabel="ORO-PT-T6b" style="IBUITableViewCellStyleSubtitle" id="jpK-Yt-5Y9" customClass="SongCell"> | 314 | <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="OwY-7W-CUV" detailTextLabel="ORO-PT-T6b" imageView="Ynd-vW-pQI" style="IBUITableViewCellStyleSubtitle" id="jpK-Yt-5Y9" customClass="SongCell"> |
495 | 267 | <rect key="frame" x="0.0" y="22" width="320" height="44"/> | 315 | <rect key="frame" x="0.0" y="22" width="320" height="44"/> |
496 | 268 | <autoresizingMask key="autoresizingMask"/> | 316 | <autoresizingMask key="autoresizingMask"/> |
497 | 269 | <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> | 317 | <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> |
498 | @@ -271,19 +319,23 @@ | |||
499 | 271 | <autoresizingMask key="autoresizingMask"/> | 319 | <autoresizingMask key="autoresizingMask"/> |
500 | 272 | <subviews> | 320 | <subviews> |
501 | 273 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="OwY-7W-CUV"> | 321 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="OwY-7W-CUV"> |
503 | 274 | <rect key="frame" x="10" y="2" width="38" height="22"/> | 322 | <rect key="frame" x="53" y="2" width="38" height="22"/> |
504 | 275 | <autoresizingMask key="autoresizingMask"/> | 323 | <autoresizingMask key="autoresizingMask"/> |
505 | 276 | <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/> | 324 | <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/> |
506 | 277 | <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> | 325 | <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> |
507 | 278 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> | 326 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> |
508 | 279 | </label> | 327 | </label> |
509 | 280 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ORO-PT-T6b"> | 328 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ORO-PT-T6b"> |
511 | 281 | <rect key="frame" x="10" y="24" width="47" height="18"/> | 329 | <rect key="frame" x="53" y="24" width="47" height="18"/> |
512 | 282 | <autoresizingMask key="autoresizingMask"/> | 330 | <autoresizingMask key="autoresizingMask"/> |
513 | 283 | <fontDescription key="fontDescription" type="system" pointSize="14"/> | 331 | <fontDescription key="fontDescription" type="system" pointSize="14"/> |
514 | 284 | <color key="textColor" red="0.50196078431372548" green="0.50196078431372548" blue="0.50196078431372548" alpha="1" colorSpace="calibratedRGB"/> | 332 | <color key="textColor" red="0.50196078431372548" green="0.50196078431372548" blue="0.50196078431372548" alpha="1" colorSpace="calibratedRGB"/> |
515 | 285 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> | 333 | <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> |
516 | 286 | </label> | 334 | </label> |
517 | 335 | <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="default-album-art-120.png" id="Ynd-vW-pQI"> | ||
518 | 336 | <rect key="frame" x="0.0" y="0.0" width="43" height="43"/> | ||
519 | 337 | <autoresizingMask key="autoresizingMask"/> | ||
520 | 338 | </imageView> | ||
521 | 287 | </subviews> | 339 | </subviews> |
522 | 288 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | 340 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
523 | 289 | </view> | 341 | </view> |
524 | @@ -559,6 +611,7 @@ | |||
525 | 559 | <resources> | 611 | <resources> |
526 | 560 | <image name="albums.png" width="30" height="30"/> | 612 | <image name="albums.png" width="30" height="30"/> |
527 | 561 | <image name="artists.png" width="30" height="30"/> | 613 | <image name="artists.png" width="30" height="30"/> |
528 | 614 | <image name="default-album-art-120.png" width="60" height="60"/> | ||
529 | 562 | <image name="playlists.png" width="30" height="30"/> | 615 | <image name="playlists.png" width="30" height="30"/> |
530 | 563 | <image name="settings.png" width="30" height="30"/> | 616 | <image name="settings.png" width="30" height="30"/> |
531 | 564 | <image name="songs.png" width="30" height="30"/> | 617 | <image name="songs.png" width="30" height="30"/> |
532 | 565 | 618 | ||
533 | === modified file 'Music/UOMusic.xcdatamodeld/UOMusic.xcdatamodel/contents' | |||
534 | --- Music/UOMusic.xcdatamodeld/UOMusic.xcdatamodel/contents 2013-01-02 23:52:23 +0000 | |||
535 | +++ Music/UOMusic.xcdatamodeld/UOMusic.xcdatamodel/contents 2013-01-02 23:52:23 +0000 | |||
536 | @@ -2,7 +2,7 @@ | |||
537 | 2 | <model name="" userDefinedModelVersionIdentifier="UOMusic0" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1811" systemVersion="12C60" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic"> | 2 | <model name="" userDefinedModelVersionIdentifier="UOMusic0" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1811" systemVersion="12C60" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic"> |
538 | 3 | <entity name="Album" representedClassName="Album" syncable="YES"> | 3 | <entity name="Album" representedClassName="Album" syncable="YES"> |
539 | 4 | <attribute name="albumId" attributeType="String" indexed="YES" syncable="YES"/> | 4 | <attribute name="albumId" attributeType="String" indexed="YES" syncable="YES"/> |
541 | 5 | <attribute name="art" optional="YES" attributeType="String" syncable="YES"/> | 5 | <attribute name="artHash" optional="YES" attributeType="String" syncable="YES"/> |
542 | 6 | <attribute name="artUrl" optional="YES" attributeType="String" syncable="YES"/> | 6 | <attribute name="artUrl" optional="YES" attributeType="String" syncable="YES"/> |
543 | 7 | <attribute name="dearticlizedTitle" attributeType="String" syncable="YES"/> | 7 | <attribute name="dearticlizedTitle" attributeType="String" syncable="YES"/> |
544 | 8 | <attribute name="index" optional="YES" transient="YES" attributeType="String" syncable="YES"/> | 8 | <attribute name="index" optional="YES" transient="YES" attributeType="String" syncable="YES"/> |
545 | @@ -12,6 +12,7 @@ | |||
546 | 12 | <relationship name="songs" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Song" inverseName="album" inverseEntity="Song" syncable="YES"/> | 12 | <relationship name="songs" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Song" inverseName="album" inverseEntity="Song" syncable="YES"/> |
547 | 13 | </entity> | 13 | </entity> |
548 | 14 | <entity name="Artist" representedClassName="Artist" syncable="YES"> | 14 | <entity name="Artist" representedClassName="Artist" syncable="YES"> |
549 | 15 | <attribute name="art" optional="YES" transient="YES" attributeType="Transformable" syncable="YES"/> | ||
550 | 15 | <attribute name="artistId" attributeType="String" indexed="YES" syncable="YES"/> | 16 | <attribute name="artistId" attributeType="String" indexed="YES" syncable="YES"/> |
551 | 16 | <attribute name="artUrl" optional="YES" attributeType="String" syncable="YES"/> | 17 | <attribute name="artUrl" optional="YES" attributeType="String" syncable="YES"/> |
552 | 17 | <attribute name="dearticlizedName" attributeType="String" syncable="YES"/> | 18 | <attribute name="dearticlizedName" attributeType="String" syncable="YES"/> |
553 | @@ -30,7 +31,6 @@ | |||
554 | 30 | <attribute name="url" attributeType="String" syncable="YES"/> | 31 | <attribute name="url" attributeType="String" syncable="YES"/> |
555 | 31 | </entity> | 32 | </entity> |
556 | 32 | <entity name="Song" representedClassName="Song" syncable="YES"> | 33 | <entity name="Song" representedClassName="Song" syncable="YES"> |
557 | 33 | <attribute name="artUrl" optional="YES" attributeType="String" syncable="YES"/> | ||
558 | 34 | <attribute name="bitRate" optional="YES" attributeType="String" syncable="YES"/> | 34 | <attribute name="bitRate" optional="YES" attributeType="String" syncable="YES"/> |
559 | 35 | <attribute name="contentType" optional="YES" attributeType="String" syncable="YES"/> | 35 | <attribute name="contentType" optional="YES" attributeType="String" syncable="YES"/> |
560 | 36 | <attribute name="dearticlizedTitle" attributeType="String" syncable="YES"/> | 36 | <attribute name="dearticlizedTitle" attributeType="String" syncable="YES"/> |
561 | @@ -53,8 +53,8 @@ | |||
562 | 53 | </entity> | 53 | </entity> |
563 | 54 | <elements> | 54 | <elements> |
564 | 55 | <element name="Album" positionX="468" positionY="180" width="128" height="180"/> | 55 | <element name="Album" positionX="468" positionY="180" width="128" height="180"/> |
566 | 56 | <element name="Artist" positionX="160" positionY="195" width="128" height="165"/> | 56 | <element name="Artist" positionX="160" positionY="195" width="128" height="180"/> |
567 | 57 | <element name="Playlist" positionX="160" positionY="192" width="128" height="135"/> | 57 | <element name="Playlist" positionX="160" positionY="192" width="128" height="135"/> |
569 | 58 | <element name="Song" positionX="160" positionY="192" width="128" height="345"/> | 58 | <element name="Song" positionX="160" positionY="192" width="128" height="330"/> |
570 | 59 | </elements> | 59 | </elements> |
571 | 60 | </model> | 60 | </model> |
572 | 61 | \ No newline at end of file | 61 | \ No newline at end of file |
573 | 62 | 62 | ||
574 | === modified file 'Music/Utilities/UOWebServiceController.m' | |||
575 | --- Music/Utilities/UOWebServiceController.m 2013-01-02 23:52:23 +0000 | |||
576 | +++ Music/Utilities/UOWebServiceController.m 2013-01-02 23:52:23 +0000 | |||
577 | @@ -169,6 +169,7 @@ | |||
578 | 169 | } | 169 | } |
579 | 170 | 170 | ||
580 | 171 | - (void)initRestKit { | 171 | - (void)initRestKit { |
581 | 172 | RKLogConfigureByName("RestKit/Network", RKLogLevelWarning); | ||
582 | 172 | 173 | ||
583 | 173 | NSURL *baseUrl = [NSURL URLWithString:@"https://one.ubuntu.com/api/music/v2/"]; | 174 | NSURL *baseUrl = [NSURL URLWithString:@"https://one.ubuntu.com/api/music/v2/"]; |
584 | 174 | RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:baseUrl]; | 175 | RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:baseUrl]; |
585 | @@ -190,6 +191,7 @@ | |||
586 | 190 | NSError *error; | 191 | NSError *error; |
587 | 191 | [managedObjectStore addSQLitePersistentStoreAtPath:[RKApplicationDataDirectory() stringByAppendingPathComponent:@"UOMusic.sqlite"] fromSeedDatabaseAtPath:nil withConfiguration:nil options:nil error:&error]; | 192 | [managedObjectStore addSQLitePersistentStoreAtPath:[RKApplicationDataDirectory() stringByAppendingPathComponent:@"UOMusic.sqlite"] fromSeedDatabaseAtPath:nil withConfiguration:nil options:nil error:&error]; |
588 | 192 | if (error) { | 193 | if (error) { |
589 | 194 | NSLog(@"Database model is out of date"); | ||
590 | 193 | abort(); | 195 | abort(); |
591 | 194 | } | 196 | } |
592 | 195 | [objectManager setManagedObjectStore:managedObjectStore]; | 197 | [objectManager setManagedObjectStore:managedObjectStore]; |
593 | 196 | 198 | ||
594 | === modified file 'Music/View Controllers/AlbumViewController.m' | |||
595 | --- Music/View Controllers/AlbumViewController.m 2013-01-02 23:52:23 +0000 | |||
596 | +++ Music/View Controllers/AlbumViewController.m 2013-01-02 23:52:23 +0000 | |||
597 | @@ -38,6 +38,14 @@ | |||
598 | 38 | 38 | ||
599 | 39 | [_albumTitle setText:album.title]; | 39 | [_albumTitle setText:album.title]; |
600 | 40 | [_albumDescription setText:album.artist.name]; | 40 | [_albumDescription setText:album.artist.name]; |
601 | 41 | if (!album.art) { | ||
602 | 42 | [album fetchArt:^(UIImage *image) { | ||
603 | 43 | [self.albumArt setImage:image]; | ||
604 | 44 | [self.albumArt setNeedsDisplay]; | ||
605 | 45 | }]; | ||
606 | 46 | } else { | ||
607 | 47 | [self.albumArt setImage:album.art]; | ||
608 | 48 | } | ||
609 | 41 | 49 | ||
610 | 42 | if ([album.songs count]) { | 50 | if ([album.songs count]) { |
611 | 43 | NSArray *sortDescriptors = [NSArray arrayWithObjects:[[NSSortDescriptor alloc] initWithKey:@"track" ascending:NO], nil]; | 51 | NSArray *sortDescriptors = [NSArray arrayWithObjects:[[NSSortDescriptor alloc] initWithKey:@"track" ascending:NO], nil]; |
612 | 44 | 52 | ||
613 | === modified file 'Music/View Controllers/ArtistViewController.m' | |||
614 | --- Music/View Controllers/ArtistViewController.m 2013-01-02 23:52:23 +0000 | |||
615 | +++ Music/View Controllers/ArtistViewController.m 2013-01-02 23:52:23 +0000 | |||
616 | @@ -41,6 +41,14 @@ | |||
617 | 41 | [self fetchArtist]; | 41 | [self fetchArtist]; |
618 | 42 | 42 | ||
619 | 43 | [_artistName setText:artist.name]; | 43 | [_artistName setText:artist.name]; |
620 | 44 | if (!artist.art) { | ||
621 | 45 | [artist fetchArt:^(UIImage *image) { | ||
622 | 46 | [self.albumArt setImage:image]; | ||
623 | 47 | [self.albumArt setNeedsDisplay]; | ||
624 | 48 | }]; | ||
625 | 49 | } else { | ||
626 | 50 | [self.albumArt setImage:artist.art]; | ||
627 | 51 | } | ||
628 | 44 | 52 | ||
629 | 45 | NSString *pluralizedNoun = @"albums"; | 53 | NSString *pluralizedNoun = @"albums"; |
630 | 46 | if ([artist.albums count] == 1) { | 54 | if ([artist.albums count] == 1) { |
631 | 47 | 55 | ||
632 | === modified file 'Music/View Controllers/Table Cells/AlbumCell.m' | |||
633 | --- Music/View Controllers/Table Cells/AlbumCell.m 2013-01-02 23:52:23 +0000 | |||
634 | +++ Music/View Controllers/Table Cells/AlbumCell.m 2013-01-02 23:52:23 +0000 | |||
635 | @@ -13,6 +13,17 @@ | |||
636 | 13 | 13 | ||
637 | 14 | - (void)setAlbum:(Album *)album { | 14 | - (void)setAlbum:(Album *)album { |
638 | 15 | _album = album; | 15 | _album = album; |
639 | 16 | |||
640 | 17 | if (!album.art) { | ||
641 | 18 | [self.imageView setImage:[UIImage imageNamed:@"default-album-art-120.png"]]; | ||
642 | 19 | [album fetchArt:^(UIImage *image) { | ||
643 | 20 | [self.imageView setImage:image]; | ||
644 | 21 | [self setNeedsDisplay]; | ||
645 | 22 | }]; | ||
646 | 23 | } else { | ||
647 | 24 | [self.imageView setImage:album.art]; | ||
648 | 25 | } | ||
649 | 26 | |||
650 | 16 | [self.textLabel setText:album.title]; | 27 | [self.textLabel setText:album.title]; |
651 | 17 | 28 | ||
652 | 18 | [self.detailTextLabel setText:album.artist.name]; | 29 | [self.detailTextLabel setText:album.artist.name]; |
653 | 19 | 30 | ||
654 | === modified file 'Music/View Controllers/Table Cells/ArtistCell.m' | |||
655 | --- Music/View Controllers/Table Cells/ArtistCell.m 2013-01-02 23:52:23 +0000 | |||
656 | +++ Music/View Controllers/Table Cells/ArtistCell.m 2013-01-02 23:52:23 +0000 | |||
657 | @@ -14,6 +14,16 @@ | |||
658 | 14 | - (void)setArtist:(Artist *)artist { | 14 | - (void)setArtist:(Artist *)artist { |
659 | 15 | _artist = artist; | 15 | _artist = artist; |
660 | 16 | 16 | ||
661 | 17 | if (!artist.art) { | ||
662 | 18 | [self.imageView setImage:[UIImage imageNamed:@"default-album-art-120.png"]]; | ||
663 | 19 | [artist fetchArt:^(UIImage *image) { | ||
664 | 20 | [self.imageView setImage:image]; | ||
665 | 21 | [self setNeedsDisplay]; | ||
666 | 22 | }]; | ||
667 | 23 | } else { | ||
668 | 24 | [self.imageView setImage:artist.art]; | ||
669 | 25 | } | ||
670 | 26 | |||
671 | 17 | [self.textLabel setText:artist.name]; | 27 | [self.textLabel setText:artist.name]; |
672 | 18 | if ([artist.albums count] > 0) { | 28 | if ([artist.albums count] > 0) { |
673 | 19 | NSString *pluralizedNoun = @"albums"; | 29 | NSString *pluralizedNoun = @"albums"; |
674 | 20 | 30 | ||
675 | === modified file 'Music/View Controllers/Table Cells/SongCell.m' | |||
676 | --- Music/View Controllers/Table Cells/SongCell.m 2013-01-02 23:52:23 +0000 | |||
677 | +++ Music/View Controllers/Table Cells/SongCell.m 2013-01-02 23:52:23 +0000 | |||
678 | @@ -7,6 +7,7 @@ | |||
679 | 7 | // | 7 | // |
680 | 8 | 8 | ||
681 | 9 | #import "SongCell.h" | 9 | #import "SongCell.h" |
682 | 10 | #import "Artist.h" | ||
683 | 10 | 11 | ||
684 | 11 | @implementation SongCell | 12 | @implementation SongCell |
685 | 12 | @synthesize song = _song; | 13 | @synthesize song = _song; |
686 | @@ -14,8 +15,18 @@ | |||
687 | 14 | - (void)setSong:(Song *)song { | 15 | - (void)setSong:(Song *)song { |
688 | 15 | _song = song; | 16 | _song = song; |
689 | 16 | 17 | ||
690 | 18 | if (!song.art) { | ||
691 | 19 | [self.imageView setImage:[UIImage imageNamed:@"default-album-art-120.png"]]; | ||
692 | 20 | [song fetchArt:^(UIImage *image) { | ||
693 | 21 | [self.imageView setImage:image]; | ||
694 | 22 | [self setNeedsDisplay]; | ||
695 | 23 | }]; | ||
696 | 24 | } else { | ||
697 | 25 | [self.imageView setImage:song.art]; | ||
698 | 26 | } | ||
699 | 27 | |||
700 | 17 | [self.textLabel setText:song.title]; | 28 | [self.textLabel setText:song.title]; |
702 | 18 | //[self.detailTextLabel setText:song.artist]; | 29 | [self.detailTextLabel setText:song.artist.name]; |
703 | 19 | } | 30 | } |
704 | 20 | 31 | ||
705 | 21 | @end | 32 | @end |