Ben Copsey

Make the queue pass on the authorization warning to its delegate

@@ -122,7 +122,7 @@ @@ -122,7 +122,7 @@
122 NSDate *lastActivityTime; 122 NSDate *lastActivityTime;
123 123
124 NSTimeInterval timeOutSeconds; 124 NSTimeInterval timeOutSeconds;
125 - 125 +
126 } 126 }
127 127
128 #pragma mark init / dealloc 128 #pragma mark init / dealloc
@@ -152,6 +152,14 @@ @@ -152,6 +152,14 @@
152 [ASIHTTPRequest setProgress:progress forProgressIndicator:downloadProgressDelegate]; 152 [ASIHTTPRequest setProgress:progress forProgressIndicator:downloadProgressDelegate];
153 } 153 }
154 154
  155 +- (void)authorizationNeededForRequest:(ASIHTTPRequest *)request
  156 +{
  157 + if ([delegate respondsToSelector:@selector(authorizationNeededForRequest:)]) {
  158 + [delegate performSelector:@selector(authorizationNeededForRequest:) withObject:request];
  159 + }
  160 +}
  161 +
  162 +
155 @synthesize uploadProgressDelegate; 163 @synthesize uploadProgressDelegate;
156 @synthesize downloadProgressDelegate; 164 @synthesize downloadProgressDelegate;
157 @synthesize requestDidFinishSelector; 165 @synthesize requestDidFinishSelector;
@@ -43,10 +43,11 @@ @@ -43,10 +43,11 @@
43 - (IBAction)URLFetchWithProgress:(id)sender 43 - (IBAction)URLFetchWithProgress:(id)sender
44 { 44 {
45 [networkQueue cancelAllOperations]; 45 [networkQueue cancelAllOperations];
  46 + [networkQueue setDownloadProgressDelegate:progressIndicator];
  47 + [networkQueue setDelegate:self];
  48 + [networkQueue setRequestDidFinishSelector:@selector(URLFetchWithProgressComplete:)];
  49 +
46 ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:@"http://trails-network.net/Downloads/MemexTrails_1.0b1.zip"]] autorelease]; 50 ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:@"http://trails-network.net/Downloads/MemexTrails_1.0b1.zip"]] autorelease];
47 - [request setDelegate:self];  
48 - [request setDownloadProgressDelegate:progressIndicator];  
49 - [request setDidFinishSelector:@selector(URLFetchWithProgressComplete:)];  
50 [request setDownloadDestinationPath:[[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"MemexTrails_1.0b1.zip"]]; 51 [request setDownloadDestinationPath:[[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"MemexTrails_1.0b1.zip"]];
51 [networkQueue addOperation:request]; 52 [networkQueue addOperation:request];
52 } 53 }
@@ -108,14 +109,17 @@ @@ -108,14 +109,17 @@
108 - (IBAction)fetchTopSecretInformation:(id)sender 109 - (IBAction)fetchTopSecretInformation:(id)sender
109 { 110 {
110 [networkQueue cancelAllOperations]; 111 [networkQueue cancelAllOperations];
  112 + [networkQueue setRequestDidFinishSelector:@selector(topSecretFetchComplete:)];
  113 + [networkQueue setDelegate:self];
  114 +
111 [progressIndicator setDoubleValue:0]; 115 [progressIndicator setDoubleValue:0];
  116 +
112 ASIHTTPRequest *request; 117 ASIHTTPRequest *request;
113 request = [[[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:@"http://allseeing-i.com/top_secret/"]] autorelease]; 118 request = [[[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:@"http://allseeing-i.com/top_secret/"]] autorelease];
114 - [request setDelegate:self];  
115 - [request setDidFinishSelector:@selector(topSecretFetchComplete:)];  
116 [request setUseKeychainPersistance:[keychainCheckbox state]]; 119 [request setUseKeychainPersistance:[keychainCheckbox state]];
117 [networkQueue addOperation:request]; 120 [networkQueue addOperation:request];
118 121
  122 +
119 } 123 }
120 124
121 - (IBAction)topSecretFetchComplete:(ASIHTTPRequest *)request 125 - (IBAction)topSecretFetchComplete:(ASIHTTPRequest *)request
@@ -47,12 +47,12 @@ @@ -47,12 +47,12 @@
47 if (img) { 47 if (img) {
48 if ([imageView1 image]) { 48 if ([imageView1 image]) {
49 if ([imageView2 image]) { 49 if ([imageView2 image]) {
50 - [imageView3 setImage:img]; 50 + [imageView3 performSelectorOnMainThread:@selector(setImage:) withObject:img waitUntilDone:NO];
51 } else { 51 } else {
52 - [imageView2 setImage:img]; 52 + [imageView2 performSelectorOnMainThread:@selector(setImage:) withObject:img waitUntilDone:NO];
53 } 53 }
54 } else { 54 } else {
55 - [imageView1 setImage:img]; 55 + [imageView1 performSelectorOnMainThread:@selector(setImage:) withObject:img waitUntilDone:NO];
56 } 56 }
57 } 57 }
58 } 58 }
@@ -231,8 +231,6 @@ @@ -231,8 +231,6 @@
231 <key>Layout</key> 231 <key>Layout</key>
232 <array> 232 <array>
233 <dict> 233 <dict>
234 - <key>BecomeActive</key>  
235 - <true/>  
236 <key>ContentConfiguration</key> 234 <key>ContentConfiguration</key>
237 <dict> 235 <dict>
238 <key>PBXBottomSmartGroupGIDs</key> 236 <key>PBXBottomSmartGroupGIDs</key>
@@ -283,8 +281,8 @@ @@ -283,8 +281,8 @@
283 <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> 281 <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
284 <array> 282 <array>
285 <array> 283 <array>
286 - <integer>19</integer> 284 + <integer>30</integer>
287 - <integer>15</integer> 285 + <integer>22</integer>
288 <integer>0</integer> 286 <integer>0</integer>
289 </array> 287 </array>
290 </array> 288 </array>
@@ -308,7 +306,7 @@ @@ -308,7 +306,7 @@
308 <real>312</real> 306 <real>312</real>
309 </array> 307 </array>
310 <key>RubberWindowFrame</key> 308 <key>RubberWindowFrame</key>
311 - <string>165 158 1432 976 0 0 1920 1178 </string> 309 + <string>179 143 1432 976 0 0 1920 1178 </string>
312 </dict> 310 </dict>
313 <key>Module</key> 311 <key>Module</key>
314 <string>PBXSmartGroupTreeModule</string> 312 <string>PBXSmartGroupTreeModule</string>
@@ -319,12 +317,14 @@ @@ -319,12 +317,14 @@
319 <key>Dock</key> 317 <key>Dock</key>
320 <array> 318 <array>
321 <dict> 319 <dict>
  320 + <key>BecomeActive</key>
  321 + <true/>
