From 381816391599d2aac73f05cb9ac2b3dc01726e27 Mon Sep 17 00:00:00 2001 From: coderyi Date: Sun, 22 Oct 2017 09:41:51 +0800 Subject: [PATCH] [bugfix]code style --- .../Classes/Common/Models/DataSourceModel.h | 3 -- .../ViewControllers/CountryViewController.m | 6 ---- .../ViewControllers/UserRankViewController.m | 1 - .../MonkeyKit/NetworkEngine/YiNetworkEngine.m | 35 +++++++++---------- 4 files changed, 17 insertions(+), 28 deletions(-) diff --git a/Monkey/Classes/Common/Models/DataSourceModel.h b/Monkey/Classes/Common/Models/DataSourceModel.h index 01f1973..b584def 100755 --- a/Monkey/Classes/Common/Models/DataSourceModel.h +++ b/Monkey/Classes/Common/Models/DataSourceModel.h @@ -8,8 +8,6 @@ #import - - @interface DataSourceModel : NSObject @property(nonatomic,strong) NSMutableArray *dsArray; @@ -18,5 +16,4 @@ - (void)reset; - @end diff --git a/Monkey/Classes/Module/UsersModule/ViewControllers/CountryViewController.m b/Monkey/Classes/Module/UsersModule/ViewControllers/CountryViewController.m index 1736887..1d63c0a 100644 --- a/Monkey/Classes/Module/UsersModule/ViewControllers/CountryViewController.m +++ b/Monkey/Classes/Module/UsersModule/ViewControllers/CountryViewController.m @@ -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{ diff --git a/Monkey/Classes/Module/UsersModule/ViewControllers/UserRankViewController.m b/Monkey/Classes/Module/UsersModule/ViewControllers/UserRankViewController.m index 010db1d..07df262 100644 --- a/Monkey/Classes/Module/UsersModule/ViewControllers/UserRankViewController.m +++ b/Monkey/Classes/Module/UsersModule/ViewControllers/UserRankViewController.m @@ -21,7 +21,6 @@ @interface UserRankViewController (){ int currentIndex; UITableView *tableView1; UITableView *tableView2; - UITableView *tableView3; float titleHeight; diff --git a/Monkey/MonkeyKit/NetworkEngine/YiNetworkEngine.m b/Monkey/MonkeyKit/NetworkEngine/YiNetworkEngine.m index c9c69e4..c5a9c1d 100644 --- a/Monkey/MonkeyKit/NetworkEngine/YiNetworkEngine.m +++ b/Monkey/MonkeyKit/NetworkEngine/YiNetworkEngine.m @@ -21,7 +21,7 @@ - (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"]; @@ -29,7 +29,7 @@ - (MKNetworkOperation *)loginWithCode:(NSString *)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]); @@ -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]]) { @@ -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); } } } @@ -123,7 +122,7 @@ - (MKNetworkOperation *)showcasesDetailListWithShowcase:(NSString *)showcase RepositoryModel *model = [RepositoryModel modelWithDict:dict]; [listNew addObject:model]; } - completionBlock(listNew, 1,1); + completionBlock(listNew, 1, 1); } } } @@ -160,7 +159,7 @@ - (MKNetworkOperation *)repositoriesTrendingWithType:(NSString *)type RepositoryModel *model = [RepositoryModel modelWithDict:dict]; [listNew addObject:model]; } - completionBlock(listNew, 0,1); + completionBlock(listNew, 0, 1); } } } @@ -190,7 +189,7 @@ - (MKNetworkOperation *)showcasesWithCompletoinHandler:(PageListInfoResponseBloc ShowcasesModel *model = [ShowcasesModel modelWithDict:dict]; [listNew addObject:model]; } - completionBlock(listNew, 0,1); + completionBlock(listNew, 0, 1); } } } @@ -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); @@ -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); @@ -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); @@ -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); @@ -416,7 +415,7 @@ - (MKNetworkOperation *)searchUsersWithPage:(NSInteger)page model.myID=[[NSDate date] timeIntervalSince1970]; [listNew addObject:model]; } - completionBlock(listNew, page,totalCount); + completionBlock(listNew, page, totalCount); } } }