diff --git a/LifeLog/LifeLog.xcodeproj/project.pbxproj b/LifeLog/LifeLog.xcodeproj/project.pbxproj index a5224e3..6fc0550 100644 --- a/LifeLog/LifeLog.xcodeproj/project.pbxproj +++ b/LifeLog/LifeLog.xcodeproj/project.pbxproj @@ -49,6 +49,8 @@ E933E6701F3E09B6002926F5 /* SearchGroupTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E933E66E1F3E09B6002926F5 /* SearchGroupTableViewCell.m */; }; E933E6711F3E09B6002926F5 /* SearchGroupTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E933E66F1F3E09B6002926F5 /* SearchGroupTableViewCell.xib */; }; E933E6741F3E0E4E002926F5 /* GroupObject.m in Sources */ = {isa = PBXBuildFile; fileRef = E933E6731F3E0E4E002926F5 /* GroupObject.m */; }; + E933E6791F40513C002926F5 /* GroupDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E933E6771F40513C002926F5 /* GroupDetailViewController.m */; }; + E933E67A1F40513C002926F5 /* GroupDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E933E6781F40513C002926F5 /* GroupDetailViewController.xib */; }; E9373E471F3596940059355A /* AutoTransLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = E9373E461F3596940059355A /* AutoTransLabel.m */; }; E9373E4A1F35AA180059355A /* HistoryObject.m in Sources */ = {isa = PBXBuildFile; fileRef = E9373E491F35AA180059355A /* HistoryObject.m */; }; E9373E4D1F361A230059355A /* HistoryGraphObject.m in Sources */ = {isa = PBXBuildFile; fileRef = E9373E4C1F361A230059355A /* HistoryGraphObject.m */; }; @@ -161,6 +163,9 @@ E933E66F1F3E09B6002926F5 /* SearchGroupTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SearchGroupTableViewCell.xib; sourceTree = ""; }; E933E6721F3E0E4E002926F5 /* GroupObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupObject.h; sourceTree = ""; }; E933E6731F3E0E4E002926F5 /* GroupObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupObject.m; sourceTree = ""; }; + E933E6761F40513C002926F5 /* GroupDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupDetailViewController.h; sourceTree = ""; }; + E933E6771F40513C002926F5 /* GroupDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupDetailViewController.m; sourceTree = ""; }; + E933E6781F40513C002926F5 /* GroupDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = GroupDetailViewController.xib; sourceTree = ""; }; E9373E451F3596940059355A /* AutoTransLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoTransLabel.h; sourceTree = ""; }; E9373E461F3596940059355A /* AutoTransLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AutoTransLabel.m; sourceTree = ""; }; E9373E481F35AA180059355A /* HistoryObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryObject.h; sourceTree = ""; }; @@ -410,6 +415,7 @@ 6E84E3AC1F27A954001EB88E /* SNS */ = { isa = PBXGroup; children = ( + E933E6751F4050E6002926F5 /* GrouDetail */, E933E6671F3E0479002926F5 /* SeachGroup */, 6E84E3BC1F27A9B1001EB88E /* SNSViewController.h */, 6E84E3BD1F27A9B1001EB88E /* SNSViewController.m */, @@ -526,6 +532,16 @@ name = SeachGroup; sourceTree = ""; }; + E933E6751F4050E6002926F5 /* GrouDetail */ = { + isa = PBXGroup; + children = ( + E933E6761F40513C002926F5 /* GroupDetailViewController.h */, + E933E6771F40513C002926F5 /* GroupDetailViewController.m */, + E933E6781F40513C002926F5 /* GroupDetailViewController.xib */, + ); + name = GrouDetail; + sourceTree = ""; + }; E9373E441F35966D0059355A /* AutoTranslateView */ = { isa = PBXGroup; children = ( @@ -686,6 +702,7 @@ 6E84E3B61F27A98B001EB88E /* HistoryViewController.xib in Resources */, E933E66C1F3E04A6002926F5 /* SearchGroupViewController.xib in Resources */, E96855121F3C5D9A00317CEF /* SNSRecentTopicTableViewCell.xib in Resources */, + E933E67A1F40513C002926F5 /* GroupDetailViewController.xib in Resources */, E99E13B21F33720600C78787 /* LabelCollectionViewCell.xib in Resources */, E9F73DCD1F338A0F004A3A6F /* HistoryListTableViewCell.xib in Resources */, ); @@ -779,6 +796,7 @@ 6E7F93441F35872B00EFBC71 /* TPKeyboardAvoidingTableView.m in Sources */, E9F73DCC1F338A0F004A3A6F /* HistoryListTableViewCell.m in Sources */, 6EDC8BF41F2C68D700765ACC /* CMMotionActivityExtra.m in Sources */, + E933E6791F40513C002926F5 /* GroupDetailViewController.m in Sources */, 9CBDA0FF1F2F03810055DED1 /* RegisterViewController.m in Sources */, E9373E4A1F35AA180059355A /* HistoryObject.m in Sources */, 9CA8AEEA1F31BB4600C5FC74 /* ConfirmForgetPassViewController.m in Sources */, diff --git a/LifeLog/LifeLog/GroupDetailViewController.h b/LifeLog/LifeLog/GroupDetailViewController.h new file mode 100644 index 0000000..f1520e7 --- /dev/null +++ b/LifeLog/LifeLog/GroupDetailViewController.h @@ -0,0 +1,25 @@ +// +// GroupDetailViewController.h +// LifeLog +// +// Created by nvtu on 8/13/17. +// Copyright © 2017 PhongNV. All rights reserved. +// + +#import +#import "BaseTableViewController.h" +#import "Entities.h" + +@interface GroupDetailViewController : BaseTableViewController { + GroupObject * _curGroup; +} +@property (weak, nonatomic) IBOutlet UIImageView *imgAva; + +@property (weak, nonatomic) IBOutlet UILabel *lblGrpName; +@property (weak, nonatomic) IBOutlet UILabel *lbbGrpActiveMode; +@property (weak, nonatomic) IBOutlet UILabel *lblGrpGoal; + +- (IBAction)clickBack:(id)sender; + +- (void) setGroup : (GroupObject *) object; +@end diff --git a/LifeLog/LifeLog/GroupDetailViewController.m b/LifeLog/LifeLog/GroupDetailViewController.m new file mode 100644 index 0000000..358ae95 --- /dev/null +++ b/LifeLog/LifeLog/GroupDetailViewController.m @@ -0,0 +1,94 @@ +// +// GroupDetailViewController.m +// LifeLog +// +// Created by nvtu on 8/13/17. +// Copyright © 2017 PhongNV. All rights reserved. +// + +#import "GroupDetailViewController.h" +#import + +#import "Utilities.h" +#import "ServerAPI.h" +#import "SNSRecentTopicTableViewCell.h" + +@interface GroupDetailViewController () + +@end + +@implementation GroupDetailViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + [self setupView]; + + //register nib for table view + [self.tableBase registerNib:[UINib nibWithNibName:@"SNSRecentTopicTableViewCell" bundle:nil] forCellReuseIdentifier:@"RecentTopicCell"]; + + // Do any additional setup after loading the view from its nib. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void) setGroup : (GroupObject *) object { + _curGroup = object; +} + +- (void)setupView { + if(_curGroup != nil) { + self.lblGrpName.text = _curGroup.name; + if(_curGroup.avatar && ![_curGroup.avatar isKindOfClass:[NSNull class]]) { + [self.imgAva sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:_curGroup.avatar]]]; + } + [self callRequestToUpdateData]; + } +} + +#pragma mark IBAction + +- (IBAction)clickBack:(id)sender { + [self.navigationController popViewControllerAnimated:true]; +} + +#pragma mark UITableView Delegate +- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + SNSRecentTopicTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"RecentTopicCell"]; + TweetObject *object = [_curDataList objectAtIndex:indexPath.row]; + if(object.avatarLink && ![object.avatarLink isKindOfClass:[NSNull class]]) { + [cell.imgAvatar sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:object.avatarLink]]]; + } + cell.lblDateTime.text = [Utilities stringFromDate:object.createDate withFormat:@"YYYY/MM/dd hh:mm"]; + cell.lblUsername.text = object.userName; + cell.lblDes.text = object.content; + cell.lblMode.text = object.mode; + cell.lblDistance.text = [NSString stringWithFormat:@"%.0f m", object.distance]; + cell.lblDuration.text = object.time; + return cell; +} + +#pragma mark Private Function + +-(void) callRequestToUpdateData { + [super callRequestToUpdateData]; + + NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; + MBProgressHUD *hudView = nil; + if(_curPage == 1 && !self.refreshControl.isRefreshing) { + hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; + } + [[ServerAPI server] requestTweetsList:token groupID:_curGroup.groupID withPage:_curPage CompletionHandler:^(NSArray *array, NSError *error){ + dispatch_async(dispatch_get_main_queue(), ^{ + if(hudView != nil) { + [hudView hideAnimated:true]; + } + }); + GroupDetailViewController __weak *weakSelf = self; + [weakSelf updateTableData:array error:error]; + }]; +} + +@end diff --git a/LifeLog/LifeLog/GroupDetailViewController.xib b/LifeLog/LifeLog/GroupDetailViewController.xib new file mode 100644 index 0000000..0f73414 --- /dev/null +++ b/LifeLog/LifeLog/GroupDetailViewController.xib @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LifeLog/LifeLog/Localizable.strings b/LifeLog/LifeLog/Localizable.strings index 906a3654b4b04065e7d536d62d1b21ad1ffdaa2f..38b01aab65f54aeebf980ec935ea513bbc0b389e 100644 GIT binary patch delta 164 zcmeyMv_)k@fuM%IzCv(vQEFd4wq6+W?E`ae!55m&%KkaXN+O^ + + +