Skip to content

Commit

Permalink
[bugfix]code style
Browse files Browse the repository at this point in the history
  • Loading branch information
coderyi committed Oct 22, 2017
1 parent 49dda9a commit 3818163
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 28 deletions.
3 changes: 0 additions & 3 deletions Monkey/Classes/Common/Models/DataSourceModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#import <Foundation/Foundation.h>



@interface DataSourceModel : NSObject

@property(nonatomic,strong) NSMutableArray *dsArray;
Expand All @@ -18,5 +16,4 @@

- (void)reset;


@end
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ - (void)dealloc
#endif
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

#pragma mark - UITableViewDataSource &UITableViewDelegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ @interface UserRankViewController ()<UITableViewDelegate>{
int currentIndex;
UITableView *tableView1;
UITableView *tableView2;

UITableView *tableView3;

float titleHeight;
Expand Down
35 changes: 17 additions & 18 deletions Monkey/MonkeyKit/NetworkEngine/YiNetworkEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ - (MKNetworkOperation *)loginWithCode:(NSString *)code
completoinHandler:(StringResponseBlock)completionBlock
errorHandel:(MKNKErrorBlock)errorBlock
{
NSString *getString = [NSString stringWithFormat:@"/login/oauth/access_token/"];
NSString *pathString = [NSString stringWithFormat:@"/login/oauth/access_token/"];
NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
[dic setValue:[[AESCrypt decrypt:CoderyiClientID password:@"xxxsd-sdsd*sd672323q___---_w.."] substringFromIndex:1] forKey:@"client_id"];
[dic setValue:[[AESCrypt decrypt:CoderyiClientSecret password:@"xx3xc45sqvzupb4xsd-sdsd*sd672323q___---_w.."] substringFromIndex:1] forKey:@"client_secret"];
[dic setValue:code forKey:@"code"];
[dic setValue:@"1995" forKey:@"state"];
[dic setValue:@"https://github.com/coderyi/monkey" forKey:@"redirect_uri"];
MKNetworkOperation *op =
[self operationWithPath:getString params:dic httpMethod:@"POST" ssl:YES];
[self operationWithPath:pathString params:dic httpMethod:@"POST" ssl:YES];
NSLog(@"%@", op.url);
[op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
completionBlock([completedOperation responseString]);
Expand All @@ -51,7 +51,7 @@ - (MKNetworkOperation *)getUserInfoWithToken:(NSString *)token
NSString *getString = [NSString stringWithFormat:@"/user?access_token=%@",token];
MKNetworkOperation *op =
[self operationWithPath:getString params:nil httpMethod:@"GET" ssl:YES];
NSLog(@"%@", op.url);
NSLog(@"%@", op.url);
[op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
if ([[completedOperation responseJSON]
isKindOfClass:[NSDictionary class]]) {
Expand Down Expand Up @@ -81,14 +81,13 @@ - (MKNetworkOperation *)repositoriesTrendingWithPage:(NSInteger)page
NSArray *list = [completedOperation responseJSON];
if ([list isKindOfClass:[NSArray class]]) {
if (list.count > 0) {
NSMutableArray *listNew =
[[NSMutableArray alloc] initWithCapacity:32];
NSMutableArray *listNew = [[NSMutableArray alloc] initWithCapacity:32];
for (NSInteger i = 0; i < list.count; i++) {
NSDictionary *dict = [list objectAtIndex:i];
UserReceivedEventModel *model = [UserReceivedEventModel modelWithDict:dict];
[listNew addObject:model];
}
completionBlock(listNew, page,1);
completionBlock(listNew, page, 1);
}
}
}
Expand Down Expand Up @@ -123,7 +122,7 @@ - (MKNetworkOperation *)showcasesDetailListWithShowcase:(NSString *)showcase
RepositoryModel *model = [RepositoryModel modelWithDict:dict];
[listNew addObject:model];
}
completionBlock(listNew, 1,1);
completionBlock(listNew, 1, 1);
}
}
}
Expand Down Expand Up @@ -160,7 +159,7 @@ - (MKNetworkOperation *)repositoriesTrendingWithType:(NSString *)type
RepositoryModel *model = [RepositoryModel modelWithDict:dict];
[listNew addObject:model];
}
completionBlock(listNew, 0,1);
completionBlock(listNew, 0, 1);
}
}
}
Expand Down Expand Up @@ -190,7 +189,7 @@ - (MKNetworkOperation *)showcasesWithCompletoinHandler:(PageListInfoResponseBloc
ShowcasesModel *model = [ShowcasesModel modelWithDict:dict];
[listNew addObject:model];
}
completionBlock(listNew, 0,1);
completionBlock(listNew, 0, 1);
}
}
}
Expand Down Expand Up @@ -238,9 +237,9 @@ - (MKNetworkOperation *)starRepoWithOwner:(NSString *)owner
errorHandel:(MKNKErrorBlock)errorBlock
{
NSString *access_token=[[NSUserDefaults standardUserDefaults] objectForKey:@"access_token"];
NSString *getString = [NSString stringWithFormat:@"/user/starred/%@/%@?access_token=%@",owner,repo,access_token];
NSString *path = [NSString stringWithFormat:@"/user/starred/%@/%@?access_token=%@",owner,repo,access_token];
MKNetworkOperation *op =
[self operationWithPath:getString params:nil httpMethod:@"PUT" ssl:YES];
[self operationWithPath:path params:nil httpMethod:@"PUT" ssl:YES];
[op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
if (completedOperation.HTTPStatusCode==204) {
completionBlock(YES);
Expand All @@ -266,9 +265,9 @@ - (MKNetworkOperation *)unStarRepoWithOwner:(NSString *)owner
errorHandel:(MKNKErrorBlock)errorBlock
{
NSString *access_token=[[NSUserDefaults standardUserDefaults] objectForKey:@"access_token"];
NSString *getString = [NSString stringWithFormat:@"/user/starred/%@/%@?access_token=%@",owner,repo,access_token];
NSString *path = [NSString stringWithFormat:@"/user/starred/%@/%@?access_token=%@",owner,repo,access_token];
MKNetworkOperation *op =
[self operationWithPath:getString params:nil httpMethod:@"DELETE" ssl:YES];
[self operationWithPath:path params:nil httpMethod:@"DELETE" ssl:YES];
[op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
if (completedOperation.HTTPStatusCode==204) {
completionBlock(YES);
Expand Down Expand Up @@ -330,9 +329,9 @@ - (MKNetworkOperation *)followUserWithUsername:(NSString *)username
username=[[NSUserDefaults standardUserDefaults] objectForKey:@"currentLogin"];
}
NSString *access_token=[[NSUserDefaults standardUserDefaults] objectForKey:@"access_token"];
NSString *getString = [NSString stringWithFormat:@"/user/following/%@?access_token=%@",target_user,access_token];
NSString *path = [NSString stringWithFormat:@"/user/following/%@?access_token=%@",target_user,access_token];
MKNetworkOperation *op =
[self operationWithPath:getString params:nil httpMethod:@"PUT" ssl:YES];
[self operationWithPath:path params:nil httpMethod:@"PUT" ssl:YES];
[op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
if (completedOperation.HTTPStatusCode==204) {
completionBlock(YES);
Expand Down Expand Up @@ -361,9 +360,9 @@ - (MKNetworkOperation *)unfollowUserWithUsername:(NSString *)username
username=[[NSUserDefaults standardUserDefaults] objectForKey:@"currentLogin"];
}
NSString *access_token=[[NSUserDefaults standardUserDefaults] objectForKey:@"access_token"];
NSString *getString = [NSString stringWithFormat:@"/user/following/%@?access_token=%@",target_user,access_token];
NSString *path = [NSString stringWithFormat:@"/user/following/%@?access_token=%@",target_user,access_token];
MKNetworkOperation *op =
[self operationWithPath:getString params:nil httpMethod:@"DELETE" ssl:YES];
[self operationWithPath:path params:nil httpMethod:@"DELETE" ssl:YES];
[op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
if (completedOperation.HTTPStatusCode==204) {
completionBlock(YES);
Expand Down Expand Up @@ -416,7 +415,7 @@ - (MKNetworkOperation *)searchUsersWithPage:(NSInteger)page
model.myID=[[NSDate date] timeIntervalSince1970];
[listNew addObject:model];
}
completionBlock(listNew, page,totalCount);
completionBlock(listNew, page, totalCount);
}
}
}
Expand Down

0 comments on commit 3818163

Please sign in to comment.