Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ARC #4

Merged
merged 25 commits into from
Feb 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 14 additions & 22 deletions Classes/ASIAuthenticationDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ @implementation ASIAuthenticationDialog
+ (void)initialize
{
if (self == [ASIAuthenticationDialog class]) {
requestsNeedingAuthentication = [[NSMutableArray array] retain];
requestsNeedingAuthentication = [NSMutableArray array];
}
}

Expand Down Expand Up @@ -98,12 +98,7 @@ - (void)dealloc
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
}
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];

[request release];
[tableView release];
[presentingController.view removeFromSuperview];
[presentingController release];
[super dealloc];
}

#pragma mark keyboard notifications
Expand Down Expand Up @@ -217,18 +212,15 @@ - (UITextField *)domainField
+ (void)dismiss
{
if ([sharedDialog respondsToSelector:@selector(presentingViewController)])
[[sharedDialog presentingViewController] dismissModalViewControllerAnimated:YES];
[[sharedDialog presentingViewController] dismissViewControllerAnimated:YES completion:nil];
else
[[sharedDialog parentViewController] dismissModalViewControllerAnimated:YES];
[[sharedDialog parentViewController] dismissViewControllerAnimated:YES completion:nil];
}

- (void)viewDidDisappear:(BOOL)animated
{
[self retain];
[sharedDialog release];
sharedDialog = nil;
[self performSelector:@selector(presentNextDialog) withObject:nil afterDelay:0];
[self release];
sharedDialog = nil;
}

- (void)dismiss
Expand All @@ -237,9 +229,9 @@ - (void)dismiss
[[self class] dismiss];
} else {
if ([self respondsToSelector:@selector(presentingViewController)])
[[self presentingViewController] dismissModalViewControllerAnimated:YES];
[[self presentingViewController] dismissViewControllerAnimated:YES completion:nil];
else
[[self parentViewController] dismissModalViewControllerAnimated:YES];
[[self parentViewController] dismissViewControllerAnimated:YES completion:nil];
}
}

Expand Down Expand Up @@ -273,10 +265,10 @@ - (void)show
}

// Setup toolbar
UINavigationBar *bar = [[[UINavigationBar alloc] init] autorelease];
UINavigationBar *bar = [[UINavigationBar alloc] init];
[bar setAutoresizingMask:UIViewAutoresizingFlexibleWidth];

UINavigationItem *navItem = [[[UINavigationItem alloc] init] autorelease];
UINavigationItem *navItem = [[UINavigationItem alloc] init];
bar.items = [NSArray arrayWithObject:navItem];

[[self view] addSubview:bar];
Expand All @@ -290,16 +282,16 @@ - (void)show
[navItem setTitle:[[[self request] url] host]];
}

[navItem setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelAuthenticationFromDialog:)] autorelease]];
[navItem setRightBarButtonItem:[[[UIBarButtonItem alloc] initWithTitle:@"Login" style:UIBarButtonItemStyleDone target:self action:@selector(loginWithCredentialsFromDialog:)] autorelease]];
[navItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelAuthenticationFromDialog:)]];
[navItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"Login" style:UIBarButtonItemStyleDone target:self action:@selector(loginWithCredentialsFromDialog:)]];

// We show the login form in a table view, similar to Safari's authentication dialog
[bar sizeToFit];
CGRect f = [[self view] bounds];
f.origin.y = [bar frame].size.height;
f.size.height -= f.origin.y;

[self setTableView:[[[UITableView alloc] initWithFrame:f style:UITableViewStyleGrouped] autorelease]];
[self setTableView:[[UITableView alloc] initWithFrame:f style:UITableViewStyleGrouped]];
[[self tableView] setDelegate:self];
[[self tableView] setDataSource:self];
[[self tableView] setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
Expand All @@ -315,7 +307,7 @@ - (void)show
}
#endif

[[self presentingController] presentModalViewController:self animated:YES];
[[self presentingController] presentViewController:self animated:YES completion:nil];
}

#pragma mark button callbacks
Expand Down Expand Up @@ -431,15 +423,15 @@ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInte
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_0
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
#else
UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0,0,0,0) reuseIdentifier:nil] autorelease];
#endif

[cell setSelectionStyle:UITableViewCellSelectionStyleNone];

