Merge lp:~urbanape/ubuntuone-ios-music/separate-album-art-download-and-display into lp:ubuntuone-ios-music
- separate-album-art-download-and-display
- Merge into trunk
Proposed by
Zachery Bir
Status: | Merged |
---|---|
Approved by: | Paul Hummer |
Approved revision: | 230 |
Merged at revision: | 221 |
Proposed branch: | lp:~urbanape/ubuntuone-ios-music/separate-album-art-download-and-display |
Merge into: | lp:ubuntuone-ios-music |
Diff against target: |
376 lines (+66/-41) 9 files modified
Other Sources/U1MusicAppDelegate.m (+1/-1) U1Music-Info.plist (+1/-1) U1Music.xcodeproj/project.pbxproj (+30/-10) about/about.html (+1/-1) utilities/operations/AlbumArtDownloadOperation.h (+4/-4) utilities/operations/AlbumArtDownloadOperation.m (+3/-3) utilities/operations/AlbumArtLoader.h (+5/-7) utilities/operations/AlbumArtLoader.m (+16/-13) view_controllers/AlbumListViewController.m (+5/-1) |
To merge this branch: | bzr merge lp:~urbanape/ubuntuone-ios-music/separate-album-art-download-and-display |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paul Hummer (community) | Approve | ||
Review via email: mp+112630@code.launchpad.net |
Commit message
This branch further backgrounds the resizing of thumbnails to keep more work off the main thread, which in turn, keeps the app responsive to UI events.
Description of the change
This branch further backgrounds the resizing of thumbnails to keep more work off the main thread, which in turn, keeps the app responsive to UI events.
To post a comment you must log in.
- 227. By Zachery Bir
-
Fix this errant check. The previous code would always clobber the .sqlite file on each new upgrade.
- 228. By Zachery Bir
-
Upped the version number.
- 229. By Zachery Bir
-
Upped the version number
- 230. By Zachery Bir
-
Not using the resizeQueue
Revision history for this message
Paul Hummer (rockstar) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Other Sources/U1MusicAppDelegate.m' |
2 | --- Other Sources/U1MusicAppDelegate.m 2012-06-15 22:22:10 +0000 |
3 | +++ Other Sources/U1MusicAppDelegate.m 2012-06-28 18:57:33 +0000 |
4 | @@ -85,7 +85,7 @@ |
5 | [window.rootViewController presentModalViewController:migrationView animated:YES]; |
6 | }); |
7 | } |
8 | - else if ([standardUserDefaults integerForKey:@"last_build_version"] < bundleVersion) |
9 | + else if ([standardUserDefaults integerForKey:@"last_build_version"] < 54) // Version where we fixed the Songs view crasher. TODO: Find a better long-term migration strategy |
10 | { |
11 | NSLog(@"Just to be certain, I'm removing the old database file."); |
12 | NSFileManager *defaultManager = [NSFileManager defaultManager]; |
13 | |
14 | === modified file 'U1Music-Info.plist' |
15 | --- U1Music-Info.plist 2012-06-22 18:00:53 +0000 |
16 | +++ U1Music-Info.plist 2012-06-28 18:57:33 +0000 |
17 | @@ -39,7 +39,7 @@ |
18 | </dict> |
19 | </array> |
20 | <key>CFBundleVersion</key> |
21 | - <string>55</string> |
22 | + <string>57</string> |
23 | <key>LSRequiresIPhoneOS</key> |
24 | <false/> |
25 | <key>NSMainNibFile</key> |
26 | |
27 | === modified file 'U1Music.xcodeproj/project.pbxproj' |
28 | --- U1Music.xcodeproj/project.pbxproj 2012-02-15 01:03:52 +0000 |
29 | +++ U1Music.xcodeproj/project.pbxproj 2012-06-28 18:57:33 +0000 |
30 | @@ -57,6 +57,12 @@ |
31 | 91406E9813849F2400A7DA67 /* uncached.png in Resources */ = {isa = PBXBuildFile; fileRef = 91406E9213849F2400A7DA67 /* uncached.png */; }; |
32 | 91406E9913849F2400A7DA67 /* uncached@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 91406E9313849F2400A7DA67 /* uncached@2x.png */; }; |
33 | 91406EEA138AEEE000A7DA67 /* NSString+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = 91406EE9138AEEE000A7DA67 /* NSString+Extras.m */; }; |
34 | + 9149D9CF159BEC3D009AE771 /* default-album-art-120.png in Resources */ = {isa = PBXBuildFile; fileRef = 9149D9C9159BEC3D009AE771 /* default-album-art-120.png */; }; |
35 | + 9149D9D0159BEC3D009AE771 /* default-album-art-200.png in Resources */ = {isa = PBXBuildFile; fileRef = 9149D9CA159BEC3D009AE771 /* default-album-art-200.png */; }; |
36 | + 9149D9D1159BEC3D009AE771 /* default-album-art-120@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9149D9CB159BEC3D009AE771 /* default-album-art-120@2x.png */; }; |
37 | + 9149D9D2159BEC3D009AE771 /* default-album-art-200@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9149D9CC159BEC3D009AE771 /* default-album-art-200@2x.png */; }; |
38 | + 9149D9D3159BEC3D009AE771 /* default-album-art-640.png in Resources */ = {isa = PBXBuildFile; fileRef = 9149D9CD159BEC3D009AE771 /* default-album-art-640.png */; }; |
39 | + 9149D9D4159BEC3D009AE771 /* default-album-art-640@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9149D9CE159BEC3D009AE771 /* default-album-art-640@2x.png */; }; |
40 | 914AC3FF14B61D8A00C7D5A3 /* CachedSongsPlaylist.m in Sources */ = {isa = PBXBuildFile; fileRef = 914AC3F114B61D8A00C7D5A3 /* CachedSongsPlaylist.m */; }; |
41 | 914AC40014B61D8A00C7D5A3 /* _Album.m in Sources */ = {isa = PBXBuildFile; fileRef = 914AC3F414B61D8A00C7D5A3 /* _Album.m */; }; |
42 | 914AC40114B61D8A00C7D5A3 /* _Artist.m in Sources */ = {isa = PBXBuildFile; fileRef = 914AC3F614B61D8A00C7D5A3 /* _Artist.m */; }; |
43 | @@ -94,7 +100,7 @@ |
44 | 936F209012273D9000070F43 /* Song.m in Sources */ = {isa = PBXBuildFile; fileRef = 936F208F12273D9000070F43 /* Song.m */; }; |
45 | 936F230A12284D1900070F43 /* NamedTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 936F230912284D1900070F43 /* NamedTextFieldCell.m */; }; |
46 | 937FAA11137CFC1B00507E51 /* AlbumArtLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 937FAA0E137CFC1B00507E51 /* AlbumArtLoader.m */; }; |
47 | - 937FAA12137CFC1B00507E51 /* AlbumArtLoadingOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 937FAA10137CFC1B00507E51 /* AlbumArtLoadingOperation.m */; }; |
48 | + 937FAA12137CFC1B00507E51 /* AlbumArtDownloadOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 937FAA10137CFC1B00507E51 /* AlbumArtDownloadOperation.m */; }; |
49 | 937FAA15137CFC5000507E51 /* Downloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 937FAA14137CFC5000507E51 /* Downloader.m */; }; |
50 | 937FAA18137CFC7200507E51 /* DownloadOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 937FAA17137CFC7200507E51 /* DownloadOperation.m */; }; |
51 | 937FAA1B137CFCA600507E51 /* AbstractNetworkOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 937FAA1A137CFCA600507E51 /* AbstractNetworkOperation.m */; }; |
52 | @@ -149,7 +155,6 @@ |
53 | 93FA42B0124DC1350080DF62 /* 05-shuffle.png in Resources */ = {isa = PBXBuildFile; fileRef = 93FA42A9124DC1350080DF62 /* 05-shuffle.png */; }; |
54 | 93FA42B1124DC1350080DF62 /* 05-shuffle@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 93FA42AA124DC1350080DF62 /* 05-shuffle@2x.png */; }; |
55 | 93FA42B2124DC1350080DF62 /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = 93FA42AB124DC1350080DF62 /* background.png */; }; |
56 | - 93FA42B4124DC1350080DF62 /* default-album-art.png in Resources */ = {isa = PBXBuildFile; fileRef = 93FA42AD124DC1350080DF62 /* default-album-art.png */; }; |
57 | 93FA4336124DE0D80080DF62 /* player_back.png in Resources */ = {isa = PBXBuildFile; fileRef = 93FA4334124DE0D80080DF62 /* player_back.png */; }; |
58 | 93FA4337124DE0D80080DF62 /* player_back@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 93FA4335124DE0D80080DF62 /* player_back@2x.png */; }; |
59 | 93FA43A5124DEE0E0080DF62 /* bluetrack.png in Resources */ = {isa = PBXBuildFile; fileRef = 93FA43A2124DEE0E0080DF62 /* bluetrack.png */; }; |
60 | @@ -275,6 +280,12 @@ |
61 | 91406E9313849F2400A7DA67 /* uncached@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "uncached@2x.png"; sourceTree = "<group>"; }; |
62 | 91406EE8138AEEE000A7DA67 /* NSString+Extras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Extras.h"; sourceTree = "<group>"; }; |
63 | 91406EE9138AEEE000A7DA67 /* NSString+Extras.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Extras.m"; sourceTree = "<group>"; }; |
64 | + 9149D9C9159BEC3D009AE771 /* default-album-art-120.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "default-album-art-120.png"; sourceTree = "<group>"; }; |
65 | + 9149D9CA159BEC3D009AE771 /* default-album-art-200.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "default-album-art-200.png"; sourceTree = "<group>"; }; |
66 | + 9149D9CB159BEC3D009AE771 /* default-album-art-120@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "default-album-art-120@2x.png"; sourceTree = "<group>"; }; |
67 | + 9149D9CC159BEC3D009AE771 /* default-album-art-200@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "default-album-art-200@2x.png"; sourceTree = "<group>"; }; |
68 | + 9149D9CD159BEC3D009AE771 /* default-album-art-640.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "default-album-art-640.png"; sourceTree = "<group>"; }; |
69 | + 9149D9CE159BEC3D009AE771 /* default-album-art-640@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "default-album-art-640@2x.png"; sourceTree = "<group>"; }; |
70 | 914AC3EE14B60ECC00C7D5A3 /* U1Music 2.2-31.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "U1Music 2.2-31.xcdatamodel"; sourceTree = "<group>"; }; |
71 | 914AC3F014B61D8A00C7D5A3 /* CachedSongsPlaylist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CachedSongsPlaylist.h; path = Models/CachedSongsPlaylist.h; sourceTree = SOURCE_ROOT; }; |
72 | 914AC3F114B61D8A00C7D5A3 /* CachedSongsPlaylist.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CachedSongsPlaylist.m; path = Models/CachedSongsPlaylist.m; sourceTree = SOURCE_ROOT; }; |
73 | @@ -343,8 +354,8 @@ |
74 | 936F230912284D1900070F43 /* NamedTextFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NamedTextFieldCell.m; sourceTree = "<group>"; }; |
75 | 937FAA0D137CFC1B00507E51 /* AlbumArtLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlbumArtLoader.h; sourceTree = "<group>"; }; |
76 | 937FAA0E137CFC1B00507E51 /* AlbumArtLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AlbumArtLoader.m; sourceTree = "<group>"; }; |
77 | - 937FAA0F137CFC1B00507E51 /* AlbumArtLoadingOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlbumArtLoadingOperation.h; sourceTree = "<group>"; }; |
78 | - 937FAA10137CFC1B00507E51 /* AlbumArtLoadingOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AlbumArtLoadingOperation.m; sourceTree = "<group>"; }; |
79 | + 937FAA0F137CFC1B00507E51 /* AlbumArtDownloadOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlbumArtDownloadOperation.h; sourceTree = "<group>"; }; |
80 | + 937FAA10137CFC1B00507E51 /* AlbumArtDownloadOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AlbumArtDownloadOperation.m; sourceTree = "<group>"; }; |
81 | 937FAA13137CFC5000507E51 /* Downloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Downloader.h; sourceTree = "<group>"; }; |
82 | 937FAA14137CFC5000507E51 /* Downloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Downloader.m; sourceTree = "<group>"; }; |
83 | 937FAA16137CFC7200507E51 /* DownloadOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadOperation.h; sourceTree = "<group>"; }; |
84 | @@ -430,7 +441,6 @@ |
85 | 93FA42A9124DC1350080DF62 /* 05-shuffle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "05-shuffle.png"; sourceTree = "<group>"; }; |
86 | 93FA42AA124DC1350080DF62 /* 05-shuffle@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "05-shuffle@2x.png"; sourceTree = "<group>"; }; |
87 | 93FA42AB124DC1350080DF62 /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = "<group>"; }; |
88 | - 93FA42AD124DC1350080DF62 /* default-album-art.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "default-album-art.png"; sourceTree = "<group>"; }; |
89 | 93FA4334124DE0D80080DF62 /* player_back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = player_back.png; sourceTree = "<group>"; }; |
90 | 93FA4335124DE0D80080DF62 /* player_back@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "player_back@2x.png"; sourceTree = "<group>"; }; |
91 | 93FA43A2124DEE0E0080DF62 /* bluetrack.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bluetrack.png; sourceTree = "<group>"; }; |
92 | @@ -845,8 +855,8 @@ |
93 | 937FAA14137CFC5000507E51 /* Downloader.m */, |
94 | 937FAA0D137CFC1B00507E51 /* AlbumArtLoader.h */, |
95 | 937FAA0E137CFC1B00507E51 /* AlbumArtLoader.m */, |
96 | - 937FAA0F137CFC1B00507E51 /* AlbumArtLoadingOperation.h */, |
97 | - 937FAA10137CFC1B00507E51 /* AlbumArtLoadingOperation.m */, |
98 | + 937FAA0F137CFC1B00507E51 /* AlbumArtDownloadOperation.h */, |
99 | + 937FAA10137CFC1B00507E51 /* AlbumArtDownloadOperation.m */, |
100 | 937FAA19137CFCA600507E51 /* AbstractNetworkOperation.h */, |
101 | 937FAA1A137CFCA600507E51 /* AbstractNetworkOperation.m */, |
102 | 964FA3DD13CA5D1D0018A65B /* UOJSONFetchOperation.h */, |
103 | @@ -941,6 +951,12 @@ |
104 | 93FA42A6124DC1350080DF62 /* Images */ = { |
105 | isa = PBXGroup; |
106 | children = ( |
107 | + 9149D9C9159BEC3D009AE771 /* default-album-art-120.png */, |
108 | + 9149D9CB159BEC3D009AE771 /* default-album-art-120@2x.png */, |
109 | + 9149D9CA159BEC3D009AE771 /* default-album-art-200.png */, |
110 | + 9149D9CC159BEC3D009AE771 /* default-album-art-200@2x.png */, |
111 | + 9149D9CD159BEC3D009AE771 /* default-album-art-640.png */, |
112 | + 9149D9CE159BEC3D009AE771 /* default-album-art-640@2x.png */, |
113 | 932E7B0A12552CD500E7C8FF /* arrow.png */, |
114 | 93CCBD4D1254039900AFFC22 /* speaker.png */, |
115 | 93CCBD4E1254039900AFFC22 /* speaker@2x.png */, |
116 | @@ -962,7 +978,6 @@ |
117 | 93FA42A9124DC1350080DF62 /* 05-shuffle.png */, |
118 | 93FA42AA124DC1350080DF62 /* 05-shuffle@2x.png */, |
119 | 93FA42AB124DC1350080DF62 /* background.png */, |
120 | - 93FA42AD124DC1350080DF62 /* default-album-art.png */, |
121 | ); |
122 | name = Images; |
123 | path = images; |
124 | @@ -1187,7 +1202,6 @@ |
125 | 93FA42B0124DC1350080DF62 /* 05-shuffle.png in Resources */, |
126 | 93FA42B1124DC1350080DF62 /* 05-shuffle@2x.png in Resources */, |
127 | 93FA42B2124DC1350080DF62 /* background.png in Resources */, |
128 | - 93FA42B4124DC1350080DF62 /* default-album-art.png in Resources */, |
129 | 93FA4336124DE0D80080DF62 /* player_back.png in Resources */, |
130 | 93FA4337124DE0D80080DF62 /* player_back@2x.png in Resources */, |
131 | 93FA43A5124DEE0E0080DF62 /* bluetrack.png in Resources */, |
132 | @@ -1237,6 +1251,12 @@ |
133 | 9132827E144E07EA00395F40 /* README.txt in Resources */, |
134 | 9132827F144E07EA00395F40 /* release_notes.txt in Resources */, |
135 | 91F2653114EACFCC0027232B /* U1MigrationViewController.xib in Resources */, |
136 | + 9149D9CF159BEC3D009AE771 /* default-album-art-120.png in Resources */, |
137 | + 9149D9D0159BEC3D009AE771 /* default-album-art-200.png in Resources */, |
138 | + 9149D9D1159BEC3D009AE771 /* default-album-art-120@2x.png in Resources */, |
139 | + 9149D9D2159BEC3D009AE771 /* default-album-art-200@2x.png in Resources */, |
140 | + 9149D9D3159BEC3D009AE771 /* default-album-art-640.png in Resources */, |
141 | + 9149D9D4159BEC3D009AE771 /* default-album-art-640@2x.png in Resources */, |
142 | ); |
143 | runOnlyForDeploymentPostprocessing = 0; |
144 | }; |
145 | @@ -1340,7 +1360,7 @@ |
146 | 93DFFE4D135D71760061F29F /* music.xcdatamodeld in Sources */, |
147 | 93DFFE54135D72420061F29F /* NSManagedObjectContext+Additions.m in Sources */, |
148 | 937FAA11137CFC1B00507E51 /* AlbumArtLoader.m in Sources */, |
149 | - 937FAA12137CFC1B00507E51 /* AlbumArtLoadingOperation.m in Sources */, |
150 | + 937FAA12137CFC1B00507E51 /* AlbumArtDownloadOperation.m in Sources */, |
151 | 937FAA15137CFC5000507E51 /* Downloader.m in Sources */, |
152 | 937FAA18137CFC7200507E51 /* DownloadOperation.m in Sources */, |
153 | 937FAA1B137CFCA600507E51 /* AbstractNetworkOperation.m in Sources */, |
154 | |
155 | === modified file 'about/about.html' |
156 | --- about/about.html 2012-06-22 18:00:53 +0000 |
157 | +++ about/about.html 2012-06-28 18:57:33 +0000 |
158 | @@ -15,7 +15,7 @@ |
159 | <h1>Ubuntu One Music</h1> |
160 | |
161 | <p class="center"> |
162 | - Version 2.4 (build 55) |
163 | + Version 2.4 (build 57) |
164 | </p> |
165 | <p class="center"> |
166 | ©2010-2011 Canonical Limited. All rights reserved. |
167 | |
168 | === added file 'images/default-album-art-120.png' |
169 | Binary files images/default-album-art-120.png 1970-01-01 00:00:00 +0000 and images/default-album-art-120.png 2012-06-28 18:57:33 +0000 differ |
170 | === added file 'images/default-album-art-120@2x.png' |
171 | Binary files images/default-album-art-120@2x.png 1970-01-01 00:00:00 +0000 and images/default-album-art-120@2x.png 2012-06-28 18:57:33 +0000 differ |
172 | === added file 'images/default-album-art-200.png' |
173 | Binary files images/default-album-art-200.png 1970-01-01 00:00:00 +0000 and images/default-album-art-200.png 2012-06-28 18:57:33 +0000 differ |
174 | === added file 'images/default-album-art-200@2x.png' |
175 | Binary files images/default-album-art-200@2x.png 1970-01-01 00:00:00 +0000 and images/default-album-art-200@2x.png 2012-06-28 18:57:33 +0000 differ |
176 | === added file 'images/default-album-art-640.png' |
177 | Binary files images/default-album-art-640.png 1970-01-01 00:00:00 +0000 and images/default-album-art-640.png 2012-06-28 18:57:33 +0000 differ |
178 | === renamed file 'images/default-album-art.png' => 'images/default-album-art-640@2x.png' |
179 | Binary files images/default-album-art.png 2011-05-27 18:17:10 +0000 and images/default-album-art-640@2x.png 2012-06-28 18:57:33 +0000 differ |
180 | === renamed file 'utilities/operations/AlbumArtLoadingOperation.h' => 'utilities/operations/AlbumArtDownloadOperation.h' |
181 | --- utilities/operations/AlbumArtLoadingOperation.h 2011-06-21 15:29:37 +0000 |
182 | +++ utilities/operations/AlbumArtDownloadOperation.h 2012-06-28 18:57:33 +0000 |
183 | @@ -20,17 +20,17 @@ |
184 | #import <UIKit/UIKit.h> |
185 | #import "AbstractNetworkOperation.h" |
186 | |
187 | -@protocol AlbumArtLoadingOperationDelegate<NSObject> |
188 | +@protocol AlbumArtDownloadOperationDelegate<NSObject> |
189 | - (void)imageLoaded:(UIImage*)image forArtId:(NSString *)artId; |
190 | @end |
191 | |
192 | -@interface AlbumArtLoadingOperation : AbstractNetworkOperation |
193 | +@interface AlbumArtDownloadOperation : AbstractNetworkOperation |
194 | { |
195 | NSMutableData * _data; |
196 | NSString *_artId; |
197 | - id<AlbumArtLoadingOperationDelegate> delegate; |
198 | + id<AlbumArtDownloadOperationDelegate> delegate; |
199 | } |
200 | -@property (nonatomic, assign) id<AlbumArtLoadingOperationDelegate> delegate; |
201 | +@property (nonatomic, assign) id<AlbumArtDownloadOperationDelegate> delegate; |
202 | @property (readonly, retain) NSData * data; |
203 | - (id)initWithArtId:(NSString *)artId URL:(NSURL *)url; |
204 | |
205 | |
206 | === renamed file 'utilities/operations/AlbumArtLoadingOperation.m' => 'utilities/operations/AlbumArtDownloadOperation.m' |
207 | --- utilities/operations/AlbumArtLoadingOperation.m 2011-06-21 15:29:37 +0000 |
208 | +++ utilities/operations/AlbumArtDownloadOperation.m 2012-06-28 18:57:33 +0000 |
209 | @@ -19,16 +19,16 @@ |
210 | |
211 | // adapted from http://www.dribin.org/dave/blog/archives/2009/05/05/concurrent_operations/ |
212 | |
213 | -#import "AlbumArtLoadingOperation.h" |
214 | +#import "AlbumArtDownloadOperation.h" |
215 | |
216 | -@implementation AlbumArtLoadingOperation |
217 | +@implementation AlbumArtDownloadOperation |
218 | @synthesize delegate; |
219 | @synthesize data = _data; |
220 | |
221 | + (id)AlbumArtLoaderWithUrlString:(NSString *)urlString |
222 | { |
223 | NSURL * url = [NSURL URLWithString:urlString]; |
224 | - AlbumArtLoadingOperation * operation = [[self alloc] initWithUrl:url]; |
225 | + AlbumArtDownloadOperation * operation = [[self alloc] initWithUrl:url]; |
226 | return [operation autorelease]; |
227 | } |
228 | |
229 | |
230 | === modified file 'utilities/operations/AlbumArtLoader.h' |
231 | --- utilities/operations/AlbumArtLoader.h 2012-06-22 17:53:17 +0000 |
232 | +++ utilities/operations/AlbumArtLoader.h 2012-06-28 18:57:33 +0000 |
233 | @@ -18,7 +18,7 @@ |
234 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
235 | |
236 | #import <UIKit/UIKit.h> |
237 | -#import "AlbumArtLoadingOperation.h" |
238 | +#import "AlbumArtDownloadOperation.h" |
239 | |
240 | @protocol AlbumArtLoaderDelegate<NSObject> |
241 | - (void)reloadImages; |
242 | @@ -27,18 +27,16 @@ |
243 | @end |
244 | |
245 | |
246 | -@interface AlbumArtLoader : NSObject <AlbumArtLoadingOperationDelegate> |
247 | +@interface AlbumArtLoader : NSObject <AlbumArtDownloadOperationDelegate> |
248 | { |
249 | + id<AlbumArtLoaderDelegate> delegate; |
250 | + int imageSize; |
251 | NSMutableSet *downloadedURLs; |
252 | NSMutableDictionary *downloadCache; |
253 | - NSOperationQueue *queue; |
254 | - id<AlbumArtLoaderDelegate> delegate; |
255 | - int imageSize; |
256 | - UIImage *defaultAlbumArt; |
257 | + NSOperationQueue *downloadQueue; |
258 | } |
259 | @property(nonatomic) int imageSize; |
260 | @property(nonatomic,assign) id<AlbumArtLoaderDelegate> delegate; |
261 | -@property(nonatomic,retain) UIImage *defaultAlbumArt; |
262 | - (void)computeAlbumArtForId:(NSString *)albumArtId completionBlock:(void (^)(UIImage *))completionBlock; |
263 | + (NSString*)cacheSize; |
264 | @end |
265 | |
266 | === modified file 'utilities/operations/AlbumArtLoader.m' |
267 | --- utilities/operations/AlbumArtLoader.m 2012-06-22 17:53:17 +0000 |
268 | +++ utilities/operations/AlbumArtLoader.m 2012-06-28 18:57:33 +0000 |
269 | @@ -36,7 +36,6 @@ |
270 | @implementation AlbumArtLoader |
271 | @synthesize delegate; |
272 | @synthesize imageSize; |
273 | -@synthesize defaultAlbumArt; |
274 | |
275 | - (id)init |
276 | { |
277 | @@ -45,12 +44,12 @@ |
278 | [self createAlbumArtDirectory]; |
279 | |
280 | self.imageSize = 640; // Default to maximum size we need |
281 | - self.defaultAlbumArt = [UIImage imageNamed:@"default-album-art"]; |
282 | |
283 | downloadCache = [[NSMutableDictionary alloc] init]; |
284 | downloadedURLs = [[NSMutableSet alloc] init]; |
285 | - queue = [[NSOperationQueue alloc] init]; |
286 | - [queue setSuspended:NO]; |
287 | + downloadQueue = [[NSOperationQueue alloc] init]; |
288 | + [downloadQueue setSuspended:NO]; |
289 | + [downloadQueue setMaxConcurrentOperationCount:4]; |
290 | } |
291 | return self; |
292 | } |
293 | @@ -59,8 +58,7 @@ |
294 | { |
295 | [downloadCache release]; |
296 | [downloadedURLs release]; |
297 | - [queue release]; |
298 | - [defaultAlbumArt release]; |
299 | + [downloadQueue release]; |
300 | |
301 | [super dealloc]; |
302 | } |
303 | @@ -90,7 +88,7 @@ |
304 | } |
305 | |
306 | // Failing that, resize the highest resolution one we have |
307 | - |
308 | + |
309 | __block NSString *_resizedPath = path; |
310 | |
311 | NSString *fullSizePath = CachedAlbumArtPathForArtId(artId); |
312 | @@ -109,7 +107,7 @@ |
313 | |
314 | - (UIImage *)defaultAlbumArtSized:(NSUInteger)size; |
315 | { |
316 | - return [self.defaultAlbumArt resizedImage:CGSizeMake(self.imageSize, self.imageSize) interpolationQuality:kCGInterpolationHigh]; |
317 | + return [UIImage imageNamed:[NSString stringWithFormat:@"default-album-art-%d", size]]; |
318 | } |
319 | |
320 | - (void)download:(NSString*)artId; |
321 | @@ -127,9 +125,9 @@ |
322 | { |
323 | [downloadedURLs addObject:url]; |
324 | |
325 | - AlbumArtLoadingOperation *operation = [[AlbumArtLoadingOperation alloc] initWithArtId:artId URL:url]; |
326 | + AlbumArtDownloadOperation *operation = [[AlbumArtDownloadOperation alloc] initWithArtId:artId URL:url]; |
327 | operation.delegate = self; |
328 | - [queue addOperation:operation]; |
329 | + [downloadQueue addOperation:operation]; |
330 | [operation release]; |
331 | } |
332 | } |
333 | @@ -204,13 +202,18 @@ |
334 | - (void)imageLoaded:(UIImage*)image forArtId:(NSString *)artId |
335 | { |
336 | NSString *path = CachedAlbumArtPathForArtId(artId); |
337 | - [self cacheImage:image atPath:path]; |
338 | + |
339 | + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ |
340 | + [self cacheImage:image atPath:path]; |
341 | + }); |
342 | |
343 | if (self.imageSize != MAX_ART_SIZE) |
344 | { |
345 | - [self resizeAndSaveImage:image toPath:CachedAlbumArtPathForArtIdAtSize(artId, self.imageSize)]; |
346 | + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ |
347 | + [self resizeAndSaveImage:image toPath:CachedAlbumArtPathForArtIdAtSize(artId, self.imageSize)]; |
348 | + }); |
349 | } |
350 | - |
351 | + |
352 | if (self.delegate) |
353 | { |
354 | [self.delegate performSelectorOnMainThread:@selector(reloadImages) withObject:nil waitUntilDone:NO]; |
355 | |
356 | === modified file 'view_controllers/AlbumListViewController.m' |
357 | --- view_controllers/AlbumListViewController.m 2012-06-22 17:56:56 +0000 |
358 | +++ view_controllers/AlbumListViewController.m 2012-06-28 18:57:33 +0000 |
359 | @@ -175,12 +175,16 @@ |
360 | cell.artistNameLabel.text = album.artist; |
361 | |
362 | __block AlbumArtistUITableViewCell *_cell = cell; |
363 | + __block UITableView *_tableView = tableView; |
364 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), |
365 | ^{ |
366 | [loader computeAlbumArtForId:album.coverArtId completionBlock:^(UIImage *image) { |
367 | dispatch_async(dispatch_get_main_queue(), |
368 | ^{ |
369 | - _cell.coverArtView.image = image; |
370 | + if ([[_tableView visibleCells] containsObject:_cell]) |
371 | + { |
372 | + _cell.coverArtView.image = image; |
373 | + } |
374 | }); |
375 | }]; |
376 | }); |