322 <key>ContentConfiguration</key> 322 <key>ContentConfiguration</key>
323 <dict> 323 <dict>
324 <key>PBXProjectModuleGUID</key> 324 <key>PBXProjectModuleGUID</key>
325 <string>1CE0B20306471E060097A5F4</string> 325 <string>1CE0B20306471E060097A5F4</string>
326 <key>PBXProjectModuleLabel</key> 326 <key>PBXProjectModuleLabel</key>
327 - <string>ASINetworkQueueTests.m</string> 327 + <string>ASIHTTPRequest.m</string>
328 <key>PBXSplitModuleInNavigatorKey</key> 328 <key>PBXSplitModuleInNavigatorKey</key>
329 <dict> 329 <dict>
330 <key>Split0</key> 330 <key>Split0</key>
@@ -332,11 +332,11 @@ @@ -332,11 +332,11 @@
332 <key>PBXProjectModuleGUID</key> 332 <key>PBXProjectModuleGUID</key>
333 <string>1CE0B20406471E060097A5F4</string> 333 <string>1CE0B20406471E060097A5F4</string>
334 <key>PBXProjectModuleLabel</key> 334 <key>PBXProjectModuleLabel</key>
335 - <string>ASINetworkQueueTests.m</string> 335 + <string>ASIHTTPRequest.m</string>
336 <key>_historyCapacity</key> 336 <key>_historyCapacity</key>
337 <integer>0</integer> 337 <integer>0</integer>
338 <key>bookmark</key> 338 <key>bookmark</key>
339 - <string>B5B041A20EC5F32D0089D01F</string> 339 + <string>B5B0431D0EC621160089D01F</string>
340 <key>history</key> 340 <key>history</key>
341 <array> 341 <array>
342 <string>B5731B8B0E4310180008024F</string> 342 <string>B5731B8B0E4310180008024F</string>
@@ -346,35 +346,35 @@ @@ -346,35 +346,35 @@
346 <string>B5CF35640E7A7B2C0050CBA7</string> 346 <string>B5CF35640E7A7B2C0050CBA7</string>
347 <string>B5CFFBDB0EC46E83009ADE56</string> 347 <string>B5CFFBDB0EC46E83009ADE56</string>
348 <string>B5F4C4080EC4882400D4F31C</string> 348 <string>B5F4C4080EC4882400D4F31C</string>
349 - <string>B5F4C40A0EC4882400D4F31C</string>  
350 - <string>B5F4C40D0EC4882400D4F31C</string>  
351 - <string>B5F4C71D0EC4CA0100D4F31C</string>  
352 <string>B5B03D180EC5BE420089D01F</string> 349 <string>B5B03D180EC5BE420089D01F</string>
353 <string>B5B03D400EC5BED20089D01F</string> 350 <string>B5B03D400EC5BED20089D01F</string>
354 <string>B5B03DBC0EC5D21B0089D01F</string> 351 <string>B5B03DBC0EC5D21B0089D01F</string>
355 - <string>B5B040C80EC5EA970089D01F</string>  
356 <string>B5B040C90EC5EA970089D01F</string> 352 <string>B5B040C90EC5EA970089D01F</string>
357 - <string>B5B040CA0EC5EA970089D01F</string>  
358 <string>B5B040CB0EC5EA970089D01F</string> 353 <string>B5B040CB0EC5EA970089D01F</string>
359 - <string>B5B040FA0EC5EBE60089D01F</string>  
360 - <string>B5B041050EC5ECF70089D01F</string>  
361 - <string>B5B041110EC5ED2F0089D01F</string>  
362 - <string>B5B041190EC5EF0A0089D01F</string>  
363 - <string>B5B041330EC5F01A0089D01F</string>  
364 - <string>B5B041350EC5F01A0089D01F</string>  
365 <string>B5B041360EC5F01A0089D01F</string> 354 <string>B5B041360EC5F01A0089D01F</string>
366 - <string>B5B041530EC5F10F0089D01F</string> 355 + <string>B5B041A70EC5FA800089D01F</string>
367 - <string>B5B041540EC5F10F0089D01F</string> 356 + <string>B5B041AA0EC5FA800089D01F</string>
368 - <string>B5B0418B0EC5F32D0089D01F</string> 357 + <string>B5B041AC0EC5FA800089D01F</string>
369 - <string>B5B0418C0EC5F32D0089D01F</string> 358 + <string>B5B041E90EC5FB670089D01F</string>
370 - <string>B5B0418D0EC5F32D0089D01F</string> 359 + <string>B5B041EA0EC5FB670089D01F</string>
371 - <string>B5B0418E0EC5F32D0089D01F</string> 360 + <string>B5B041EB0EC5FB670089D01F</string>
372 - <string>B5B0418F0EC5F32D0089D01F</string> 361 + <string>B5B042080EC5FD750089D01F</string>
373 - <string>B5B041900EC5F32D0089D01F</string> 362 + <string>B5B042090EC5FD750089D01F</string>
374 - <string>B5B041910EC5F32D0089D01F</string> 363 + <string>B5B042410EC612E10089D01F</string>
375 - <string>B5B041920EC5F32D0089D01F</string> 364 + <string>B5B042640EC613850089D01F</string>
376 - <string>B5B041930EC5F32D0089D01F</string> 365 + <string>B5B0428B0EC614680089D01F</string>
377 - <string>B5B041940EC5F32D0089D01F</string> 366 + <string>B5B042AB0EC6159B0089D01F</string>
  367 + <string>B5B042AC0EC6159B0089D01F</string>
  368 + <string>B5B042AD0EC6159B0089D01F</string>
  369 + <string>B5B042B00EC6159B0089D01F</string>
  370 + <string>B5B042D00EC618CC0089D01F</string>
  371 + <string>B5B042EC0EC61B270089D01F</string>
  372 + <string>B5B042ED0EC61B270089D01F</string>
  373 + <string>B5B042EE0EC61B270089D01F</string>
  374 + <string>B5B042EF0EC61B270089D01F</string>
  375 + <string>B5B042F70EC61B4C0089D01F</string>
  376 + <string>B5B0431A0EC621160089D01F</string>
  377 + <string>B5B0431B0EC621160089D01F</string>