CGRect f = CGRectInset([cell bounds], 10, 10);
UITextField *textField = [[[UITextField alloc] initWithFrame:f] autorelease];
UITextField *textField = [[UITextField alloc] initWithFrame:f];
[textField setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
[textField setAutocapitalizationType:UITextAutocapitalizationTypeNone];
[textField setAutocorrectionType:UITextAutocorrectionTypeNo];
Expand Down
38 changes: 19 additions & 19 deletions Classes/ASICacheDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,37 @@
// Note that some of the behaviours below are mutally exclusive - you cannot combine ASIAskServerIfModifiedWhenStaleCachePolicy and ASIAskServerIfModifiedCachePolicy, for example.
typedef enum _ASICachePolicy {

// The default cache policy. When you set a request to use this, it will use the cache's defaultCachePolicy
// ASIDownloadCache's default cache policy is 'ASIAskServerIfModifiedWhenStaleCachePolicy'
ASIUseDefaultCachePolicy = 0,
// The default cache policy. When you set a request to use this, it will use the cache's defaultCachePolicy
// ASIDownloadCache's default cache policy is 'ASIAskServerIfModifiedWhenStaleCachePolicy'
ASIUseDefaultCachePolicy = 0,

// Tell the request not to read from the cache
ASIDoNotReadFromCacheCachePolicy = 1,
// Tell the request not to read from the cache
ASIDoNotReadFromCacheCachePolicy = 1,

// The the request not to write to the cache
ASIDoNotWriteToCacheCachePolicy = 2,
// The the request not to write to the cache
ASIDoNotWriteToCacheCachePolicy = 2,

// Ask the server if there is an updated version of this resource (using a conditional GET) ONLY when the cached data is stale
ASIAskServerIfModifiedWhenStaleCachePolicy = 4,
// Ask the server if there is an updated version of this resource (using a conditional GET) ONLY when the cached data is stale
ASIAskServerIfModifiedWhenStaleCachePolicy = 4,

// Always ask the server if there is an updated version of this resource (using a conditional GET)
ASIAskServerIfModifiedCachePolicy = 8,
// Always ask the server if there is an updated version of this resource (using a conditional GET)
ASIAskServerIfModifiedCachePolicy = 8,

// If cached data exists, use it even if it is stale. This means requests will not talk to the server unless the resource they are requesting is not in the cache
ASIOnlyLoadIfNotCachedCachePolicy = 16,
// If cached data exists, use it even if it is stale. This means requests will not talk to the server unless the resource they are requesting is not in the cache
ASIOnlyLoadIfNotCachedCachePolicy = 16,

// If cached data exists, use it even if it is stale. If cached data does not exist, stop (will not set an error on the request)
ASIDontLoadCachePolicy = 32,
// If cached data exists, use it even if it is stale. If cached data does not exist, stop (will not set an error on the request)
ASIDontLoadCachePolicy = 32,

// Specifies that cached data may be used if the request fails. If cached data is used, the request will succeed without error. Usually used in combination with other options above.
ASIFallbackToCacheIfLoadFailsCachePolicy = 64
// Specifies that cached data may be used if the request fails. If cached data is used, the request will succeed without error. Usually used in combination with other options above.
ASIFallbackToCacheIfLoadFailsCachePolicy = 64
} ASICachePolicy;

// Cache storage policies control whether cached data persists between application launches (ASICachePermanentlyCacheStoragePolicy) or not (ASICacheForSessionDurationCacheStoragePolicy)
// Calling [ASIHTTPRequest clearSession] will remove any data stored using ASICacheForSessionDurationCacheStoragePolicy
typedef enum _ASICacheStoragePolicy {
ASICacheForSessionDurationCacheStoragePolicy = 0,
ASICachePermanentlyCacheStoragePolicy = 1
ASICacheForSessionDurationCacheStoragePolicy = 0,
ASICachePermanentlyCacheStoragePolicy = 1
} ASICacheStoragePolicy;


Expand Down
5 changes: 2 additions & 3 deletions Classes/ASIDataCompressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
#import <zlib.h>

@interface ASIDataCompressor : NSObject {
BOOL streamReady;
z_stream zStream;
z_stream zStream;
}

// Convenience constructor will call setupStream for you
+ (id)compressor;
+ (instancetype)compressor;

// Compress the passed chunk of data
// Passing YES for shouldFinish will finalize the deflated data - you must pass YES when you are on the last chunk of data
Expand Down
Loading