diff --git a/LifeLog/LifeLog/GroupDetailViewController.h b/LifeLog/LifeLog/GroupDetailViewController.h index f1520e7..725aa63 100644 --- a/LifeLog/LifeLog/GroupDetailViewController.h +++ b/LifeLog/LifeLog/GroupDetailViewController.h @@ -9,6 +9,7 @@ #import #import "BaseTableViewController.h" #import "Entities.h" +#import "AutoTransButton.h" @interface GroupDetailViewController : BaseTableViewController { GroupObject * _curGroup; @@ -18,8 +19,11 @@ @property (weak, nonatomic) IBOutlet UILabel *lblGrpName; @property (weak, nonatomic) IBOutlet UILabel *lbbGrpActiveMode; @property (weak, nonatomic) IBOutlet UILabel *lblGrpGoal; +@property (weak, nonatomic) IBOutlet AutoTransButton *btJoinGrp; +@property (weak, nonatomic) IBOutlet AutoTransButton *btSwitch; - (IBAction)clickBack:(id)sender; - (void) setGroup : (GroupObject *) object; +- (IBAction)clickSwitch:(AutoTransButton*)sender; @end diff --git a/LifeLog/LifeLog/GroupDetailViewController.m b/LifeLog/LifeLog/GroupDetailViewController.m index 358ae95..9109cbe 100644 --- a/LifeLog/LifeLog/GroupDetailViewController.m +++ b/LifeLog/LifeLog/GroupDetailViewController.m @@ -25,7 +25,9 @@ //register nib for table view [self.tableBase registerNib:[UINib nibWithNibName:@"SNSRecentTopicTableViewCell" bundle:nil] forCellReuseIdentifier:@"RecentTopicCell"]; - + if(_curGroup != nil) { + [self requestGroupDetail]; + } // Do any additional setup after loading the view from its nib. } @@ -38,16 +40,29 @@ _curGroup = object; } +- (IBAction)clickSwitch:(id)sender { +} + - (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]; + self.lblGrpName.text = _curGroup.name; + self.lblGrpGoal.text = _curGroup.goal; + NSString *mode = @""; + if(_curGroup.runMode) { + mode = [mode stringByAppendingString:@"ランニング\n"]; + } + if(_curGroup.walkMode) { + mode = [mode stringByAppendingString:@"ウォーキング\n"]; + } + if(_curGroup.bikeMode) { + mode = [mode stringByAppendingString:@"バイク\n"]; + } + self.lbbGrpActiveMode.text = mode; } } - #pragma mark IBAction - (IBAction)clickBack:(id)sender { @@ -72,6 +87,20 @@ #pragma mark Private Function +- (void) requestGroupDetail { + NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; +// MBProgressHUD *hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; + [[ServerAPI server] getGroupDetail:token withGroupID:_curGroup.groupID CompletionHandler:^(GroupObject *object, NSError *error) { +// [hudView hideAnimated:true]; + GroupDetailViewController __weak *weakSelf = self; + _curGroup = object; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf setupView]; + [weakSelf callRequestToUpdateData]; + }); + }]; +} + -(void) callRequestToUpdateData { [super callRequestToUpdateData]; diff --git a/LifeLog/LifeLog/GroupDetailViewController.xib b/LifeLog/LifeLog/GroupDetailViewController.xib index 0f73414..8ed815a 100644 --- a/LifeLog/LifeLog/GroupDetailViewController.xib +++ b/LifeLog/LifeLog/GroupDetailViewController.xib @@ -10,6 +10,8 @@ + + @@ -77,17 +79,18 @@ -