378 </array> 378 </array>
379 <key>prevStack</key> 379 <key>prevStack</key>
380 <array> 380 <array>
@@ -767,6 +767,76 @@ @@ -767,6 +767,76 @@
767 <string>B5B0419F0EC5F32D0089D01F</string> 767 <string>B5B0419F0EC5F32D0089D01F</string>
768 <string>B5B041A00EC5F32D0089D01F</string> 768 <string>B5B041A00EC5F32D0089D01F</string>
769 <string>B5B041A10EC5F32D0089D01F</string> 769 <string>B5B041A10EC5F32D0089D01F</string>
  770 + <string>B5B041AE0EC5FA800089D01F</string>
  771 + <string>B5B041AF0EC5FA800089D01F</string>
  772 + <string>B5B041B00EC5FA800089D01F</string>
  773 + <string>B5B041B10EC5FA800089D01F</string>
  774 + <string>B5B041B20EC5FA800089D01F</string>
  775 + <string>B5B041B30EC5FA800089D01F</string>
  776 + <string>B5B041B40EC5FA800089D01F</string>
  777 + <string>B5B041B50EC5FA800089D01F</string>
  778 + <string>B5B041B60EC5FA800089D01F</string>
  779 + <string>B5B041B70EC5FA800089D01F</string>
  780 + <string>B5B041B80EC5FA800089D01F</string>
  781 + <string>B5B041B90EC5FA800089D01F</string>
  782 + <string>B5B041BA0EC5FA800089D01F</string>
  783 + <string>B5B041C10EC5FAAE0089D01F</string>
  784 + <string>B5B041D60EC5FB0F0089D01F</string>
  785 + <string>B5B041DF0EC5FB2E0089D01F</string>
  786 + <string>B5B041E40EC5FB380089D01F</string>
  787 + <string>B5B041EC0EC5FB670089D01F</string>
  788 + <string>B5B041ED0EC5FB670089D01F</string>
  789 + <string>B5B041EE0EC5FB670089D01F</string>
  790 + <string>B5B041EF0EC5FB670089D01F</string>
  791 + <string>B5B041F70EC5FBBD0089D01F</string>
  792 + <string>B5B042030EC5FC130089D01F</string>
  793 + <string>B5B042040EC5FC130089D01F</string>
  794 + <string>B5B0420D0EC5FD750089D01F</string>
  795 + <string>B5B0420E0EC5FD750089D01F</string>
  796 + <string>B5B0420F0EC5FD750089D01F</string>
  797 + <string>B5B042100EC5FD750089D01F</string>
  798 + <string>B5B042110EC5FD750089D01F</string>
  799 + <string>B5B042120EC5FD750089D01F</string>
  800 + <string>B5B042130EC5FD750089D01F</string>
  801 + <string>B5B042140EC5FD750089D01F</string>
  802 + <string>B5B042150EC5FD750089D01F</string>
  803 + <string>B5B0421B0EC5FD810089D01F</string>
  804 + <string>B5B0421C0EC5FD810089D01F</string>
  805 + <string>B5B0422C0EC612390089D01F</string>
  806 + <string>B5B042450EC612E10089D01F</string>
  807 + <string>B5B042460EC612E10089D01F</string>
  808 + <string>B5B042470EC612E10089D01F</string>
  809 + <string>B5B042480EC612E10089D01F</string>
  810 + <string>B5B042490EC612E10089D01F</string>
  811 + <string>B5B042580EC613280089D01F</string>
  812 + <string>B5B042660EC613850089D01F</string>
  813 + <string>B5B042670EC613850089D01F</string>
  814 + <string>B5B042680EC613850089D01F</string>
  815 + <string>B5B0427C0EC613FB0089D01F</string>
  816 + <string>B5B042840EC6145A0089D01F</string>
  817 + <string>B5B042850EC6145A0089D01F</string>
  818 + <string>B5B042860EC6145A0089D01F</string>
  819 + <string>B5B042870EC6145A0089D01F</string>
  820 + <string>B5B042880EC6145A0089D01F</string>
  821 + <string>B5B0428E0EC614680089D01F</string>
  822 + <string>B5B0428F0EC614680089D01F</string>
  823 + <string>B5B042B10EC6159B0089D01F</string>
  824 + <string>B5B042B20EC6159B0089D01F</string>
  825 + <string>B5B042B30EC6159B0089D01F</string>
  826 + <string>B5B042B40EC6159B0089D01F</string>
  827 + <string>B5B042B50EC6159B0089D01F</string>
  828 + <string>B5B042B60EC6159B0089D01F</string>
  829 + <string>B5B042D20EC618CC0089D01F</string>
  830 + <string>B5B042F00EC61B270089D01F</string>
  831 + <string>B5B042F10EC61B270089D01F</string>
  832 + <string>B5B042F20EC61B270089D01F</string>
  833 + <string>B5B042F30EC61B270089D01F</string>
  834 + <string>B5B042F40EC61B270089D01F</string>
  835 + <string>B5B042F90EC61B4C0089D01F</string>
  836 + <string>B5B043160EC620D60089D01F</string>
  837 + <string>B5B043170EC620D60089D01F</string>
  838 + <string>B5B043180EC620D60089D01F</string>
  839 + <string>B5B0431C0EC621160089D01F</string>
