From 5739e821e548c57099487f8adeddce435f4b1e73 Mon Sep 17 00:00:00 2001 From: nvtu Date: Mon, 21 Aug 2017 14:39:56 +0700 Subject: [PATCH] Fix history list API, add disable load more option --- .../History/arrow_decre.imageset/Contents.json | 21 +++++++ .../History/arrow_decre.imageset/arrow_decre.png | Bin 0 -> 1365 bytes .../History/arrow_incre.imageset/Contents.json | 21 +++++++ .../History/arrow_incre.imageset/arrow_incre.png | Bin 0 -> 1527 bytes LifeLog/LifeLog/BaseTableViewController.h | 1 + LifeLog/LifeLog/BaseTableViewController.m | 3 +- LifeLog/LifeLog/HistoryListTableViewCell.h | 3 + LifeLog/LifeLog/HistoryListTableViewCell.xib | 18 +++++- LifeLog/LifeLog/HistoryObject.h | 1 + LifeLog/LifeLog/HistoryObject.m | 8 ++- LifeLog/LifeLog/HistoryViewController.h | 1 + LifeLog/LifeLog/HistoryViewController.m | 36 ++++++++--- LifeLog/LifeLog/HistoryViewController.xib | 2 +- LifeLog/LifeLog/ServerAPI.h | 3 +- LifeLog/LifeLog/ServerAPI.m | 70 +++++++-------------- 15 files changed, 123 insertions(+), 65 deletions(-) create mode 100644 LifeLog/LifeLog/Assets.xcassets/History/arrow_decre.imageset/Contents.json create mode 100644 LifeLog/LifeLog/Assets.xcassets/History/arrow_decre.imageset/arrow_decre.png create mode 100644 LifeLog/LifeLog/Assets.xcassets/History/arrow_incre.imageset/Contents.json create mode 100644 LifeLog/LifeLog/Assets.xcassets/History/arrow_incre.imageset/arrow_incre.png diff --git a/LifeLog/LifeLog/Assets.xcassets/History/arrow_decre.imageset/Contents.json b/LifeLog/LifeLog/Assets.xcassets/History/arrow_decre.imageset/Contents.json new file mode 100644 index 0000000..490351c --- /dev/null +++ b/LifeLog/LifeLog/Assets.xcassets/History/arrow_decre.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "arrow_decre.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/LifeLog/LifeLog/Assets.xcassets/History/arrow_decre.imageset/arrow_decre.png b/LifeLog/LifeLog/Assets.xcassets/History/arrow_decre.imageset/arrow_decre.png new file mode 100644 index 0000000000000000000000000000000000000000..d10a77a17600dc484edb1d1ea87f0cbc3b9c1aaf GIT binary patch literal 1365 zcmV-b1*-aqP)X1^@s6-qmI8000CHX+uL$Nkc;* zP;zf(X>4Tx062|}Rb6NtRTMtEb7vzY&QokOg>Hg1+lHrgWS zWcKdPn90sKGrRqvPeo9CG3uKX#J{(IASm?@+di}}l?o-=)F3E6wD^Ni=!>T7nL9I? zX}YoAW$t|Qo$sD|?zw001?ah|SeB6#0T!CBEf+H4bBB+JJu8rehoBb*p;u8ID_yBf z0ya+zcePvJL&AGs+11_tpRKn>9TgyPA7ZoSs0)aX0r00)%XR^J`jH<$>RKN5V(7Oq zK*TS4xZz{h!*f1C3ECFkK$#7nA@pGN!$;%jYvwjAKwmYb0gKL(K8 z-kPtb5${A?tlI~wzMrJ6wTdBr=Y%%%EaEMQ&o}4FQ^DA)s*}Z>!FI&AHCpoWI|RUq zx?7s@$8!5^Q=anY%X@i5{QA6kNcMelpE>R6eCYFpmMsVTrI(b06~u#xf1yS} z_UGdMvD``!0~u->P=lA4?YN`hilQ|3tHka)7T{2CGqw zjZfMwx$5irQN_*|e4l)UHmiYuz74Yp1t^#>hrJ3-SOXDcC_o0^7T9R1gAN8V6s;5) zieI5-7aQlmJn}lUna#nz!j%5V$X|o`xX!dHWQRV27P1=rj;t2bW$~+pTw@bIek?Zv zKPDL<64`^#UNTAck#RBsB6*5DP4<%UA_FqU$I>2EH_cM;u)Q~SI+rg`Rn{L_AC5qq~L$#SMj%U z$6Cz0vP{G5Y*=%5RT^yu;}-DInZ=349rJPVM6C3K^oO)8y(fJr{l>k`ead~!ea?NsT>_Ci%bnxC;Vy6=b6>{xYV#Ue-+LB$ z7`JEXmTRm^AtP)R9u{)KHsMiWGV&)32xCG~*nyU<>-!d;FP=Re4r3qYr~6#KE>;1F z`>_J_P5xC?ROxV(DIHdCO*p$HRQI@7^PwV@Pvuf+5K}u-6REM(K@W$s zrgorh0{i?O)v0c>QtHxU-hBdD(>iYJ4b2sIOVX2K8m~4gmYVA5h^QEb$V`rCQ-|7Z zS{nuL-t>?3n=-o(6I(7vocj#GzCZEo`!3>+v;dYIfPu#&ZWzzX2i^rZ^Mu;6+rb@? zNPG+6)c5T6zxpzGe*M(x+{AON=PiJ>H#?ob-|uwRK0yDg0B4PV0id6JRZw95ZvX%Q z32;bRa{vGr5&!@f5&>tQ(oz5b0PaadK~zW$V_?7n{{R0k1jNJuQ!LsUn6L>_DmH2; zr6Gu^e>6-n!-P_ip%bPozznVo^ll)Um$}gRxVSMu{q|^*R~UeTOhCLIh^Yad0u7M{ zTLNTo1MxWuP5lbgZ;aw)gW|1plKCEns^APjtyNuPCiia5&{N40LqKvGyt0fPy+`LpTc4A7ofNvHhl!e zfEuNM_!*kPxMP~2iBJVV1I>W=JCeb5#OlSX4rm}KJA%M!AZEm?m=sB%VHrS7RG9z( XByThzZ~^#j00000NkvXXu0mjfLv@5J literal 0 HcmV?d00001 diff --git a/LifeLog/LifeLog/Assets.xcassets/History/arrow_incre.imageset/Contents.json b/LifeLog/LifeLog/Assets.xcassets/History/arrow_incre.imageset/Contents.json new file mode 100644 index 0000000..1c9eafa --- /dev/null +++ b/LifeLog/LifeLog/Assets.xcassets/History/arrow_incre.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "arrow_incre.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/LifeLog/LifeLog/Assets.xcassets/History/arrow_incre.imageset/arrow_incre.png b/LifeLog/LifeLog/Assets.xcassets/History/arrow_incre.imageset/arrow_incre.png new file mode 100644 index 0000000000000000000000000000000000000000..ed014fbfc09d62c4cc97189311bef44854932550 GIT binary patch literal 1527 zcmVX1^@s6-qmI8000CHX+uL$Nkc;* zP;zf(X>4Tx062|}Rb6NtRTMtEb7vzY&QokOg>Hg1+lHrgWS zWcKdPn90sKGrRqvPeo9CG3uKX#J{(IASm?@+di}}l?o-=)F3E6wD^Ni=!>T7nL9I? zX}YoAW$t|Qo$sD|?zw001?ah|SeB6#0T!CBEf+H4bBB+JJu8rehoBb*p;u8ID_yBf z0ya+zcePvJL&AGs+11_tpRKn>9TgyPA7ZoSs0)aX0r00)%XR^J`jH<$>RKN5V(7Oq zK*TS4xZz{h!*f1C3ECFkK$#7nA@pGN!$;%jYvwjAKwmYb0gKL(K8 z-kPtb5${A?tlI~wzMrJ6wTdBr=Y%%%EaEMQ&o}4FQ^DA)s*}Z>!FI&AHCpoWI|RUq zx?7s@$8!5^Q=anY%X@i5{QA6kNcMelpE>R6eCYFpmMsVTrI(b06~u#xf1yS} z_UGdMvD``!0~u->P=lA4?YN`hilQ|3tHka)7T{2CGqw zjZfMwx$5irQN_*|e4l)UHmiYuz74Yp1t^#>hrJ3-SOXDcC_o0^7T9R1gAN8V6s;5) zieI5-7aQlmJn}lUna#nz!j%5V$X|o`xX!dHWQRV27P1=rj;t2bW$~+pTw@bIek?Zv zKPDL<64`^#UNTAck#RBsB6*5DP4<%UA_FqU$I>2EH_cM;u)Q~SI+rg`Rn{L_AC5qq~L$#SMj%U z$6Cz0vP{G5Y*=%5RT^yu;}-DInZ=349rJPVM6C3K^oO)8y(fJr{l>k`ead~!ea?NsT>_Ci%bnxC;Vy6=b6>{xYV#Ue-+LB$ z7`JEXmTRm^AtP)R9u{)KHsMiWGV&)32xCG~*nyU<>-!d;FP=Re4r3qYr~6#KE>;1F z`>_J_P5xC?ROxV(DIHdCO*p$HRQI@7^PwV@Pvuf+5K}u-6REM(K@W$s zrgorh0{i?O)v0c>QtHxU-hBdD(>iYJ4b2sIOVX2K8m~4gmYVA5h^QEb$V`rCQ-|7Z zS{nuL-t>?3n=-o(6I(7vocj#GzCZEo`!3>+v;dYIfPu#&ZWzzX2i^rZ^Mu;6+rb@? zNPG+6)c5T6zxpzGe*M(x+{AON=PiJ>H#?ob-|uwRK0yDg0B4PV0id6JRZw95ZvX%Q z32;bRa{vGr5&!@f5&>tQ(oz5b0gy>VK~zW$?NmEU!%!GKHw}_hszr2AD5w-c1Sc1% zqTnVtJ32bJIyw}02iFd64lWKNCwD2$DGy?;J|**NS4V)0k*y;J~qJ754

