Skip to content
Browse files

Further modernization.

Now it is using the latest syntax that is clang only, and all methods
are modernized. I will find it some better image resources too.
  • Loading branch information...
1 parent 62d4281 commit ed9ddd374cbd384b7082ad18af93c19f002f3561 @xcvista xcvista committed Mar 7, 2013
View
2 Classes/Connector.m
@@ -37,7 +37,7 @@ + (NSMutableURLRequest *)jsonURLRequest:(NSString *)url withDictionary:(NSDictio
// Change dictionary into JSON data.
// Rails webservice expects all post JSON to be wrapped in a "data" param.
- NSDictionary *dataDictionary = [NSDictionary dictionaryWithObjectsAndKeys: [dictionary JSONRepresentation], @"data", nil];
+ NSDictionary *dataDictionary = @{@"data": [dictionary JSONRepresentation]};
NSString *jsonString = [NSString stringWithString: [dataDictionary JSONRepresentation]];
NSData *jsonBody = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
View
4 Classes/DataParser.m
@@ -14,9 +14,9 @@ @implementation DataParser
+ (NSNumber *) readInt:(id)value {
if(value == nil || [value isKindOfClass:[NSNull class]])
- return [NSNumber numberWithInt:0];
+ return @0;
- return [NSNumber numberWithInt:[value intValue]];
+ return @([value intValue]);
}
@end
View
18 Classes/Reachability.m
@@ -95,7 +95,7 @@ + (Reachability *)sharedReachability
- (void) dealloc
{
[self stopListeningForReachabilityChanges];
- _sharedReachability.reachabilityQueries;
+ //_sharedReachability.reachabilityQueries;
}
- (BOOL)isReachableWithoutRequiringConnection:(SCNetworkReachabilityFlags)flags
@@ -143,7 +143,7 @@ - (BOOL)isHostReachable:(NSString *)host
- (BOOL)isAdHocWiFiNetworkAvailableFlags:(SCNetworkReachabilityFlags *)outFlags
{
// Look in the cache of reachability queries for one that matches this query.
- ReachabilityQuery *query = [self.reachabilityQueries objectForKey:kLinkLocalAddressKey];
+ ReachabilityQuery *query = (self.reachabilityQueries)[kLinkLocalAddressKey];
SCNetworkReachabilityRef adHocWiFiNetworkReachability = query.reachabilityRef;
// If a cached reachability query was not found, create one.
@@ -165,7 +165,7 @@ - (BOOL)isAdHocWiFiNetworkAvailableFlags:(SCNetworkReachabilityFlags *)outFlags
query.reachabilityRef = adHocWiFiNetworkReachability;
// Add the reachability query to the cache.
- [self.reachabilityQueries setObject:query forKey:kLinkLocalAddressKey];
+ (self.reachabilityQueries)[kLinkLocalAddressKey] = query;
}
// If necessary, register for notifcations for the SCNetworkReachabilityRef on the current run loop.
@@ -208,7 +208,7 @@ static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach
// determine which network interface is available.
- (BOOL)isNetworkAvailableFlags:(SCNetworkReachabilityFlags *)outFlags
{
- ReachabilityQuery *query = [self.reachabilityQueries objectForKey:kDefaultRouteKey];
+ ReachabilityQuery *query = (self.reachabilityQueries)[kDefaultRouteKey];
SCNetworkReachabilityRef defaultRouteReachability = query.reachabilityRef;
// If a cached reachability query was not found, create one.
@@ -225,7 +225,7 @@ - (BOOL)isNetworkAvailableFlags:(SCNetworkReachabilityFlags *)outFlags
query.hostNameOrAddress = kDefaultRouteKey;
query.reachabilityRef = defaultRouteReachability;
- [self.reachabilityQueries setObject:query forKey:kDefaultRouteKey];
+ (self.reachabilityQueries)[kDefaultRouteKey] = query;
}
// If necessary, register for notifcations for the SCNetworkReachabilityRef on the current run loop.
@@ -288,7 +288,7 @@ - (SCNetworkReachabilityRef)reachabilityRefForHostName:(NSString *)hostName
}
// Look in the cache for an existing SCNetworkReachabilityRef for hostName.
- ReachabilityQuery *cachedQuery = [self.reachabilityQueries objectForKey:hostName];
+ ReachabilityQuery *cachedQuery = (self.reachabilityQueries)[hostName];
SCNetworkReachabilityRef reachabilityRefForHostName = cachedQuery.reachabilityRef;
if (reachabilityRefForHostName) {
@@ -313,7 +313,7 @@ - (SCNetworkReachabilityRef)reachabilityRefForHostName:(NSString *)hostName
[query scheduleOnRunLoop:[NSRunLoop currentRunLoop]];
// ... and add it to the cache.
- [self.reachabilityQueries setObject:query forKey:hostName];
+ (self.reachabilityQueries)[hostName] = query;
return reachabilityRefForHostName;
}
@@ -338,7 +338,7 @@ - (SCNetworkReachabilityRef)reachabilityRefForAddress:(NSString *)addressString
}
// Look in the cache for an existing SCNetworkReachabilityRef for addressString.
- ReachabilityQuery *cachedQuery = [self.reachabilityQueries objectForKey:addressString];
+ ReachabilityQuery *cachedQuery = (self.reachabilityQueries)[addressString];
SCNetworkReachabilityRef reachabilityRefForAddress = cachedQuery.reachabilityRef;
if (reachabilityRefForAddress) {
@@ -363,7 +363,7 @@ - (SCNetworkReachabilityRef)reachabilityRefForAddress:(NSString *)addressString
[query scheduleOnRunLoop:[NSRunLoop currentRunLoop]];
// ... and add it to the cache.
- [self.reachabilityQueries setObject:query forKey:addressString];
+ (self.reachabilityQueries)[addressString] = query;
return reachabilityRefForAddress;
}
View
4 Classes/RepoCommitsViewController.m
@@ -60,11 +60,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
- cell = [[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Set up the cell...
- cell.text = [(Commit *)[repoCommits objectAtIndex:[indexPath row]] message];
+ cell.textLabel.text = [(Commit *)repoCommits[[indexPath row]] message];
return cell;
}
View
10 Classes/RepositoriesViewController.m
@@ -50,22 +50,22 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
- cell = [[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
// Set up the cell...
- cell.text = [(Repository *)[repositories objectAtIndex:[indexPath row]] name];
+ cell.textLabel.text = [(Repository *)repositories[[indexPath row]] name];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
RepoCommitsViewController *repoCommitsViewController = [[RepoCommitsViewController alloc] initWithNibName:@"RepoCommitsView" bundle:nil];
- Repository *repository = [repositories objectAtIndex:[indexPath row]];
+ Repository *repository = repositories[[indexPath row]];
- repoCommitsViewController.repoCommits;
- repository.commits;
+ //repoCommitsViewController.repoCommits;
+ //repository.commits;
[repository loadCommits];
repoCommitsViewController.repoCommits = repository.commits;
View
24 Classes/RootViewController.m
@@ -73,13 +73,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
case 0: {
switch(indexPath.row) {
case 0: {
- cell.text = @"Public Repositories";
- cell.image = [UIImage imageNamed:@"public.png"];
+ cell.textLabel.text = @"Public Repositories";
+ cell.imageView.image = [UIImage imageNamed:@"public.png"];
break;
}
case 1: {
- cell.text = @"Private Repositories";
- cell.image = [UIImage imageNamed:@"private.png"];
+ cell.textLabel.text = @"Private Repositories";
+ cell.imageView.image = [UIImage imageNamed:@"private.png"];
break;
}
}
@@ -88,8 +88,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
case 1: {
switch(indexPath.row) {
case 0: {
- cell.text = @"News Feed";
- cell.image = [UIImage imageNamed:@"feed.png"];
+ cell.textLabel.text = @"News Feed";
+ cell.imageView.image = [UIImage imageNamed:@"feed.png"];
break;
}
}
@@ -98,8 +98,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
case 2: {
switch(indexPath.row) {
case 0: {
- cell.text = @"Search";
- cell.image = [UIImage imageNamed:@"octocat_small.png"];
+ cell.textLabel.text = @"Search";
+ cell.imageView.image = [UIImage imageNamed:@"octocat_small.png"];
break;
}
}
@@ -108,8 +108,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
case 3: {
switch(indexPath.row) {
case 0: {
- cell.text = @"About GitHub GitPhone";
- cell.image = [UIImage imageNamed:@"octocat_small.png"];
+ cell.textLabel.text = @"About GitHub GitPhone";
+ cell.imageView.image = [UIImage imageNamed:@"octocat_small.png"];
break;
}
}
@@ -127,12 +127,12 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
case 0: {
switch(indexPath.row) {
case 0: {
- repositoriesViewController.repositories;
+ //repositoriesViewController.repositories;
repositoriesViewController.repositories = [[Config instance] publicRepositories];
break;
}
case 1: {
- repositoriesViewController.repositories;
+ //repositoriesViewController.repositories;
repositoriesViewController.repositories = [[Config instance] privateRepositories];
break;
}
View
BIN ...odeproj/project.xcworkspace/xcuserdata/technix.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.

0 comments on commit ed9ddd3

Please sign in to comment.
Something went wrong with that request. Please try again.