770 </array> 840 </array>
771 </dict> 841 </dict>
772 <key>SplitCount</key> 842 <key>SplitCount</key>
@@ -780,7 +850,7 @@ @@ -780,7 +850,7 @@
780 <key>Frame</key> 850 <key>Frame</key>
781 <string>{{0, 0}, {1098, 836}}</string> 851 <string>{{0, 0}, {1098, 836}}</string>
782 <key>RubberWindowFrame</key> 852 <key>RubberWindowFrame</key>
783 - <string>165 158 1432 976 0 0 1920 1178 </string> 853 + <string>179 143 1432 976 0 0 1920 1178 </string>
784 </dict> 854 </dict>
785 <key>Module</key> 855 <key>Module</key>
786 <string>PBXNavigatorGroup</string> 856 <string>PBXNavigatorGroup</string>
@@ -800,7 +870,7 @@ @@ -800,7 +870,7 @@
800 <key>Frame</key> 870 <key>Frame</key>
801 <string>{{0, 841}, {1098, 94}}</string> 871 <string>{{0, 841}, {1098, 94}}</string>
802 <key>RubberWindowFrame</key> 872 <key>RubberWindowFrame</key>
803 - <string>165 158 1432 976 0 0 1920 1178 </string> 873 + <string>179 143 1432 976 0 0 1920 1178 </string>
804 </dict> 874 </dict>
805 <key>Module</key> 875 <key>Module</key>
806 <string>XCDetailModule</string> 876 <string>XCDetailModule</string>
@@ -970,7 +1040,7 @@ @@ -970,7 +1040,7 @@
970 <string>/Users/ben/asi-http-request/asi-http-request.xcodeproj</string> 1040 <string>/Users/ben/asi-http-request/asi-http-request.xcodeproj</string>
971 </array> 1041 </array>
972 <key>WindowString</key> 1042 <key>WindowString</key>
973 - <string>165 158 1432 976 0 0 1920 1178 </string> 1043 + <string>179 143 1432 976 0 0 1920 1178 </string>
974 <key>WindowToolsV3</key> 1044 <key>WindowToolsV3</key>
975 <array> 1045 <array>
976 <dict> 1046 <dict>
@@ -1138,17 +1208,17 @@ @@ -1138,17 +1208,17 @@
1138 <string>Type</string> 1208 <string>Type</string>
1139 <real>138</real> 1209 <real>138</real>
1140 <string>Value</string> 1210 <string>Value</string>
1141 - <real>140</real> 1211 + <real>197</real>
1142 <string>Summary</string> 1212 <string>Summary</string>
1143 <real>590</real> 1213 <real>590</real>
1144 </array> 1214 </array>
1145 <key>Frame</key> 1215 <key>Frame</key>
1146 <string>{{798, 0}, {871, 417}}</string> 1216 <string>{{798, 0}, {871, 417}}</string>
1147 <key>RubberWindowFrame</key> 1217 <key>RubberWindowFrame</key>
1148 - <string>105 178 1669 1000 0 0 1920 1178 </string> 1218 + <string>42 178 1669 1000 0 0 1920 1178 </string>
1149 </dict> 1219 </dict>
1150 <key>RubberWindowFrame</key> 1220 <key>RubberWindowFrame</key>
1151 - <string>105 178 1669 1000 0 0 1920 1178 </string> 1221 + <string>42 178 1669 1000 0 0 1920 1178 </string>
1152 </dict> 1222 </dict>
1153 <key>Module</key> 1223 <key>Module</key>
1154 <string>PBXDebugSessionModule</string> 1224 <string>PBXDebugSessionModule</string>
@@ -1182,7 +1252,7 @@ @@ -1182,7 +1252,7 @@
1182 <key>ToolbarConfiguration</key> 1252 <key>ToolbarConfiguration</key>
1183 <string>xcode.toolbar.config.debugV3</string> 1253 <string>xcode.toolbar.config.debugV3</string>
1184 <key>WindowString</key> 1254 <key>WindowString</key>
1185 - <string>105 178 1669 1000 0 0 1920 1178 </string> 1255 + <string>42 178 1669 1000 0 0 1920 1178 </string>
1186 <key>WindowToolGUID</key> 1256 <key>WindowToolGUID</key>
1187 <string>1CD10A99069EF8BA00B06720</string> 1257 <string>1CD10A99069EF8BA00B06720</string>
1188 <key>WindowToolIsVisible</key> 1258 <key>WindowToolIsVisible</key>
@@ -1310,7 +1380,7 @@ @@ -1310,7 +1380,7 @@
1310 <key>Frame</key> 1380 <key>Frame</key>
1311 <string>{{0, 0}, {1211, 827}}</string> 1381 <string>{{0, 0}, {1211, 827}}</string>
1312 <key>RubberWindowFrame</key> 1382 <key>RubberWindowFrame</key>
1313 - <string>289 261 1211 868 0 0 1920 1178 </string> 1383 + <string>1131 194 1211 868 0 0 1920 1178 </string>
1314 </dict> 1384 </dict>
1315 <key>Module</key> 1385 <key>Module</key>
1316 <string>PBXDebugCLIModule</string> 1386 <string>PBXDebugCLIModule</string>
@@ -1339,7 +1409,7 @@ @@ -1339,7 +1409,7 @@
1339 <key>ToolbarConfiguration</key> 1409 <key>ToolbarConfiguration</key>
1340 <string>xcode.toolbar.config.consoleV3</string> 1410 <string>xcode.toolbar.config.consoleV3</string>
1341 <key>WindowString</key> 1411 <key>WindowString</key>
1342 - <string>289 261 1211 868 0 0 1920 1178 </string> 1412 + <string>1131 194 1211 868 0 0 1920 1178 </string>
1343 <key>WindowToolGUID</key> 1413 <key>WindowToolGUID</key>
1344 <string>1C78EAAD065D492600B07095</string> 1414 <string>1C78EAAD065D492600B07095</string>
1345 <key>WindowToolIsVisible</key> 1415 <key>WindowToolIsVisible</key>
This diff could not be displayed because it is too large.