R-VVb?6(+(`@dKyft0w(Xc@xY0 z^jq%DP=&PQ1dfs=?0dQ&njghXt%^tPal#XOS~cwQjmWq&jZiy|xKqX*RaL1>@FwHX_9+NPX7rGM#ESN#|gAot~<(t;en dgq$Gu_P=?4X9sG!&tCul002ovPDHLkV1j{2 - + - + @@ -44,6 +44,13 @@ + + + + + + + @@ -55,9 +62,11 @@ + + @@ -147,6 +156,8 @@ + + @@ -156,4 +167,7 @@ + + + diff --git a/LifeLog/LifeLog/HistoryObject.h b/LifeLog/LifeLog/HistoryObject.h index 7fbb964..42260e7 100644 --- a/LifeLog/LifeLog/HistoryObject.h +++ b/LifeLog/LifeLog/HistoryObject.h @@ -11,6 +11,7 @@ @interface HistoryObject : NSObject @property (nonatomic) int step; +@property (nonatomic) int step_diff; @property (nonatomic) int missing; @property (nonatomic) int target; @property (nonatomic) int time; diff --git a/LifeLog/LifeLog/HistoryObject.m b/LifeLog/LifeLog/HistoryObject.m index a4975a8..ba70e36 100644 --- a/LifeLog/LifeLog/HistoryObject.m +++ b/LifeLog/LifeLog/HistoryObject.m @@ -7,6 +7,7 @@ // #import "HistoryObject.h" +#import "Utilities.h" @implementation HistoryObject @@ -14,6 +15,9 @@ if([dict objectForKey:@"steps"] != nil) { self.step = [dict[@"steps"] intValue]; } + if([dict objectForKey:@"step_diff"] != nil) { + self.step_diff = [dict[@"step_diff"] intValue]; + } if([dict objectForKey:@"target"] != nil) { self.target = [dict[@"target"] intValue]; } @@ -40,9 +44,7 @@ } if([dict objectForKey:@"date"] != nil) { NSString *dateString = dict[@"date"]; - NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; - [dateFormat setDateFormat:@"yyyy-MM-dd"]; - self.date = [dateFormat dateFromString:dateString]; + self.date = [Utilities dateFromString:dateString withFormat:@"yyyy-MM-dd"]; } else { self.date = [NSDate date]; diff --git a/LifeLog/LifeLog/HistoryViewController.h b/LifeLog/LifeLog/HistoryViewController.h index 7f60d2f..085581a 100644 --- a/LifeLog/LifeLog/HistoryViewController.h +++ b/LifeLog/LifeLog/HistoryViewController.h @@ -18,6 +18,7 @@ NSDate * _startDate; NSDate * _endDate; NSArray * _curHisArray; + NSArray * _curListArray; } @property (weak, nonatomic) IBOutlet UILabel *lblDatetime; diff --git a/LifeLog/LifeLog/HistoryViewController.m b/LifeLog/LifeLog/HistoryViewController.m index 76908e2..3988b43 100644 --- a/LifeLog/LifeLog/HistoryViewController.m +++ b/LifeLog/LifeLog/HistoryViewController.m @@ -23,6 +23,8 @@ // Do any additional setup after loading the view from its nib. self.title = NSLocalizedString(@"lifelog.history.title", nil); + _isDisableLoadMore = true; + [self setupView]; [self setupChartView]; @@ -67,7 +69,13 @@ [self.viewCollectionMode setNormalColor:[Utilities convertHecToColor:0x191919] highlightColor:[Utilities convertHecToColor:0x474747] textColor:[UIColor whiteColor]]; [self.viewCollectionMode setArrayTitle:modeTitle]; self.viewCollectionMode.changeCurrentIndex = ^(int index){ - [self updateView]; + if(self.tableBase.alpha == 0.0) { + [self updateView]; + } + else { + NSArray * list = [_curListArray objectAtIndex:index]; + [self updateTableData:list error:nil]; + } }; NSArray *shareTitle = [NSArray arrayWithObjects:NSLocalizedString(@"lifelog.history.share.1", nil), NSLocalizedString(@"lifelog.history.share.2", nil), NSLocalizedString(@"lifelog.history.share.3", nil), NSLocalizedString(@"lifelog.history.share.4", nil), NSLocalizedString(@"lifelog.history.share.5", nil), nil]; @@ -182,21 +190,26 @@ -(void) callRequestToUpdateData { [super callRequestToUpdateData]; NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; - int type = self.viewCollectionType.getCurrentIndex; - int mode = self.viewCollectionMode.getCurrentIndex + 1; MBProgressHUD *hudView = nil; if(_curPage == 1 && !self.refreshControl.isRefreshing) { hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; } - [[ServerAPI server] requestHistoryList:token withType:type andMode:mode AtPage:_curPage CompletionHandler:^(NSArray *array, NSError *error) { + [[ServerAPI server] requestHistoryList:token startDate:_startDate endDate:_endDate CompletionHandler:^(NSArray *array, NSError *error) { dispatch_async(dispatch_get_main_queue(), ^{ if(hudView != nil) { [hudView hideAnimated:true]; } }); HistoryViewController __weak *weakSelf = self; - [weakSelf updateTableData:array error:error]; + if(error == nil) { + _curListArray = array; + NSArray * list = [array objectAtIndex:weakSelf.viewCollectionMode.getCurrentIndex]; + [weakSelf updateTableData:list error:error]; + } + else { + [weakSelf updateTableData:array error:error]; + } }]; } @@ -218,6 +231,14 @@ _startDate = _endDate; break; } + if(_startDate == _endDate) { + self.lblDatetime.text = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日 EEEE" locale:@"ja_JP"]; + } + else { + NSString * startDateString = [Utilities stringFromDate:_startDate withFormat:@"YYYY年MM月dd日" locale:@"ja_JP"]; + NSString * endDateString = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日" locale:@"ja_JP"]; + self.lblDatetime.text = [NSString stringWithFormat:@"%@-%@", startDateString, endDateString]; + } [self checkRequestData]; } @@ -234,13 +255,11 @@ - (IBAction)clickBackward:(UIButton *)sender { _endDate = [_endDate dateByAddingTimeInterval:-86400]; - self.lblDatetime.text = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日 EEEE" locale:@"ja_JP"]; [self changeDate]; } - (IBAction)clickForward:(UIButton *)sender { _endDate = [_endDate dateByAddingTimeInterval:86400]; - self.lblDatetime.text = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日 EEEE" locale:@"ja_JP"]; [self changeDate]; } @@ -275,7 +294,10 @@ - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { HistoryListTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"HistoryListCell"]; HistoryObject * obj = [_curDataList objectAtIndex:indexPath.row]; + cell.lblTitle.text = [Utilities stringFromDate:obj.date withFormat:@"dd日 (EEEE)" locale:@"ja_JP"]; cell.lblStep.text = [NSString stringWithFormat:@"%d", obj.step]; + cell.lblDiff.text = [NSString stringWithFormat:@"%d", obj.step_diff]; + cell.imgArrow.image = (obj.step_diff > 0) ? [UIImage imageNamed:@"arrow_incre"] : [UIImage imageNamed:@"arrow_decre"]; cell.lblPower.text = [NSString stringWithFormat:@"%0.2f", obj.calories]; cell.lblDistance.text = [NSString stringWithFormat:@"%0.1f", obj.distance]; cell.lblDuration.text = [Utilities convertSecondToShortTime:obj.time]; diff --git a/LifeLog/LifeLog/HistoryViewController.xib b/LifeLog/LifeLog/HistoryViewController.xib index e5208af..aad0ce8 100644 --- a/LifeLog/LifeLog/HistoryViewController.xib +++ b/LifeLog/LifeLog/HistoryViewController.xib @@ -99,7 +99,7 @@ diff --git a/LifeLog/LifeLog/ServerAPI.h b/LifeLog/LifeLog/ServerAPI.h index 08dd7fa..72ed655 100644 --- a/LifeLog/LifeLog/ServerAPI.h +++ b/LifeLog/LifeLog/ServerAPI.h @@ -31,8 +31,7 @@ extern NSString *const kNotificationToken; #pragma mark - History Screen Function - (void) requestHistory:(NSString *)token startDate:(NSDate *)startDate endDate:(NSDate *)endDate CompletionHandler:(void (^)(NSArray *, NSError *)) completion; -- (void) requestHistoryGraph:(NSString *)token withType:(int)type andMode:(int) mode CompletionHandler:(void (^)(HistoryGraphObject *, NSError *)) completion; -- (void) requestHistoryList:(NSString *)token withType:(int)type andMode:(int) mode AtPage:(int) page CompletionHandler:(void (^)(NSArray *, NSError *)) completion; +- (void) requestHistoryList:(NSString *)token startDate:(NSDate *)startDate endDate:(NSDate *)endDate CompletionHandler:(void (^)(NSArray *, NSError *)) completion; - (void) requestJoinGroup:(NSString *)token groupID: (int) groupID CompletionHandler:(void (^)(NSError *)) completion; -(void) requestCreateGroup:(NSString *)token withGroup:(GroupObject *)group CompletionHandler:(void (^)(GroupObject *, NSError *)) completion; - (void) requestGroupList:(NSString *)token CompletionHandler:(void (^)(NSArray *, NSError *)) completion; diff --git a/LifeLog/LifeLog/ServerAPI.m b/LifeLog/LifeLog/ServerAPI.m index c7e0b1d..d75a876 100644 --- a/LifeLog/LifeLog/ServerAPI.m +++ b/LifeLog/LifeLog/ServerAPI.m @@ -463,50 +463,8 @@ NSURLSessionDataTask * searchTask; }]; } -- (void) requestHistoryGraph:(NSString *)token withType:(int)type andMode:(int) mode CompletionHandler:(void (^)(HistoryGraphObject *, NSError *)) completion { - NSString *url = [kServerAddress stringByAppendingFormat:@"/api/history/graph/%@/%d", [self convertIntToString:type], mode]; - NSLog(@"requestHistoryGraph link %@", url); - [self _request:url method:@"GET" token:token paras:nil completion:^(NSData *data, NSError *error) { - - if (completion == NULL) { - return ; - } - - if (error == nil) - { - NSDictionary *dataResult = [NSJSONSerialization JSONObjectWithData:data options: NSJSONReadingAllowFragments error: &error]; - NSLog(@"%@", dataResult); - int status = [dataResult[@"status"] intValue]; - if (status == 1) { // status = 1 success - HistoryGraphObject * object = [[HistoryGraphObject alloc] initWithData:dataResult[@"result"]]; - completion(object, nil); - } - else { - NSString *message = dataResult[@"message"]; - if (message == nil) { - message = @"Unknown error"; - } - - if ([message isEqualToString:@"Token is invalid"]) { - [self performSelectorOnMainThread:@selector(checkToken) withObject:nil waitUntilDone:YES]; - NSString *tokenNew = [[NSUserDefaults standardUserDefaults] objectForKey:kToken]; - [self requestHistoryGraph:tokenNew withType:type andMode:mode CompletionHandler:completion]; - } - else { - NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":message}]; - completion(nil, errorObject); - } - } - } - else - { - completion(nil, error); - } - }]; -} - -- (void) requestHistoryList:(NSString *)token withType:(int)type andMode:(int) mode AtPage:(int) page CompletionHandler:(void (^)(NSArray *, NSError *)) completion { - NSString *url = [kServerAddress stringByAppendingFormat:@"/api/history/list/%@/%d?page=%d&record=50", [self convertIntToString:type], mode, page]; +- (void) requestHistoryList:(NSString *)token startDate:(NSDate *)startDate endDate:(NSDate *)endDate CompletionHandler:(void (^)(NSArray *, NSError *)) completion { + NSString *url = [kServerAddress stringByAppendingFormat:@"/api/history/detail/%@/%@", [Utilities stringFromDate:startDate withFormat:@"YYYYMMdd" locale:@""], [Utilities stringFromDate:endDate withFormat:@"YYYYMMdd" locale:@""]]; NSLog(@"requestHistoryList link %@", url); [self _request:url method:@"GET" token:token paras:nil completion:^(NSData *data, NSError *error) { @@ -521,11 +479,25 @@ NSURLSessionDataTask * searchTask; int status = [dataResult[@"status"] intValue]; if (status == 1) { // status = 1 success if(dataResult[@"result"] != nil) { - NSArray * array = dataResult[@"result"][@"data"]; NSMutableArray * arrayHistory = [[NSMutableArray alloc] init]; - for(NSDictionary * dict in array) { - HistoryObject * object = [[HistoryObject alloc] initWithData:dict]; - [arrayHistory addObject:object]; + NSDictionary * arrResult = dataResult[@"result"]; + if(arrResult != nil) { + NSArray *arrayKey = [NSArray arrayWithObjects:@"mode_1", @"mode_2", @"mode_3", nil]; + for(NSString * key in arrayKey) { + NSDictionary *mode = [arrResult objectForKey:key]; + if(![[arrResult objectForKey:key] isKindOfClass:[NSNull class]]) { + NSMutableArray *array = [[NSMutableArray alloc] init]; + for(NSString *key in mode.allKeys) { + HistoryObject * objectMode = [[HistoryObject alloc] initWithData:mode[key]]; + objectMode.date = [Utilities dateFromString:key withFormat:@"yyyy-MM-dd"]; + [array addObject:objectMode]; + } + [arrayHistory addObject:array]; + } + else { + [arrayHistory addObject:[[NSArray alloc] init]]; + } + } } completion(arrayHistory, nil); } @@ -543,7 +515,7 @@ NSURLSessionDataTask * searchTask; if ([message isEqualToString:@"Token is invalid"]) { [self performSelectorOnMainThread:@selector(checkToken) withObject:nil waitUntilDone:YES]; NSString *tokenNew = [[NSUserDefaults standardUserDefaults] objectForKey:kToken]; - [self requestHistoryList:tokenNew withType:type andMode:mode AtPage:page CompletionHandler:completion]; + [self requestHistoryList:tokenNew startDate:startDate endDate:endDate CompletionHandler:completion]; } else { NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":message}]; -- 1.8.5.3