Compare View
Commits (7)
Changes
Showing 36 changed files Side-by-side Diff
- LifeLog/LifeLog.xcodeproj/project.pbxproj
- LifeLog/LifeLog/Assets.xcassets/History/arrow_down.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/History/arrow_down.imageset/arrow_down.png
- LifeLog/LifeLog/BaseTableViewController.m
- LifeLog/LifeLog/CreateGroupViewController.h
- LifeLog/LifeLog/CreateGroupViewController.m
- LifeLog/LifeLog/CreateGroupViewController.xib
- LifeLog/LifeLog/Entities.h
- LifeLog/LifeLog/GroupDetailViewController.h
- LifeLog/LifeLog/GroupDetailViewController.m
- LifeLog/LifeLog/GroupDetailViewController.xib
- LifeLog/LifeLog/GroupObject.h
- LifeLog/LifeLog/GroupObject.m
- LifeLog/LifeLog/HistoryObject.h
- LifeLog/LifeLog/HistoryObject.m
- LifeLog/LifeLog/HistoryViewController.h
- LifeLog/LifeLog/HistoryViewController.m
- LifeLog/LifeLog/HistoryViewController.xib
- LifeLog/LifeLog/Localizable.strings
- LifeLog/LifeLog/MemberObject.h
- LifeLog/LifeLog/MemberObject.m
- LifeLog/LifeLog/MyGroupViewController.h
- LifeLog/LifeLog/MyGroupViewController.m
- LifeLog/LifeLog/MyGroupViewController.xib
- LifeLog/LifeLog/RankingViewController.xib
- LifeLog/LifeLog/SNSViewController.m
- LifeLog/LifeLog/SNSViewController.xib
- LifeLog/LifeLog/SearchGroupViewController.h
- LifeLog/LifeLog/SearchGroupViewController.m
- LifeLog/LifeLog/SearchGroupViewController.xib
- LifeLog/LifeLog/ServerAPI.h
- LifeLog/LifeLog/ServerAPI.m
- LifeLog/LifeLog/TweetObject.h
- LifeLog/LifeLog/TweetObject.m
- LifeLog/LifeLog/Utilities.h
- LifeLog/LifeLog/Utilities.m
LifeLog/LifeLog.xcodeproj/project.pbxproj
... | ... | @@ -57,6 +57,11 @@ |
57 | 57 | E9373E471F3596940059355A /* AutoTransLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = E9373E461F3596940059355A /* AutoTransLabel.m */; }; |
58 | 58 | E9373E4A1F35AA180059355A /* HistoryObject.m in Sources */ = {isa = PBXBuildFile; fileRef = E9373E491F35AA180059355A /* HistoryObject.m */; }; |
59 | 59 | E9373E4D1F361A230059355A /* HistoryGraphObject.m in Sources */ = {isa = PBXBuildFile; fileRef = E9373E4C1F361A230059355A /* HistoryGraphObject.m */; }; |
60 | + E9497FD51F46EC1100E6AF8D /* MemberObject.m in Sources */ = {isa = PBXBuildFile; fileRef = E9497FD41F46EC1100E6AF8D /* MemberObject.m */; }; | |
61 | + E95F4CED1F475C6A00D27E80 /* CreateGroupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E95F4CEB1F475C6A00D27E80 /* CreateGroupViewController.m */; }; | |
62 | + E95F4CEE1F475C6A00D27E80 /* CreateGroupViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E95F4CEC1F475C6A00D27E80 /* CreateGroupViewController.xib */; }; | |
63 | + E95F4CF31F48B39200D27E80 /* MyGroupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E95F4CF11F48B39200D27E80 /* MyGroupViewController.m */; }; | |
64 | + E95F4CF41F48B39200D27E80 /* MyGroupViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E95F4CF21F48B39200D27E80 /* MyGroupViewController.xib */; }; | |
60 | 65 | E9682E2E1F39675A00FE05A2 /* RankingTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E9682E2C1F39675A00FE05A2 /* RankingTableViewCell.m */; }; |
61 | 66 | E9682E2F1F39675A00FE05A2 /* RankingTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E9682E2D1F39675A00FE05A2 /* RankingTableViewCell.xib */; }; |
62 | 67 | E968550A1F3C444900317CEF /* AutoTransButton.m in Sources */ = {isa = PBXBuildFile; fileRef = E96855091F3C444900317CEF /* AutoTransButton.m */; }; |
... | ... | @@ -181,6 +186,14 @@ |
181 | 186 | E9373E491F35AA180059355A /* HistoryObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HistoryObject.m; sourceTree = "<group>"; }; |
182 | 187 | E9373E4B1F361A230059355A /* HistoryGraphObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryGraphObject.h; sourceTree = "<group>"; }; |
183 | 188 | E9373E4C1F361A230059355A /* HistoryGraphObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HistoryGraphObject.m; sourceTree = "<group>"; }; |
189 | + E9497FD31F46EC1100E6AF8D /* MemberObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemberObject.h; sourceTree = "<group>"; }; | |
190 | + E9497FD41F46EC1100E6AF8D /* MemberObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MemberObject.m; sourceTree = "<group>"; }; | |
191 | + E95F4CEA1F475C6A00D27E80 /* CreateGroupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CreateGroupViewController.h; sourceTree = "<group>"; }; | |
192 | + E95F4CEB1F475C6A00D27E80 /* CreateGroupViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CreateGroupViewController.m; sourceTree = "<group>"; }; | |
193 | + E95F4CEC1F475C6A00D27E80 /* CreateGroupViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CreateGroupViewController.xib; sourceTree = "<group>"; }; | |
194 | + E95F4CF01F48B39200D27E80 /* MyGroupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyGroupViewController.h; sourceTree = "<group>"; }; | |
195 | + E95F4CF11F48B39200D27E80 /* MyGroupViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyGroupViewController.m; sourceTree = "<group>"; }; | |
196 | + E95F4CF21F48B39200D27E80 /* MyGroupViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MyGroupViewController.xib; sourceTree = "<group>"; }; | |
184 | 197 | E9682E2B1F39675A00FE05A2 /* RankingTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankingTableViewCell.h; sourceTree = "<group>"; }; |
185 | 198 | E9682E2C1F39675A00FE05A2 /* RankingTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankingTableViewCell.m; sourceTree = "<group>"; }; |
186 | 199 | E9682E2D1F39675A00FE05A2 /* RankingTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RankingTableViewCell.xib; sourceTree = "<group>"; }; |
... | ... | @@ -281,6 +294,8 @@ |
281 | 294 | E9D909201F3D559D004CF99F /* TweetObject.m */, |
282 | 295 | E933E6721F3E0E4E002926F5 /* GroupObject.h */, |
283 | 296 | E933E6731F3E0E4E002926F5 /* GroupObject.m */, |
297 | + E9497FD31F46EC1100E6AF8D /* MemberObject.h */, | |
298 | + E9497FD41F46EC1100E6AF8D /* MemberObject.m */, | |
284 | 299 | ); |
285 | 300 | name = Model; |
286 | 301 | sourceTree = "<group>"; |
... | ... | @@ -308,6 +323,7 @@ |
308 | 323 | 6E84E3981F27A703001EB88E /* LifeLogUITests */, |
309 | 324 | DE8269E957EA47CD771BAB33 /* Pods */, |
310 | 325 | 020C1721B642EF36F31E1BB4 /* Frameworks */, |
326 | + 783929CF869F5081762B3DCA /* Products */, | |
311 | 327 | ); |
312 | 328 | sourceTree = "<group>"; |
313 | 329 | }; |
... | ... | @@ -430,7 +446,9 @@ |
430 | 446 | 6E84E3AC1F27A954001EB88E /* SNS */ = { |
431 | 447 | isa = PBXGroup; |
432 | 448 | children = ( |
433 | - E933E6751F4050E6002926F5 /* GrouDetail */, | |
449 | + E95F4CEF1F48B37100D27E80 /* MyGroup */, | |
450 | + E95F4CE91F475C4B00D27E80 /* CreateGroup */, | |
451 | + E933E6751F4050E6002926F5 /* GroupDetail */, | |
434 | 452 | E933E6671F3E0479002926F5 /* SeachGroup */, |
435 | 453 | 6E84E3BC1F27A9B1001EB88E /* SNSViewController.h */, |
436 | 454 | 6E84E3BD1F27A9B1001EB88E /* SNSViewController.m */, |
... | ... | @@ -491,6 +509,13 @@ |
491 | 509 | name = Common; |
492 | 510 | sourceTree = "<group>"; |
493 | 511 | }; |
512 | + 783929CF869F5081762B3DCA /* Products */ = { | |
513 | + isa = PBXGroup; | |
514 | + children = ( | |
515 | + ); | |
516 | + name = Products; | |
517 | + sourceTree = "<group>"; | |
518 | + }; | |
494 | 519 | 9CA8AEE61F31BB1200C5FC74 /* ConfirmForgetPass */ = { |
495 | 520 | isa = PBXGroup; |
496 | 521 | children = ( |
... | ... | @@ -547,14 +572,14 @@ |
547 | 572 | name = SeachGroup; |
548 | 573 | sourceTree = "<group>"; |
549 | 574 | }; |
550 | - E933E6751F4050E6002926F5 /* GrouDetail */ = { | |
575 | + E933E6751F4050E6002926F5 /* GroupDetail */ = { | |
551 | 576 | isa = PBXGroup; |
552 | 577 | children = ( |
553 | 578 | E933E6761F40513C002926F5 /* GroupDetailViewController.h */, |
554 | 579 | E933E6771F40513C002926F5 /* GroupDetailViewController.m */, |
555 | 580 | E933E6781F40513C002926F5 /* GroupDetailViewController.xib */, |
556 | 581 | ); |
557 | - name = GrouDetail; | |
582 | + name = GroupDetail; | |
558 | 583 | sourceTree = "<group>"; |
559 | 584 | }; |
560 | 585 | E9373E441F35966D0059355A /* AutoTranslateView */ = { |
... | ... | @@ -568,6 +593,26 @@ |
568 | 593 | name = AutoTranslateView; |
569 | 594 | sourceTree = "<group>"; |
570 | 595 | }; |
596 | + E95F4CE91F475C4B00D27E80 /* CreateGroup */ = { | |
597 | + isa = PBXGroup; | |
598 | + children = ( | |
599 | + E95F4CEA1F475C6A00D27E80 /* CreateGroupViewController.h */, | |
600 | + E95F4CEB1F475C6A00D27E80 /* CreateGroupViewController.m */, | |
601 | + E95F4CEC1F475C6A00D27E80 /* CreateGroupViewController.xib */, | |
602 | + ); | |
603 | + name = CreateGroup; | |
604 | + sourceTree = "<group>"; | |
605 | + }; | |
606 | + E95F4CEF1F48B37100D27E80 /* MyGroup */ = { | |
607 | + isa = PBXGroup; | |
608 | + children = ( | |
609 | + E95F4CF01F48B39200D27E80 /* MyGroupViewController.h */, | |
610 | + E95F4CF11F48B39200D27E80 /* MyGroupViewController.m */, | |
611 | + E95F4CF21F48B39200D27E80 /* MyGroupViewController.xib */, | |
612 | + ); | |
613 | + name = MyGroup; | |
614 | + sourceTree = "<group>"; | |
615 | + }; | |
571 | 616 | E99E13A71F336F0C00C78787 /* CustomView */ = { |
572 | 617 | isa = PBXGroup; |
573 | 618 | children = ( |
... | ... | @@ -684,7 +729,7 @@ |
684 | 729 | Base, |
685 | 730 | ); |
686 | 731 | mainGroup = 6E84E3681F27A700001EB88E; |
687 | - productRefGroup = 6E84E3721F27A700001EB88E /* Products */; | |
732 | + productRefGroup = 783929CF869F5081762B3DCA /* Products */; | |
688 | 733 | projectDirPath = ""; |
689 | 734 | projectRoot = ""; |
690 | 735 | targets = ( |
... | ... | @@ -701,6 +746,7 @@ |
701 | 746 | buildActionMask = 2147483647; |
702 | 747 | files = ( |
703 | 748 | 9CBDA1001F2F03810055DED1 /* RegisterViewController.xib in Resources */, |
749 | + E95F4CEE1F475C6A00D27E80 /* CreateGroupViewController.xib in Resources */, | |
704 | 750 | 6E18CED41F2E39DB0029891F /* LoginViewController.xib in Resources */, |
705 | 751 | E99E13AD1F336F4500C78787 /* CollectionView.xib in Resources */, |
706 | 752 | 6E84E3BB1F27A9A0001EB88E /* RankingViewController.xib in Resources */, |
... | ... | @@ -715,6 +761,7 @@ |
715 | 761 | 6EF1630A1F29069300DA306C /* Localizable.strings in Resources */, |
716 | 762 | 6E84E3B11F27A975001EB88E /* HomeViewController.xib in Resources */, |
717 | 763 | 6E84E3B61F27A98B001EB88E /* HistoryViewController.xib in Resources */, |
764 | + E95F4CF41F48B39200D27E80 /* MyGroupViewController.xib in Resources */, | |
718 | 765 | E933E66C1F3E04A6002926F5 /* SearchGroupViewController.xib in Resources */, |
719 | 766 | E96855121F3C5D9A00317CEF /* SNSRecentTopicTableViewCell.xib in Resources */, |
720 | 767 | E933E67A1F40513C002926F5 /* GroupDetailViewController.xib in Resources */, |
... | ... | @@ -814,6 +861,7 @@ |
814 | 861 | 6EDC8BF41F2C68D700765ACC /* CMMotionActivityExtra.m in Sources */, |
815 | 862 | E933E6791F40513C002926F5 /* GroupDetailViewController.m in Sources */, |
816 | 863 | 6EA4AF311F40BB7A00F52CFE /* StepObject.m in Sources */, |
864 | + E95F4CED1F475C6A00D27E80 /* CreateGroupViewController.m in Sources */, | |
817 | 865 | 9CBDA0FF1F2F03810055DED1 /* RegisterViewController.m in Sources */, |
818 | 866 | E9373E4A1F35AA180059355A /* HistoryObject.m in Sources */, |
819 | 867 | 9CA8AEEA1F31BB4600C5FC74 /* ConfirmForgetPassViewController.m in Sources */, |
... | ... | @@ -823,12 +871,14 @@ |
823 | 871 | 6E84E3C51F27ACAE001EB88E /* MapViewController.m in Sources */, |
824 | 872 | 6E18CEDC1F2E40F50029891F /* User.m in Sources */, |
825 | 873 | 6ECC40711F2A5FEB00AAEB97 /* NSDate+helper.m in Sources */, |
874 | + E9497FD51F46EC1100E6AF8D /* MemberObject.m in Sources */, | |
826 | 875 | 6E18CED31F2E39DB0029891F /* LoginViewController.m in Sources */, |
827 | 876 | 6EA4AF331F40BB7A00F52CFE /* TopObject.m in Sources */, |
828 | 877 | E9D909241F3D6E8C004CF99F /* BaseTableViewController.m in Sources */, |
829 | 878 | 6E84E3761F27A701001EB88E /* main.m in Sources */, |
830 | 879 | E933E6701F3E09B6002926F5 /* SearchGroupTableViewCell.m in Sources */, |
831 | 880 | 6E84E3B51F27A98B001EB88E /* HistoryViewController.m in Sources */, |
881 | + E95F4CF31F48B39200D27E80 /* MyGroupViewController.m in Sources */, | |
832 | 882 | E9373E4D1F361A230059355A /* HistoryGraphObject.m in Sources */, |
833 | 883 | E933E66B1F3E04A6002926F5 /* SearchGroupViewController.m in Sources */, |
834 | 884 | 6E84E3BF1F27A9B1001EB88E /* SNSViewController.m in Sources */, |
LifeLog/LifeLog/Assets.xcassets/History/arrow_down.imageset/Contents.json
... | ... | @@ -0,0 +1,21 @@ |
1 | +{ | |
2 | + "images" : [ | |
3 | + { | |
4 | + "idiom" : "universal", | |
5 | + "scale" : "1x" | |
6 | + }, | |
7 | + { | |
8 | + "idiom" : "universal", | |
9 | + "filename" : "arrow_down.png", | |
10 | + "scale" : "2x" | |
11 | + }, | |
12 | + { | |
13 | + "idiom" : "universal", | |
14 | + "scale" : "3x" | |
15 | + } | |
16 | + ], | |
17 | + "info" : { | |
18 | + "version" : 1, | |
19 | + "author" : "xcode" | |
20 | + } | |
21 | +} | |
0 | 22 | \ No newline at end of file |
LifeLog/LifeLog/Assets.xcassets/History/arrow_down.imageset/arrow_down.png
527 Bytes
LifeLog/LifeLog/BaseTableViewController.m
LifeLog/LifeLog/CreateGroupViewController.h
... | ... | @@ -0,0 +1,36 @@ |
1 | +// | |
2 | +// CreateGroupViewController.h | |
3 | +// LifeLog | |
4 | +// | |
5 | +// Created by nvtu on 8/19/17. | |
6 | +// Copyright © 2017 PhongNV. All rights reserved. | |
7 | +// | |
8 | + | |
9 | +#import <UIKit/UIKit.h> | |
10 | +#import "BaseViewController.h" | |
11 | +#import "AutoTransButton.h" | |
12 | +#import "Utilities.h" | |
13 | +#import "Entities.h" | |
14 | + | |
15 | +@interface CreateGroupViewController : BaseViewController<UITextFieldDelegate, UITextViewDelegate> | |
16 | + | |
17 | +@property (weak, nonatomic) IBOutlet UITextField *textName; | |
18 | +@property (weak, nonatomic) IBOutlet UITextField *textGoalWalk; | |
19 | +@property (weak, nonatomic) IBOutlet UITextField *textGoalRun; | |
20 | +@property (weak, nonatomic) IBOutlet UITextField *textGoalBike; | |
21 | + | |
22 | +@property (weak, nonatomic) IBOutlet UITextView *textGoal; | |
23 | + | |
24 | +@property (weak, nonatomic) IBOutlet UISwitch *switchWalk; | |
25 | +@property (weak, nonatomic) IBOutlet UISwitch *switchBike; | |
26 | +@property (weak, nonatomic) IBOutlet UISwitch *switchRun; | |
27 | +@property (weak, nonatomic) IBOutlet UISwitch *switchStep; | |
28 | +@property (weak, nonatomic) IBOutlet UISwitch *switchGym; | |
29 | +@property (weak, nonatomic) IBOutlet UISwitch *switchBegin; | |
30 | + | |
31 | +@property (copy) void (^createGroupSuccess)(GroupObject * group); | |
32 | + | |
33 | +- (IBAction)clickBack:(UIButton *)sender; | |
34 | +- (IBAction)clickCreateGroup:(AutoTransButton *)sender; | |
35 | + | |
36 | +@end |
LifeLog/LifeLog/CreateGroupViewController.m
... | ... | @@ -0,0 +1,116 @@ |
1 | +// | |
2 | +// CreateGroupViewController.m | |
3 | +// LifeLog | |
4 | +// | |
5 | +// Created by nvtu on 8/19/17. | |
6 | +// Copyright © 2017 PhongNV. All rights reserved. | |
7 | +// | |
8 | + | |
9 | +#import "CreateGroupViewController.h" | |
10 | +#import "ServerAPI.h" | |
11 | + | |
12 | +@interface CreateGroupViewController () | |
13 | + | |
14 | +@end | |
15 | + | |
16 | +@implementation CreateGroupViewController | |
17 | + | |
18 | +- (void)viewDidLoad { | |
19 | + [super viewDidLoad]; | |
20 | + // Do any additional setup after loading the view from its nib. | |
21 | +} | |
22 | + | |
23 | +- (void)didReceiveMemoryWarning { | |
24 | + [super didReceiveMemoryWarning]; | |
25 | + // Dispose of any resources that can be recreated. | |
26 | +} | |
27 | + | |
28 | +#pragma mark IBAction | |
29 | + | |
30 | +- (IBAction)clickBack:(UIButton *)sender { | |
31 | + [self.navigationController popViewControllerAnimated:true]; | |
32 | +} | |
33 | + | |
34 | +- (IBAction)clickCreateGroup:(AutoTransButton *)sender { | |
35 | + NSString *name = self.textName.text; | |
36 | + NSString *goal = self.textGoal.text; | |
37 | + if(name.length == 0) { | |
38 | + [Utilities showErrorMessage:@"Fill name of group!" withViewController:self]; | |
39 | + return; | |
40 | + } | |
41 | + else if(name.length >= 255) { | |
42 | + [Utilities showErrorMessage:@"Name of group is too long!" withViewController:self]; | |
43 | + return; | |
44 | + } | |
45 | + else if(goal.length == 0) { | |
46 | + [Utilities showErrorMessage:@"Fill information for goal of group" withViewController:self]; | |
47 | + return; | |
48 | + } | |
49 | + if(self.switchWalk.on && [self.textGoalWalk.text intValue] == 0) { | |
50 | + [Utilities showErrorMessage:@"Add goal for walk mode" withViewController:self]; | |
51 | + return; | |
52 | + } | |
53 | + if(self.switchBike.on && [self.textGoalBike.text intValue] == 0) { | |
54 | + [Utilities showErrorMessage:@"Add goal for bike mode" withViewController:self]; | |
55 | + return; | |
56 | + } | |
57 | + if(self.switchRun.on && [self.textGoalRun.text intValue] == 0) { | |
58 | + [Utilities showErrorMessage:@"Add goal for run mode" withViewController:self]; | |
59 | + return; | |
60 | + } | |
61 | + GroupObject *object = [[GroupObject alloc] init]; | |
62 | + object.name = name; | |
63 | + object.goal = goal; | |
64 | + object.walkMode = self.switchWalk.on; | |
65 | + object.runMode = self.switchRun.on; | |
66 | + object.bikeMode = self.switchBike.on; | |
67 | + object.stepMode = self.switchStep.on; | |
68 | + object.gymMode = self.switchGym.on; | |
69 | + object.beginMode = self.switchBegin.on; | |
70 | + object.walkGoal = [self.textGoalWalk.text intValue]; | |
71 | + object.bikeGoal = [self.textGoalBike.text intValue]; | |
72 | + object.runGoal = [self.textGoalRun.text intValue]; | |
73 | + | |
74 | + NSLog(@"%@", object.name); | |
75 | + NSLog(@"%@", object.goal); | |
76 | + NSLog(@"%d", object.walkGoal); | |
77 | + NSLog(@"%d", object.bikeGoal); | |
78 | + NSLog(@"%d", object.runGoal); | |
79 | + NSLog(@"%d", object.walkMode); | |
80 | + NSLog(@"%d", object.runMode); | |
81 | + NSLog(@"%d", object.bikeMode); | |
82 | + NSLog(@"%d", object.stepMode); | |
83 | + NSLog(@"%d", object.gymMode); | |
84 | + NSLog(@"%d", object.beginMode); | |
85 | + | |
86 | + NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; | |
87 | + MBProgressHUD *hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; | |
88 | + [[ServerAPI server] requestCreateGroup:token withGroup:object CompletionHandler:^(GroupObject * group, NSError * error) { | |
89 | + CreateGroupViewController __weak *weakSelf = self; | |
90 | + if(error == nil) { | |
91 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
92 | + if(weakSelf.createGroupSuccess != nil) { | |
93 | + [hudView hideAnimated:true]; | |
94 | + [weakSelf clickBack:nil]; | |
95 | + weakSelf.createGroupSuccess(object); | |
96 | + } | |
97 | + }); | |
98 | + } | |
99 | + else { | |
100 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
101 | + [hudView hideAnimated:true]; | |
102 | + NSString *message = [error.userInfo objectForKey:@"message"]; | |
103 | + [Utilities showErrorMessage:message withViewController:weakSelf]; | |
104 | + }); | |
105 | + } | |
106 | + }]; | |
107 | +} | |
108 | + | |
109 | +#pragma mark UITextView Delegate | |
110 | + | |
111 | +-(BOOL) textFieldShouldReturn:(UITextField *)textField { | |
112 | + [self.view endEditing:true]; | |
113 | + return true; | |
114 | +} | |
115 | + | |
116 | +@end |
LifeLog/LifeLog/CreateGroupViewController.xib
... | ... | @@ -0,0 +1,601 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
3 | + <device id="retina4_7" orientation="portrait"> | |
4 | + <adaptation id="fullscreen"/> | |
5 | + </device> | |
6 | + <dependencies> | |
7 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> | |
8 | + <capability name="Aspect ratio constraints" minToolsVersion="5.1"/> | |
9 | + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | |
10 | + </dependencies> | |
11 | + <objects> | |
12 | + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="CreateGroupViewController"> | |
13 | + <connections> | |
14 | + <outlet property="switchBegin" destination="e63-8i-6aa" id="bbT-m6-3CV"/> | |
15 | + <outlet property="switchBike" destination="fGW-Vw-PwQ" id="ncx-kP-qdd"/> | |
16 | + <outlet property="switchGym" destination="Yga-UQ-xoU" id="rIN-kO-wmO"/> | |
17 | + <outlet property="switchRun" destination="2gX-B2-tkR" id="yak-gV-Cas"/> | |
18 | + <outlet property="switchStep" destination="RoR-w7-dNT" id="19b-K3-qAu"/> | |
19 | + <outlet property="switchWalk" destination="3xD-aH-JHl" id="OZ9-l7-Rww"/> | |
20 | + <outlet property="textGoal" destination="hWb-vU-yVd" id="dp0-yK-P60"/> | |
21 | + <outlet property="textGoalBike" destination="eOi-eo-GYn" id="qfW-ns-tsM"/> | |
22 | + <outlet property="textGoalRun" destination="3aE-uP-KLS" id="WAE-tl-O94"/> | |
23 | + <outlet property="textGoalWalk" destination="4JZ-J2-3D9" id="yHV-mB-rcn"/> | |
24 | + <outlet property="textName" destination="pXO-K0-vne" id="ePQ-35-RLr"/> | |
25 | + <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> | |
26 | + </connections> | |
27 | + </placeholder> | |
28 | + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | |
29 | + <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> | |
30 | + <rect key="frame" x="0.0" y="0.0" width="320" height="626"/> | |
31 | + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | |
32 | + <subviews> | |
33 | + <scrollView multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aKu-bd-xMP" customClass="TPKeyboardAvoidingScrollView"> | |
34 | + <rect key="frame" x="0.0" y="46" width="320" height="580"/> | |
35 | + <subviews> | |
36 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9w1-87-U1W"> | |
37 | + <rect key="frame" x="0.0" y="0.0" width="320" height="580"/> | |
38 | + <subviews> | |
39 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="名称" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZtU-mt-3Ov" customClass="AutoTransLabel"> | |
40 | + <rect key="frame" x="8" y="10" width="70" height="30"/> | |
41 | + <constraints> | |
42 | + <constraint firstAttribute="width" constant="70" id="Zvx-V3-7AW"/> | |
43 | + <constraint firstAttribute="height" constant="30" id="nok-hA-mW9"/> | |
44 | + </constraints> | |
45 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
46 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
47 | + <nil key="highlightedColor"/> | |
48 | + <userDefinedRuntimeAttributes> | |
49 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.name"/> | |
50 | + </userDefinedRuntimeAttributes> | |
51 | + </label> | |
52 | + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="pXO-K0-vne"> | |
53 | + <rect key="frame" x="88" y="10" width="222" height="30"/> | |
54 | + <constraints> | |
55 | + <constraint firstAttribute="height" constant="30" id="YJe-TW-hvA"/> | |
56 | + </constraints> | |
57 | + <nil key="textColor"/> | |
58 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
59 | + <textInputTraits key="textInputTraits"/> | |
60 | + <connections> | |
61 | + <outlet property="delegate" destination="-1" id="3NL-Ya-JuM"/> | |
62 | + </connections> | |
63 | + </textField> | |
64 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ONn-27-HqB"> | |
65 | + <rect key="frame" x="10" y="50" width="140" height="120"/> | |
66 | + <subviews> | |
67 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="S2z-DI-pIE"> | |
68 | + <rect key="frame" x="0.0" y="0.0" width="140" height="40"/> | |
69 | + <subviews> | |
70 | + <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3xD-aH-JHl"> | |
71 | + <rect key="frame" x="85" y="4" width="51" height="31"/> | |
72 | + <constraints> | |
73 | + <constraint firstAttribute="width" secondItem="3xD-aH-JHl" secondAttribute="height" multiplier="49:31" id="7LJ-H5-oQR"/> | |
74 | + </constraints> | |
75 | + <color key="onTintColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
76 | + </switch> | |
77 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="WALK" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yFv-kp-ag8" customClass="AutoTransLabel"> | |
78 | + <rect key="frame" x="6" y="10.5" width="47.5" height="20.5"/> | |
79 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
80 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
81 | + <nil key="highlightedColor"/> | |
82 | + <userDefinedRuntimeAttributes> | |
83 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.walk"/> | |
84 | + </userDefinedRuntimeAttributes> | |
85 | + </label> | |
86 | + </subviews> | |
87 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
88 | + <constraints> | |
89 | + <constraint firstAttribute="trailing" secondItem="3xD-aH-JHl" secondAttribute="trailing" constant="6" id="KNe-Rx-lun"/> | |
90 | + <constraint firstAttribute="height" constant="40" id="akz-T7-d2v"/> | |
91 | + <constraint firstItem="3xD-aH-JHl" firstAttribute="centerY" secondItem="S2z-DI-pIE" secondAttribute="centerY" id="oRy-OM-Om1"/> | |
92 | + <constraint firstItem="yFv-kp-ag8" firstAttribute="leading" secondItem="S2z-DI-pIE" secondAttribute="leading" constant="6" id="prt-UF-Ori"/> | |
93 | + <constraint firstItem="yFv-kp-ag8" firstAttribute="centerY" secondItem="S2z-DI-pIE" secondAttribute="centerY" id="xEl-Rl-8C1"/> | |
94 | + </constraints> | |
95 | + </view> | |
96 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dVh-y2-XTr"> | |
97 | + <rect key="frame" x="0.0" y="40" width="140" height="40"/> | |
98 | + <subviews> | |
99 | + <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2gX-B2-tkR"> | |
100 | + <rect key="frame" x="85" y="4" width="51" height="31"/> | |
101 | + <constraints> | |
102 | + <constraint firstAttribute="width" secondItem="2gX-B2-tkR" secondAttribute="height" multiplier="49:31" id="pBG-Mw-aNK"/> | |
103 | + </constraints> | |
104 | + <color key="onTintColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
105 | + </switch> | |
106 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="RUN" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="r9v-yX-mx8" customClass="AutoTransLabel"> | |
107 | + <rect key="frame" x="6" y="10.5" width="36" height="20.5"/> | |
108 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
109 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
110 | + <nil key="highlightedColor"/> | |
111 | + <userDefinedRuntimeAttributes> | |
112 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.run"/> | |
113 | + </userDefinedRuntimeAttributes> | |
114 | + </label> | |
115 | + </subviews> | |
116 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
117 | + <constraints> | |
118 | + <constraint firstItem="2gX-B2-tkR" firstAttribute="centerY" secondItem="dVh-y2-XTr" secondAttribute="centerY" id="bNR-wC-PQG"/> | |
119 | + <constraint firstItem="r9v-yX-mx8" firstAttribute="leading" secondItem="dVh-y2-XTr" secondAttribute="leading" constant="6" id="iHM-Q7-Z1Z"/> | |
120 | + <constraint firstAttribute="height" constant="40" id="s8W-Ak-VrH"/> | |
121 | + <constraint firstAttribute="trailing" secondItem="2gX-B2-tkR" secondAttribute="trailing" constant="6" id="usV-BG-oqp"/> | |
122 | + <constraint firstItem="r9v-yX-mx8" firstAttribute="centerY" secondItem="dVh-y2-XTr" secondAttribute="centerY" id="yZW-Wk-raQ"/> | |
123 | + </constraints> | |
124 | + </view> | |
125 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7PQ-zz-N0X"> | |
126 | + <rect key="frame" x="0.0" y="80" width="140" height="40"/> | |
127 | + <subviews> | |
128 | + <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Yga-UQ-xoU"> | |
129 | + <rect key="frame" x="85" y="4" width="51" height="31"/> | |
130 | + <constraints> | |
131 | + <constraint firstAttribute="width" secondItem="Yga-UQ-xoU" secondAttribute="height" multiplier="49:31" id="laB-Zs-gOj"/> | |
132 | + </constraints> | |
133 | + <color key="onTintColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
134 | + </switch> | |
135 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ジム" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EFD-Ys-PqS" customClass="AutoTransLabel"> | |
136 | + <rect key="frame" x="6" y="10.5" width="35" height="20.5"/> | |
137 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
138 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
139 | + <nil key="highlightedColor"/> | |
140 | + <userDefinedRuntimeAttributes> | |
141 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.gym"/> | |
142 | + </userDefinedRuntimeAttributes> | |
143 | + </label> | |
144 | + </subviews> | |
145 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
146 | + <constraints> | |
147 | + <constraint firstItem="EFD-Ys-PqS" firstAttribute="centerY" secondItem="7PQ-zz-N0X" secondAttribute="centerY" id="Ein-vC-mpy"/> | |
148 | + <constraint firstAttribute="height" constant="40" id="aKm-hG-Hyh"/> | |
149 | + <constraint firstAttribute="trailing" secondItem="Yga-UQ-xoU" secondAttribute="trailing" constant="6" id="cfd-4G-1NF"/> | |
150 | + <constraint firstItem="EFD-Ys-PqS" firstAttribute="leading" secondItem="7PQ-zz-N0X" secondAttribute="leading" constant="6" id="ojT-rz-8oC"/> | |
151 | + <constraint firstItem="Yga-UQ-xoU" firstAttribute="centerY" secondItem="7PQ-zz-N0X" secondAttribute="centerY" id="xYy-kb-5Sk"/> | |
152 | + </constraints> | |
153 | + </view> | |
154 | + </subviews> | |
155 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
156 | + <constraints> | |
157 | + <constraint firstItem="dVh-y2-XTr" firstAttribute="top" secondItem="S2z-DI-pIE" secondAttribute="bottom" id="2LH-28-ssn"/> | |
158 | + <constraint firstItem="7PQ-zz-N0X" firstAttribute="leading" secondItem="ONn-27-HqB" secondAttribute="leading" id="6md-Y8-lIk"/> | |
159 | + <constraint firstAttribute="height" constant="120" id="7Tb-oJ-5eC"/> | |
160 | + <constraint firstItem="7PQ-zz-N0X" firstAttribute="top" secondItem="dVh-y2-XTr" secondAttribute="bottom" id="Fsa-Ai-cKQ"/> | |
161 | + <constraint firstAttribute="trailing" secondItem="S2z-DI-pIE" secondAttribute="trailing" id="OV6-wK-IJj"/> | |
162 | + <constraint firstItem="dVh-y2-XTr" firstAttribute="leading" secondItem="ONn-27-HqB" secondAttribute="leading" id="TFE-bH-HwH"/> | |
163 | + <constraint firstAttribute="trailing" secondItem="dVh-y2-XTr" secondAttribute="trailing" id="Vul-EM-V8H"/> | |
164 | + <constraint firstItem="S2z-DI-pIE" firstAttribute="top" secondItem="ONn-27-HqB" secondAttribute="top" id="Yf4-Rz-E4g"/> | |
165 | + <constraint firstAttribute="trailing" secondItem="7PQ-zz-N0X" secondAttribute="trailing" id="hLr-NV-hyv"/> | |
166 | + <constraint firstItem="S2z-DI-pIE" firstAttribute="leading" secondItem="ONn-27-HqB" secondAttribute="leading" id="zMY-Vd-Ge9"/> | |
167 | + </constraints> | |
168 | + </view> | |
169 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Kpa-HJ-7cE"> | |
170 | + <rect key="frame" x="170" y="50" width="140" height="120"/> | |
171 | + <subviews> | |
172 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ALk-sL-SXG"> | |
173 | + <rect key="frame" x="0.0" y="0.0" width="140" height="40"/> | |
174 | + <subviews> | |
175 | + <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fGW-Vw-PwQ"> | |
176 | + <rect key="frame" x="85" y="4" width="51" height="31"/> | |
177 | + <constraints> | |
178 | + <constraint firstAttribute="width" secondItem="fGW-Vw-PwQ" secondAttribute="height" multiplier="49:31" id="qd5-Cg-6pG"/> | |
179 | + </constraints> | |
180 | + <color key="onTintColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
181 | + </switch> | |
182 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="BIKE" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WfE-YM-vVU" customClass="AutoTransLabel"> | |
183 | + <rect key="frame" x="6" y="10.5" width="36.5" height="20.5"/> | |
184 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
185 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
186 | + <nil key="highlightedColor"/> | |
187 | + <userDefinedRuntimeAttributes> | |
188 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.bike"/> | |
189 | + </userDefinedRuntimeAttributes> | |
190 | + </label> | |
191 | + </subviews> | |
192 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
193 | + <constraints> | |
194 | + <constraint firstItem="WfE-YM-vVU" firstAttribute="leading" secondItem="ALk-sL-SXG" secondAttribute="leading" constant="6" id="7xm-U8-L7U"/> | |
195 | + <constraint firstAttribute="height" constant="40" id="L4u-uj-rHa"/> | |
196 | + <constraint firstItem="fGW-Vw-PwQ" firstAttribute="centerY" secondItem="ALk-sL-SXG" secondAttribute="centerY" id="PBA-tv-gec"/> | |
197 | + <constraint firstAttribute="trailing" secondItem="fGW-Vw-PwQ" secondAttribute="trailing" constant="6" id="bHc-Ih-6ar"/> | |
198 | + <constraint firstItem="WfE-YM-vVU" firstAttribute="centerY" secondItem="ALk-sL-SXG" secondAttribute="centerY" id="te7-Im-Oqh"/> | |
199 | + </constraints> | |
200 | + </view> | |
201 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4Az-6N-8u4"> | |
202 | + <rect key="frame" x="0.0" y="40" width="140" height="40"/> | |
203 | + <subviews> | |
204 | + <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RoR-w7-dNT"> | |
205 | + <rect key="frame" x="85" y="4" width="51" height="31"/> | |
206 | + <constraints> | |
207 | + <constraint firstAttribute="width" secondItem="RoR-w7-dNT" secondAttribute="height" multiplier="49:31" id="YUz-Eh-EmZ"/> | |
208 | + </constraints> | |
209 | + <color key="onTintColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
210 | + </switch> | |
211 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="STEP" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZyO-6K-2gA" customClass="AutoTransLabel"> | |
212 | + <rect key="frame" x="6" y="10.5" width="42" height="20.5"/> | |
213 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
214 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
215 | + <nil key="highlightedColor"/> | |
216 | + <userDefinedRuntimeAttributes> | |
217 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.step"/> | |
218 | + </userDefinedRuntimeAttributes> | |
219 | + </label> | |
220 | + </subviews> | |
221 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
222 | + <constraints> | |
223 | + <constraint firstAttribute="trailing" secondItem="RoR-w7-dNT" secondAttribute="trailing" constant="6" id="Cc4-W7-Qc8"/> | |
224 | + <constraint firstItem="ZyO-6K-2gA" firstAttribute="leading" secondItem="4Az-6N-8u4" secondAttribute="leading" constant="6" id="ER7-Bx-w9j"/> | |
225 | + <constraint firstAttribute="height" constant="40" id="Kcy-ij-IsH"/> | |
226 | + <constraint firstItem="RoR-w7-dNT" firstAttribute="centerY" secondItem="4Az-6N-8u4" secondAttribute="centerY" id="O1R-k3-iBZ"/> | |
227 | + <constraint firstItem="ZyO-6K-2gA" firstAttribute="centerY" secondItem="4Az-6N-8u4" secondAttribute="centerY" id="fWH-tG-gSV"/> | |
228 | + </constraints> | |
229 | + </view> | |
230 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ORZ-El-owx"> | |
231 | + <rect key="frame" x="0.0" y="80" width="140" height="40"/> | |
232 | + <subviews> | |
233 | + <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="e63-8i-6aa"> | |
234 | + <rect key="frame" x="85" y="4" width="51" height="31"/> | |
235 | + <constraints> | |
236 | + <constraint firstAttribute="width" secondItem="e63-8i-6aa" secondAttribute="height" multiplier="49:31" id="TTd-tM-PrG"/> | |
237 | + </constraints> | |
238 | + <color key="onTintColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
239 | + </switch> | |
240 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="初心者" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RfO-1U-s4W" customClass="AutoTransLabel"> | |
241 | + <rect key="frame" x="6" y="10.5" width="52" height="20.5"/> | |
242 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
243 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
244 | + <nil key="highlightedColor"/> | |
245 | + <userDefinedRuntimeAttributes> | |
246 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.begin"/> | |
247 | + </userDefinedRuntimeAttributes> | |
248 | + </label> | |
249 | + </subviews> | |
250 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
251 | + <constraints> | |
252 | + <constraint firstItem="RfO-1U-s4W" firstAttribute="leading" secondItem="ORZ-El-owx" secondAttribute="leading" constant="6" id="5Vq-B2-215"/> | |
253 | + <constraint firstAttribute="trailing" secondItem="e63-8i-6aa" secondAttribute="trailing" constant="6" id="NUX-0H-z8v"/> | |
254 | + <constraint firstAttribute="height" constant="40" id="PdI-3J-BTC"/> | |
255 | + <constraint firstItem="e63-8i-6aa" firstAttribute="centerY" secondItem="ORZ-El-owx" secondAttribute="centerY" id="Vxw-Vk-POY"/> | |
256 | + <constraint firstItem="RfO-1U-s4W" firstAttribute="centerY" secondItem="ORZ-El-owx" secondAttribute="centerY" id="tX1-Qb-pKG"/> | |
257 | + </constraints> | |
258 | + </view> | |
259 | + </subviews> | |
260 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
261 | + <constraints> | |
262 | + <constraint firstAttribute="height" constant="120" id="1Z3-Ap-Qv1"/> | |
263 | + <constraint firstAttribute="trailing" secondItem="ALk-sL-SXG" secondAttribute="trailing" id="2DO-V0-pH1"/> | |
264 | + <constraint firstItem="ORZ-El-owx" firstAttribute="top" secondItem="4Az-6N-8u4" secondAttribute="bottom" id="9ap-NH-2HO"/> | |
265 | + <constraint firstItem="ALk-sL-SXG" firstAttribute="top" secondItem="Kpa-HJ-7cE" secondAttribute="top" id="Lc0-Xq-rka"/> | |
266 | + <constraint firstItem="4Az-6N-8u4" firstAttribute="leading" secondItem="Kpa-HJ-7cE" secondAttribute="leading" id="PVG-jU-N5c"/> | |
267 | + <constraint firstAttribute="trailing" secondItem="ORZ-El-owx" secondAttribute="trailing" id="WYz-Kv-H08"/> | |
268 | + <constraint firstItem="ORZ-El-owx" firstAttribute="leading" secondItem="Kpa-HJ-7cE" secondAttribute="leading" id="a7E-Je-SkO"/> | |
269 | + <constraint firstAttribute="bottom" secondItem="ORZ-El-owx" secondAttribute="bottom" id="dr5-Tk-AAg"/> | |
270 | + <constraint firstAttribute="trailing" secondItem="4Az-6N-8u4" secondAttribute="trailing" id="wOX-wa-25X"/> | |
271 | + <constraint firstItem="4Az-6N-8u4" firstAttribute="top" secondItem="ALk-sL-SXG" secondAttribute="bottom" id="xgc-3W-TS2"/> | |
272 | + <constraint firstItem="ALk-sL-SXG" firstAttribute="leading" secondItem="Kpa-HJ-7cE" secondAttribute="leading" id="yrE-eZ-Vg4"/> | |
273 | + </constraints> | |
274 | + </view> | |
275 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="目標" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KTY-Ed-NJL" customClass="AutoTransLabel"> | |
276 | + <rect key="frame" x="10" y="178" width="70" height="30"/> | |
277 | + <constraints> | |
278 | + <constraint firstAttribute="width" constant="70" id="Zlu-jK-x6p"/> | |
279 | + <constraint firstAttribute="height" constant="30" id="tVk-5e-QAY"/> | |
280 | + </constraints> | |
281 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
282 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
283 | + <nil key="highlightedColor"/> | |
284 | + <userDefinedRuntimeAttributes> | |
285 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.goal"/> | |
286 | + </userDefinedRuntimeAttributes> | |
287 | + </label> | |
288 | + <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="hWb-vU-yVd"> | |
289 | + <rect key="frame" x="88" y="178" width="222" height="120"/> | |
290 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
291 | + <constraints> | |
292 | + <constraint firstAttribute="height" constant="120" id="iYo-mA-ZGR"/> | |
293 | + </constraints> | |
294 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
295 | + <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/> | |
296 | + <userDefinedRuntimeAttributes> | |
297 | + <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> | |
298 | + <integer key="value" value="10"/> | |
299 | + </userDefinedRuntimeAttribute> | |
300 | + </userDefinedRuntimeAttributes> | |
301 | + <connections> | |
302 | + <outlet property="delegate" destination="-1" id="fVh-oh-7St"/> | |
303 | + </connections> | |
304 | + </textView> | |
305 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="マップ" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qdi-Na-zsj" customClass="AutoTransLabel"> | |
306 | + <rect key="frame" x="10" y="313" width="70" height="30"/> | |
307 | + <constraints> | |
308 | + <constraint firstAttribute="height" constant="30" id="Ptf-0N-ewh"/> | |
309 | + <constraint firstAttribute="width" constant="70" id="mT3-FA-eev"/> | |
310 | + </constraints> | |
311 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
312 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
313 | + <nil key="highlightedColor"/> | |
314 | + <userDefinedRuntimeAttributes> | |
315 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.map"/> | |
316 | + </userDefinedRuntimeAttributes> | |
317 | + </label> | |
318 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1日目標" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qfU-7x-uss" customClass="AutoTransLabel"> | |
319 | + <rect key="frame" x="10" y="353" width="300" height="30"/> | |
320 | + <constraints> | |
321 | + <constraint firstAttribute="height" constant="30" id="9dB-8p-Wdv"/> | |
322 | + </constraints> | |
323 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
324 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
325 | + <nil key="highlightedColor"/> | |
326 | + <userDefinedRuntimeAttributes> | |
327 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.goal1day"/> | |
328 | + </userDefinedRuntimeAttributes> | |
329 | + </label> | |
330 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KEy-T1-mdK" customClass="AutoTransButton"> | |
331 | + <rect key="frame" x="88" y="313" width="110" height="30"/> | |
332 | + <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/> | |
333 | + <constraints> | |
334 | + <constraint firstAttribute="height" constant="30" id="MWc-Aj-2JZ"/> | |
335 | + <constraint firstAttribute="width" constant="110" id="V16-pC-FRv"/> | |
336 | + </constraints> | |
337 | + <state key="normal" title="マップ作成"> | |
338 | + <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
339 | + </state> | |
340 | + <userDefinedRuntimeAttributes> | |
341 | + <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> | |
342 | + <integer key="value" value="5"/> | |
343 | + </userDefinedRuntimeAttribute> | |
344 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.bt.map"/> | |
345 | + </userDefinedRuntimeAttributes> | |
346 | + </button> | |
347 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="WALK" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3QV-Ov-PmX" customClass="AutoTransLabel"> | |
348 | + <rect key="frame" x="10" y="391" width="70" height="30"/> | |
349 | + <constraints> | |
350 | + <constraint firstAttribute="height" constant="30" id="GSj-Tq-AsU"/> | |
351 | + <constraint firstAttribute="width" constant="70" id="uIv-Ty-eR2"/> | |
352 | + </constraints> | |
353 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
354 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
355 | + <nil key="highlightedColor"/> | |
356 | + <userDefinedRuntimeAttributes> | |
357 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.walk"/> | |
358 | + </userDefinedRuntimeAttributes> | |
359 | + </label> | |
360 | + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="4JZ-J2-3D9"> | |
361 | + <rect key="frame" x="95" y="391" width="130" height="30"/> | |
362 | + <constraints> | |
363 | + <constraint firstAttribute="height" constant="30" id="JaF-D4-zT2"/> | |
364 | + <constraint firstAttribute="width" constant="130" id="qCj-P5-l4y"/> | |
365 | + </constraints> | |
366 | + <nil key="textColor"/> | |
367 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
368 | + <textInputTraits key="textInputTraits" keyboardType="numberPad"/> | |
369 | + </textField> | |
370 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="m" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="o9b-Am-GTl"> | |
371 | + <rect key="frame" x="240" y="391" width="70" height="30"/> | |
372 | + <constraints> | |
373 | + <constraint firstAttribute="width" constant="70" id="MN1-fg-mf1"/> | |
374 | + <constraint firstAttribute="height" constant="30" id="l7E-J3-Syw"/> | |
375 | + </constraints> | |
376 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
377 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
378 | + <nil key="highlightedColor"/> | |
379 | + <userDefinedRuntimeAttributes> | |
380 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.name"/> | |
381 | + </userDefinedRuntimeAttributes> | |
382 | + </label> | |
383 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="RUN" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bq4-nh-Cxk" customClass="AutoTransLabel"> | |
384 | + <rect key="frame" x="10" y="429" width="70" height="30"/> | |
385 | + <constraints> | |
386 | + <constraint firstAttribute="height" constant="30" id="MmK-Nk-eFt"/> | |
387 | + <constraint firstAttribute="width" constant="70" id="nuP-fj-jk2"/> | |
388 | + </constraints> | |
389 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
390 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
391 | + <nil key="highlightedColor"/> | |
392 | + <userDefinedRuntimeAttributes> | |
393 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.run"/> | |
394 | + </userDefinedRuntimeAttributes> | |
395 | + </label> | |
396 | + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="3aE-uP-KLS"> | |
397 | + <rect key="frame" x="95" y="429" width="130" height="30"/> | |
398 | + <constraints> | |
399 | + <constraint firstAttribute="height" constant="30" id="37e-2c-qka"/> | |
400 | + <constraint firstAttribute="width" constant="130" id="owG-Ob-QnB"/> | |
401 | + </constraints> | |
402 | + <nil key="textColor"/> | |
403 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
404 | + <textInputTraits key="textInputTraits" keyboardType="numberPad"/> | |
405 | + </textField> | |
406 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="m" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CGA-Xm-2ll"> | |
407 | + <rect key="frame" x="240" y="429" width="70" height="30"/> | |
408 | + <constraints> | |
409 | + <constraint firstAttribute="width" constant="70" id="6cf-Y6-Dwq"/> | |
410 | + <constraint firstAttribute="height" constant="30" id="dHv-kM-AX2"/> | |
411 | + </constraints> | |
412 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
413 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
414 | + <nil key="highlightedColor"/> | |
415 | + <userDefinedRuntimeAttributes> | |
416 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.name"/> | |
417 | + </userDefinedRuntimeAttributes> | |
418 | + </label> | |
419 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="BIKE" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mvZ-9L-7a8" customClass="AutoTransLabel"> | |
420 | + <rect key="frame" x="10" y="467" width="70" height="30"/> | |
421 | + <constraints> | |
422 | + <constraint firstAttribute="height" constant="30" id="hX2-SJ-SMG"/> | |
423 | + <constraint firstAttribute="width" constant="70" id="roN-jL-tXp"/> | |
424 | + </constraints> | |
425 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
426 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
427 | + <nil key="highlightedColor"/> | |
428 | + <userDefinedRuntimeAttributes> | |
429 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.bike"/> | |
430 | + </userDefinedRuntimeAttributes> | |
431 | + </label> | |
432 | + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="eOi-eo-GYn"> | |
433 | + <rect key="frame" x="95" y="467" width="130" height="30"/> | |
434 | + <constraints> | |
435 | + <constraint firstAttribute="width" constant="130" id="SBb-jw-NHP"/> | |
436 | + <constraint firstAttribute="height" constant="30" id="ida-Ih-wRM"/> | |
437 | + </constraints> | |
438 | + <nil key="textColor"/> | |
439 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
440 | + <textInputTraits key="textInputTraits" keyboardType="numberPad"/> | |
441 | + </textField> | |
442 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="m" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="t6i-sV-ycx"> | |
443 | + <rect key="frame" x="240" y="467" width="70" height="30"/> | |
444 | + <constraints> | |
445 | + <constraint firstAttribute="width" constant="70" id="DoG-hb-QbI"/> | |
446 | + <constraint firstAttribute="height" constant="30" id="pAs-GK-YE3"/> | |
447 | + </constraints> | |
448 | + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> | |
449 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
450 | + <nil key="highlightedColor"/> | |
451 | + <userDefinedRuntimeAttributes> | |
452 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.lbl.name"/> | |
453 | + </userDefinedRuntimeAttributes> | |
454 | + </label> | |
455 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sef-8T-0hQ" customClass="AutoTransButton"> | |
456 | + <rect key="frame" x="10" y="509" width="300" height="30"/> | |
457 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
458 | + <constraints> | |
459 | + <constraint firstAttribute="height" constant="30" id="8XP-Y1-hlJ"/> | |
460 | + </constraints> | |
461 | + <state key="normal" title="グループを作成する"> | |
462 | + <color key="titleColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> | |
463 | + </state> | |
464 | + <userDefinedRuntimeAttributes> | |
465 | + <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> | |
466 | + <integer key="value" value="5"/> | |
467 | + </userDefinedRuntimeAttribute> | |
468 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.bt.createGr"/> | |
469 | + </userDefinedRuntimeAttributes> | |
470 | + <connections> | |
471 | + <action selector="clickCreateGroup:" destination="-1" eventType="touchUpInside" id="n8x-KR-til"/> | |
472 | + </connections> | |
473 | + </button> | |
474 | + </subviews> | |
475 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
476 | + <constraints> | |
477 | + <constraint firstItem="KTY-Ed-NJL" firstAttribute="leading" secondItem="9w1-87-U1W" secondAttribute="leading" constant="10" id="08M-tc-J6o"/> | |
478 | + <constraint firstItem="3QV-Ov-PmX" firstAttribute="leading" secondItem="qfU-7x-uss" secondAttribute="leading" id="1CN-mt-xv7"/> | |
479 | + <constraint firstItem="3aE-uP-KLS" firstAttribute="top" secondItem="bq4-nh-Cxk" secondAttribute="top" id="1YH-oa-gPy"/> | |
480 | + <constraint firstAttribute="trailing" secondItem="qfU-7x-uss" secondAttribute="trailing" constant="10" id="1fh-fC-Tvd"/> | |
481 | + <constraint firstItem="t6i-sV-ycx" firstAttribute="leading" secondItem="eOi-eo-GYn" secondAttribute="trailing" constant="15" id="2d5-8C-v4q"/> | |
482 | + <constraint firstItem="4JZ-J2-3D9" firstAttribute="top" secondItem="3QV-Ov-PmX" secondAttribute="top" id="2rO-Pd-t8O"/> | |
483 | + <constraint firstItem="t6i-sV-ycx" firstAttribute="top" secondItem="mvZ-9L-7a8" secondAttribute="top" id="4rc-co-XRr"/> | |
484 | + <constraint firstAttribute="trailing" secondItem="sef-8T-0hQ" secondAttribute="trailing" constant="10" id="89W-o8-uLa"/> | |
485 | + <constraint firstItem="qdi-Na-zsj" firstAttribute="leading" secondItem="9w1-87-U1W" secondAttribute="leading" constant="10" id="8Cr-Gt-ts7"/> | |
486 | + <constraint firstItem="ZtU-mt-3Ov" firstAttribute="leading" secondItem="9w1-87-U1W" secondAttribute="leading" constant="8" id="8QA-ZH-zig"/> | |
487 | + <constraint firstItem="KTY-Ed-NJL" firstAttribute="top" secondItem="ONn-27-HqB" secondAttribute="bottom" constant="8" id="8cI-hb-3IU"/> | |
488 | + <constraint firstItem="CGA-Xm-2ll" firstAttribute="leading" secondItem="3aE-uP-KLS" secondAttribute="trailing" constant="15" id="AJD-KP-oLm"/> | |
489 | + <constraint firstItem="qfU-7x-uss" firstAttribute="leading" secondItem="9w1-87-U1W" secondAttribute="leading" constant="10" id="Akh-2h-Y5Z"/> | |
490 | + <constraint firstItem="mvZ-9L-7a8" firstAttribute="leading" secondItem="qfU-7x-uss" secondAttribute="leading" id="CyJ-DC-cmk"/> | |
491 | + <constraint firstAttribute="trailing" secondItem="hWb-vU-yVd" secondAttribute="trailing" constant="10" id="Gpv-Cf-wmA"/> | |
492 | + <constraint firstItem="ONn-27-HqB" firstAttribute="leading" secondItem="9w1-87-U1W" secondAttribute="leading" constant="10" id="GqQ-jG-2Ss"/> | |
493 | + <constraint firstItem="Kpa-HJ-7cE" firstAttribute="top" secondItem="ONn-27-HqB" secondAttribute="top" id="I8B-QJ-8Kw"/> | |
494 | + <constraint firstItem="ONn-27-HqB" firstAttribute="top" secondItem="pXO-K0-vne" secondAttribute="bottom" constant="10" id="IUV-iX-zqx"/> | |
495 | + <constraint firstItem="pXO-K0-vne" firstAttribute="leading" secondItem="ZtU-mt-3Ov" secondAttribute="trailing" constant="10" id="JQi-T2-HRB"/> | |
496 | + <constraint firstItem="o9b-Am-GTl" firstAttribute="top" secondItem="3QV-Ov-PmX" secondAttribute="top" id="Osm-tS-nSE"/> | |
497 | + <constraint firstItem="sef-8T-0hQ" firstAttribute="top" secondItem="t6i-sV-ycx" secondAttribute="bottom" constant="12" id="PNY-xc-4go"/> | |
498 | + <constraint firstItem="3aE-uP-KLS" firstAttribute="leading" secondItem="bq4-nh-Cxk" secondAttribute="trailing" constant="15" id="QhW-Vx-RNc"/> | |
499 | + <constraint firstItem="mvZ-9L-7a8" firstAttribute="top" secondItem="bq4-nh-Cxk" secondAttribute="bottom" constant="8" id="Qu7-jT-zZM"/> | |
500 | + <constraint firstItem="qdi-Na-zsj" firstAttribute="top" secondItem="KTY-Ed-NJL" secondAttribute="bottom" constant="105" id="Rbx-GC-D0X"/> | |
501 | + <constraint firstItem="eOi-eo-GYn" firstAttribute="leading" secondItem="mvZ-9L-7a8" secondAttribute="trailing" constant="15" id="Rcg-h2-Qfa"/> | |
502 | + <constraint firstItem="pXO-K0-vne" firstAttribute="top" secondItem="ZtU-mt-3Ov" secondAttribute="top" id="T8M-OQ-0Wk"/> | |
503 | + <constraint firstItem="o9b-Am-GTl" firstAttribute="leading" secondItem="4JZ-J2-3D9" secondAttribute="trailing" constant="15" id="UyE-qx-Mtp"/> | |
504 | + <constraint firstItem="4JZ-J2-3D9" firstAttribute="top" secondItem="3QV-Ov-PmX" secondAttribute="top" id="aRK-i9-XKN"/> | |
505 | + <constraint firstItem="hWb-vU-yVd" firstAttribute="top" secondItem="Kpa-HJ-7cE" secondAttribute="bottom" constant="8" id="chw-2w-QOv"/> | |
506 | + <constraint firstItem="sef-8T-0hQ" firstAttribute="leading" secondItem="9w1-87-U1W" secondAttribute="leading" constant="10" id="dfN-4U-9Oc"/> | |
507 | + <constraint firstItem="eOi-eo-GYn" firstAttribute="top" secondItem="mvZ-9L-7a8" secondAttribute="top" id="e8C-p7-obk"/> | |
508 | + <constraint firstItem="bq4-nh-Cxk" firstAttribute="top" secondItem="3QV-Ov-PmX" secondAttribute="bottom" constant="8" id="gjA-dw-4j6"/> | |
509 | + <constraint firstItem="4JZ-J2-3D9" firstAttribute="leading" secondItem="3QV-Ov-PmX" secondAttribute="trailing" constant="15" id="hCs-KK-0oG"/> | |
510 | + <constraint firstItem="Kpa-HJ-7cE" firstAttribute="width" secondItem="ONn-27-HqB" secondAttribute="width" id="i0I-s6-95a"/> | |
511 | + <constraint firstAttribute="trailing" secondItem="pXO-K0-vne" secondAttribute="trailing" constant="10" id="j2H-Na-egE"/> | |
512 | + <constraint firstItem="bq4-nh-Cxk" firstAttribute="leading" secondItem="qfU-7x-uss" secondAttribute="leading" id="kTU-cF-wdS"/> | |
513 | + <constraint firstItem="hWb-vU-yVd" firstAttribute="leading" secondItem="KTY-Ed-NJL" secondAttribute="trailing" constant="8" id="ka5-tK-yxs"/> | |
514 | + <constraint firstItem="eOi-eo-GYn" firstAttribute="top" secondItem="mvZ-9L-7a8" secondAttribute="top" id="klA-2z-2Kx"/> | |
515 | + <constraint firstItem="3aE-uP-KLS" firstAttribute="top" secondItem="bq4-nh-Cxk" secondAttribute="top" id="pdY-Ef-eHr"/> | |
516 | + <constraint firstItem="3QV-Ov-PmX" firstAttribute="top" secondItem="qfU-7x-uss" secondAttribute="bottom" constant="8" id="qLb-a1-eOB"/> | |
517 | + <constraint firstItem="Kpa-HJ-7cE" firstAttribute="leading" secondItem="ONn-27-HqB" secondAttribute="trailing" constant="20" id="rMt-rx-zDY"/> | |
518 | + <constraint firstItem="KEy-T1-mdK" firstAttribute="top" secondItem="hWb-vU-yVd" secondAttribute="bottom" constant="15" id="sIJ-Rk-gj3"/> | |
519 | + <constraint firstItem="ZtU-mt-3Ov" firstAttribute="top" secondItem="9w1-87-U1W" secondAttribute="top" constant="10" id="tBp-C6-fjS"/> | |
520 | + <constraint firstItem="CGA-Xm-2ll" firstAttribute="top" secondItem="bq4-nh-Cxk" secondAttribute="top" id="uaB-yp-z16"/> | |
521 | + <constraint firstItem="qfU-7x-uss" firstAttribute="top" secondItem="KEy-T1-mdK" secondAttribute="bottom" constant="10" id="w4X-lJ-yL1"/> | |
522 | + <constraint firstAttribute="trailing" secondItem="Kpa-HJ-7cE" secondAttribute="trailing" constant="10" id="wvh-Lk-tt9"/> | |
523 | + <constraint firstItem="KEy-T1-mdK" firstAttribute="leading" secondItem="qdi-Na-zsj" secondAttribute="trailing" constant="8" id="xGa-CF-V9a"/> | |
524 | + </constraints> | |
525 | + </view> | |
526 | + </subviews> | |
527 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
528 | + <constraints> | |
529 | + <constraint firstItem="9w1-87-U1W" firstAttribute="leading" secondItem="aKu-bd-xMP" secondAttribute="leading" id="BLm-dD-oN3"/> | |
530 | + <constraint firstItem="9w1-87-U1W" firstAttribute="centerY" secondItem="aKu-bd-xMP" secondAttribute="centerY" id="DT9-CK-3ZL"/> | |
531 | + <constraint firstItem="9w1-87-U1W" firstAttribute="top" secondItem="aKu-bd-xMP" secondAttribute="top" id="PZC-BJ-DLV"/> | |
532 | + <constraint firstAttribute="trailing" secondItem="9w1-87-U1W" secondAttribute="trailing" id="RDM-mt-Fjr"/> | |
533 | + <constraint firstAttribute="bottom" secondItem="9w1-87-U1W" secondAttribute="bottom" constant="50" id="w42-vd-D7e"/> | |
534 | + <constraint firstItem="9w1-87-U1W" firstAttribute="centerX" secondItem="aKu-bd-xMP" secondAttribute="centerX" id="wJD-gn-ctq"/> | |
535 | + </constraints> | |
536 | + </scrollView> | |
537 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QYv-QM-Bkk" userLabel="ViewHeader"> | |
538 | + <rect key="frame" x="0.0" y="0.0" width="320" height="46"/> | |
539 | + <subviews> | |
540 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="コミュニティー グループ作成" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9hM-Gv-AxQ" customClass="AutoTransLabel"> | |
541 | + <rect key="frame" x="0.0" y="0.0" width="320" height="46"/> | |
542 | + <fontDescription key="fontDescription" type="system" pointSize="16"/> | |
543 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
544 | + <nil key="highlightedColor"/> | |
545 | + <userDefinedRuntimeAttributes> | |
546 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.title"/> | |
547 | + </userDefinedRuntimeAttributes> | |
548 | + </label> | |
549 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="O23-Hy-4Ld"> | |
550 | + <rect key="frame" x="0.0" y="5" width="70" height="36"/> | |
551 | + <constraints> | |
552 | + <constraint firstAttribute="width" constant="70" id="8vZ-Ta-Rzv"/> | |
553 | + </constraints> | |
554 | + <state key="normal" image="today_back_button"/> | |
555 | + <connections> | |
556 | + <action selector="clickBack:" destination="-1" eventType="touchUpInside" id="BO6-jx-vuO"/> | |
557 | + </connections> | |
558 | + </button> | |
559 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fPg-VP-VkU"> | |
560 | + <rect key="frame" x="275" y="0.0" width="45" height="46"/> | |
561 | + <constraints> | |
562 | + <constraint firstAttribute="width" constant="45" id="k1W-Oc-mRq"/> | |
563 | + </constraints> | |
564 | + <state key="normal" image="icon_menu"/> | |
565 | + </button> | |
566 | + </subviews> | |
567 | + <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
568 | + <constraints> | |
569 | + <constraint firstAttribute="trailing" secondItem="9hM-Gv-AxQ" secondAttribute="trailing" id="5f8-Xt-vKd"/> | |
570 | + <constraint firstAttribute="bottom" secondItem="9hM-Gv-AxQ" secondAttribute="bottom" id="Q3z-hF-VbV"/> | |
571 | + <constraint firstItem="9hM-Gv-AxQ" firstAttribute="top" secondItem="QYv-QM-Bkk" secondAttribute="top" id="XNi-3d-xFW"/> | |
572 | + <constraint firstItem="O23-Hy-4Ld" firstAttribute="leading" secondItem="QYv-QM-Bkk" secondAttribute="leading" id="aMc-uz-vGA"/> | |
573 | + <constraint firstItem="fPg-VP-VkU" firstAttribute="top" secondItem="QYv-QM-Bkk" secondAttribute="top" id="bLC-DU-cJf"/> | |
574 | + <constraint firstItem="9hM-Gv-AxQ" firstAttribute="leading" secondItem="QYv-QM-Bkk" secondAttribute="leading" id="cUY-dT-Rh0"/> | |
575 | + <constraint firstAttribute="trailing" secondItem="fPg-VP-VkU" secondAttribute="trailing" id="fn0-SY-e1Z"/> | |
576 | + <constraint firstAttribute="height" constant="46" id="lBP-32-aFw"/> | |
577 | + <constraint firstItem="O23-Hy-4Ld" firstAttribute="top" secondItem="QYv-QM-Bkk" secondAttribute="top" constant="5" id="ogR-c4-QQ3"/> | |
578 | + <constraint firstAttribute="bottom" secondItem="fPg-VP-VkU" secondAttribute="bottom" id="wdr-SH-Wm2"/> | |
579 | + <constraint firstAttribute="bottom" secondItem="O23-Hy-4Ld" secondAttribute="bottom" constant="5" id="yJ4-81-rJx"/> | |
580 | + </constraints> | |
581 | + </view> | |
582 | + </subviews> | |
583 | + <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> | |
584 | + <constraints> | |
585 | + <constraint firstItem="aKu-bd-xMP" firstAttribute="top" secondItem="QYv-QM-Bkk" secondAttribute="bottom" id="Q7l-Ra-0wb"/> | |
586 | + <constraint firstAttribute="trailing" secondItem="aKu-bd-xMP" secondAttribute="trailing" id="WAl-wE-FB4"/> | |
587 | + <constraint firstAttribute="trailing" secondItem="QYv-QM-Bkk" secondAttribute="trailing" id="XdX-OA-ALX"/> | |
588 | + <constraint firstItem="aKu-bd-xMP" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="cE7-y5-LL4"/> | |
589 | + <constraint firstItem="QYv-QM-Bkk" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="dAn-YE-2s3"/> | |
590 | + <constraint firstItem="QYv-QM-Bkk" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="fFF-bj-0uk"/> | |
591 | + <constraint firstAttribute="bottom" secondItem="aKu-bd-xMP" secondAttribute="bottom" id="oPE-ST-BIo"/> | |
592 | + </constraints> | |
593 | + <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> | |
594 | + <point key="canvasLocation" x="26" y="125"/> | |
595 | + </view> | |
596 | + </objects> | |
597 | + <resources> | |
598 | + <image name="icon_menu" width="30" height="30"/> | |
599 | + <image name="today_back_button" width="73" height="37"/> | |
600 | + </resources> | |
601 | +</document> |
LifeLog/LifeLog/Entities.h
LifeLog/LifeLog/GroupDetailViewController.h
... | ... | @@ -9,17 +9,24 @@ |
9 | 9 | #import <UIKit/UIKit.h> |
10 | 10 | #import "BaseTableViewController.h" |
11 | 11 | #import "Entities.h" |
12 | +#import "AutoTransButton.h" | |
12 | 13 | |
13 | 14 | @interface GroupDetailViewController : BaseTableViewController { |
14 | 15 | GroupObject * _curGroup; |
16 | + BOOL isMemberList; | |
15 | 17 | } |
16 | 18 | @property (weak, nonatomic) IBOutlet UIImageView *imgAva; |
17 | 19 | |
18 | 20 | @property (weak, nonatomic) IBOutlet UILabel *lblGrpName; |
19 | 21 | @property (weak, nonatomic) IBOutlet UILabel *lbbGrpActiveMode; |
20 | 22 | @property (weak, nonatomic) IBOutlet UILabel *lblGrpGoal; |
21 | - | |
22 | -- (IBAction)clickBack:(id)sender; | |
23 | +@property (weak, nonatomic) IBOutlet AutoTransButton *btJoinGrp; | |
24 | +@property (weak, nonatomic) IBOutlet AutoTransButton *btSwitch; | |
23 | 25 | |
24 | 26 | - (void) setGroup : (GroupObject *) object; |
27 | +- (void) requestGroupDetail; | |
28 | + | |
29 | +- (IBAction)clickBack:(id)sender; | |
30 | +- (IBAction)clickSwitch:(AutoTransButton *)sender; | |
31 | +- (IBAction)clickJoin:(AutoTransButton *)sender; | |
25 | 32 | @end |
LifeLog/LifeLog/GroupDetailViewController.m
... | ... | @@ -21,11 +21,12 @@ |
21 | 21 | |
22 | 22 | - (void)viewDidLoad { |
23 | 23 | [super viewDidLoad]; |
24 | - [self setupView]; | |
25 | - | |
24 | + isMemberList = false; | |
26 | 25 | //register nib for table view |
27 | 26 | [self.tableBase registerNib:[UINib nibWithNibName:@"SNSRecentTopicTableViewCell" bundle:nil] forCellReuseIdentifier:@"RecentTopicCell"]; |
28 | - | |
27 | + if(_curGroup != nil) { | |
28 | + [self requestGroupDetail]; | |
29 | + } | |
29 | 30 | // Do any additional setup after loading the view from its nib. |
30 | 31 | } |
31 | 32 | |
... | ... | @@ -40,33 +41,145 @@ |
40 | 41 | |
41 | 42 | - (void)setupView { |
42 | 43 | if(_curGroup != nil) { |
43 | - self.lblGrpName.text = _curGroup.name; | |
44 | - if(_curGroup.avatar && ![_curGroup.avatar isKindOfClass:[NSNull class]]) { | |
44 | + if(self.imgAva != nil && _curGroup.avatar && ![_curGroup.avatar isKindOfClass:[NSNull class]]) { | |
45 | 45 | [self.imgAva sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:_curGroup.avatar]]]; |
46 | 46 | } |
47 | - [self callRequestToUpdateData]; | |
47 | + if(self.lblGrpName != nil) { | |
48 | + [self.lblGrpName setText:_curGroup.name]; | |
49 | + } | |
50 | + if(self.btJoinGrp != nil) { | |
51 | + [self.btJoinGrp setHidden:false]; | |
52 | + } | |
53 | + NSString *mode = @""; | |
54 | + NSString *goalText = [NSString stringWithFormat:@"%@\n", _curGroup.goal]; | |
55 | + if(_curGroup.runMode || _curGroup.walkMode || _curGroup.bikeMode) { | |
56 | + goalText = [goalText stringByAppendingString:@"1日 目標 "]; | |
57 | + } | |
58 | + if(_curGroup.runMode) { | |
59 | + mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.running", nil)]; | |
60 | + mode = [mode stringByAppendingString:@"\n"]; | |
61 | + goalText = [goalText stringByAppendingFormat:@"RUN %dm, ", _curGroup.runGoal]; | |
62 | + } | |
63 | + if(_curGroup.walkMode) { | |
64 | + mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.walking", nil)]; | |
65 | + mode = [mode stringByAppendingString:@"\n"]; | |
66 | + goalText = [goalText stringByAppendingFormat:@"WALK %dm, ", _curGroup.walkGoal]; | |
67 | + } | |
68 | + if(_curGroup.bikeMode) { | |
69 | + mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.bike", nil)]; | |
70 | + mode = [mode stringByAppendingString:@"\n"]; | |
71 | + goalText = [goalText stringByAppendingFormat:@"BIKE %dm, ", _curGroup.bikeGoal]; | |
72 | + } | |
73 | + if(_curGroup.stepMode) { | |
74 | + mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.step", nil)]; | |
75 | + mode = [mode stringByAppendingString:@"\n"]; | |
76 | + } | |
77 | + if(_curGroup.beginMode) { | |
78 | + mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.begin", nil)]; | |
79 | + mode = [mode stringByAppendingString:@"\n"]; | |
80 | + } | |
81 | + if(_curGroup.gymMode) { | |
82 | + mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.gym", nil)]; | |
83 | + mode = [mode stringByAppendingString:@"\n"]; | |
84 | + } | |
85 | + NSRange range = [mode rangeOfString:@"\n" options:NSBackwardsSearch]; | |
86 | + if(range.length > 0) { | |
87 | + mode = [mode stringByReplacingOccurrencesOfString:@"\n" withString:@"" options:NSBackwardsSearch range:range]; | |
88 | + } | |
89 | + range = [goalText rangeOfString:@", " options:NSBackwardsSearch]; | |
90 | + if(range.length > 0) { | |
91 | + goalText = [goalText stringByReplacingOccurrencesOfString:@", " withString:@"" options:NSBackwardsSearch range:range]; | |
92 | + } | |
93 | + [self.lbbGrpActiveMode setText:mode]; | |
94 | + [self.lblGrpGoal setText:goalText]; | |
48 | 95 | } |
49 | 96 | } |
50 | 97 | |
98 | +- (void) requestGroupDetail { | |
99 | + NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; | |
100 | + MBProgressHUD *hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; | |
101 | + [[ServerAPI server] getGroupDetail:token withGroupID:_curGroup.groupID CompletionHandler:^(GroupObject *object, NSError *error) { | |
102 | + GroupDetailViewController __weak *weakSelf = self; | |
103 | + [_curGroup updateDate:object]; | |
104 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
105 | + [hudView hideAnimated:true]; | |
106 | + [weakSelf setupView]; | |
107 | + [weakSelf callRequestToUpdateData]; | |
108 | + }); | |
109 | + }]; | |
110 | +} | |
111 | + | |
51 | 112 | #pragma mark IBAction |
52 | 113 | |
53 | 114 | - (IBAction)clickBack:(id)sender { |
54 | 115 | [self.navigationController popViewControllerAnimated:true]; |
55 | 116 | } |
56 | 117 | |
118 | +- (IBAction)clickSwitch:(AutoTransButton *)sender { | |
119 | + isMemberList = !isMemberList; | |
120 | + if(isMemberList) { | |
121 | + [sender setTitle:NSLocalizedString(@"lifelog.grDetail.bt.viewTweet", nil) forState:UIControlStateNormal]; | |
122 | + } | |
123 | + else { | |
124 | + [sender setTitle:NSLocalizedString(@"lifelog.grDetail.bt.viewMem", nil) forState:UIControlStateNormal]; | |
125 | + } | |
126 | + [sender setUserInteractionEnabled:false]; | |
127 | + [self resetData]; | |
128 | +} | |
129 | + | |
130 | +- (IBAction)clickJoin:(AutoTransButton *)sender { | |
131 | + NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; | |
132 | + MBProgressHUD *hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; | |
133 | + [[ServerAPI server] requestJoinGroup:token groupID:_curGroup.groupID CompletionHandler:^(NSError *error){ | |
134 | + GroupDetailViewController __weak *weakSelf = self; | |
135 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
136 | + [hudView hideAnimated:true]; | |
137 | + if(error == nil) { | |
138 | + _curGroup.isJoin = true; | |
139 | + [weakSelf.btJoinGrp setHidden:_curGroup.isJoin]; | |
140 | + [Utilities showMessage:@"Join successfully" withViewController:weakSelf]; | |
141 | + } | |
142 | + }); | |
143 | + }]; | |
144 | + | |
145 | +} | |
146 | + | |
147 | + | |
148 | + | |
57 | 149 | #pragma mark UITableView Delegate |
58 | 150 | - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
59 | 151 | SNSRecentTopicTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"RecentTopicCell"]; |
60 | - TweetObject *object = [_curDataList objectAtIndex:indexPath.row]; | |
61 | - if(object.avatarLink && ![object.avatarLink isKindOfClass:[NSNull class]]) { | |
62 | - [cell.imgAvatar sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:object.avatarLink]]]; | |
152 | + if(isMemberList) { | |
153 | + MemberObject *object = [_curDataList objectAtIndex:indexPath.row]; | |
154 | + if(object.avatar && ![object.avatar isKindOfClass:[NSNull class]]) { | |
155 | + [cell.imgAvatar sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:object.avatar]]]; | |
156 | + } | |
157 | + else { | |
158 | + [cell.imgAvatar setImage:[UIImage imageNamed:@"avatar_default"]]; | |
159 | + } | |
160 | + cell.lblUsername.text = @""; | |
161 | + cell.lblDateTime.text = @""; | |
162 | + cell.lblDes.text = object.userName; | |
163 | + cell.lblMode.text = @""; | |
164 | + cell.lblDistance.text = @""; | |
165 | + cell.lblDuration.text = @""; | |
166 | + } | |
167 | + else { | |
168 | + TweetObject *object = [_curDataList objectAtIndex:indexPath.row]; | |
169 | + if(object.avatar && ![object.avatar isKindOfClass:[NSNull class]]) { | |
170 | + [cell.imgAvatar sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:object.avatar]]]; | |
171 | + } | |
172 | + else { | |
173 | + [cell.imgAvatar setImage:[UIImage imageNamed:@"avatar_default"]]; | |
174 | + } | |
175 | + cell.lblDateTime.text = [Utilities stringFromDate:object.createDate withFormat:@"YYYY/MM/dd hh:mm" locale:@""]; | |
176 | + cell.lblUsername.text = object.userName; | |
177 | + cell.lblDes.text = object.content; | |
178 | + cell.lblMode.text = object.mode; | |
179 | + cell.lblDistance.text = [NSString stringWithFormat:@"%.0f m", object.distance]; | |
180 | + cell.lblDuration.text = object.time; | |
63 | 181 | } |
64 | - cell.lblDateTime.text = [Utilities stringFromDate:object.createDate withFormat:@"YYYY/MM/dd hh:mm"]; | |
65 | - cell.lblUsername.text = object.userName; | |
66 | - cell.lblDes.text = object.content; | |
67 | - cell.lblMode.text = object.mode; | |
68 | - cell.lblDistance.text = [NSString stringWithFormat:@"%.0f m", object.distance]; | |
69 | - cell.lblDuration.text = object.time; | |
182 | + | |
70 | 183 | return cell; |
71 | 184 | } |
72 | 185 | |
... | ... | @@ -80,15 +193,30 @@ |
80 | 193 | if(_curPage == 1 && !self.refreshControl.isRefreshing) { |
81 | 194 | hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; |
82 | 195 | } |
83 | - [[ServerAPI server] requestTweetsList:token groupID:_curGroup.groupID withPage:_curPage CompletionHandler:^(NSArray *array, NSError *error){ | |
84 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
85 | - if(hudView != nil) { | |
86 | - [hudView hideAnimated:true]; | |
87 | - } | |
88 | - }); | |
89 | - GroupDetailViewController __weak *weakSelf = self; | |
90 | - [weakSelf updateTableData:array error:error]; | |
91 | - }]; | |
196 | + if(isMemberList) { | |
197 | + [[ServerAPI server] requestMemberList:token groupID:_curGroup.groupID withPage:_curPage CompletionHandler:^(NSArray *array, NSError *error){ | |
198 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
199 | + if(hudView != nil) { | |
200 | + [hudView hideAnimated:true]; | |
201 | + } | |
202 | + }); | |
203 | + GroupDetailViewController __weak *weakSelf = self; | |
204 | + [weakSelf updateTableData:array error:error]; | |
205 | + [weakSelf.btSwitch setUserInteractionEnabled:true]; | |
206 | + }]; | |
207 | + } | |
208 | + else { | |
209 | + [[ServerAPI server] requestTweetsList:token groupID:_curGroup.groupID withPage:_curPage CompletionHandler:^(NSArray *array, NSError *error){ | |
210 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
211 | + if(hudView != nil) { | |
212 | + [hudView hideAnimated:true]; | |
213 | + } | |
214 | + }); | |
215 | + GroupDetailViewController __weak *weakSelf = self; | |
216 | + [weakSelf updateTableData:array error:error]; | |
217 | + [weakSelf.btSwitch setUserInteractionEnabled:true]; | |
218 | + }]; | |
219 | + } | |
92 | 220 | } |
93 | 221 | |
94 | 222 | @end |
LifeLog/LifeLog/GroupDetailViewController.xib
... | ... | @@ -10,6 +10,8 @@ |
10 | 10 | <objects> |
11 | 11 | <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="GroupDetailViewController"> |
12 | 12 | <connections> |
13 | + <outlet property="btJoinGrp" destination="caN-x7-hJz" id="B17-YC-Rmk"/> | |
14 | + <outlet property="btSwitch" destination="gBg-k9-tgw" id="3ZZ-Qb-d3a"/> | |
13 | 15 | <outlet property="imgAva" destination="qYg-Gw-R2b" id="f9w-A2-u4G"/> |
14 | 16 | <outlet property="lbbGrpActiveMode" destination="O8z-6V-YFd" id="s8J-3i-pW3"/> |
15 | 17 | <outlet property="lblGrpGoal" destination="Bdy-dI-j47" id="AKx-8y-Ifm"/> |
... | ... | @@ -20,14 +22,14 @@ |
20 | 22 | </placeholder> |
21 | 23 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
22 | 24 | <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> |
23 | - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | |
25 | + <rect key="frame" x="0.0" y="0.0" width="320" height="567"/> | |
24 | 26 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
25 | 27 | <subviews> |
26 | 28 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="25d-3H-0fr" userLabel="ViewHeader"> |
27 | - <rect key="frame" x="0.0" y="0.0" width="375" height="46"/> | |
29 | + <rect key="frame" x="0.0" y="0.0" width="320" height="46"/> | |
28 | 30 | <subviews> |
29 | 31 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SNS" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DxD-Cy-0wi" customClass="AutoTransLabel"> |
30 | - <rect key="frame" x="0.0" y="0.0" width="375" height="46"/> | |
32 | + <rect key="frame" x="0.0" y="0.0" width="320" height="46"/> | |
31 | 33 | <fontDescription key="fontDescription" type="system" pointSize="17"/> |
32 | 34 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
33 | 35 | <nil key="highlightedColor"/> |
... | ... | @@ -46,7 +48,7 @@ |
46 | 48 | </connections> |
47 | 49 | </button> |
48 | 50 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="y09-DG-Krp"> |
49 | - <rect key="frame" x="330" y="0.0" width="45" height="46"/> | |
51 | + <rect key="frame" x="275" y="0.0" width="45" height="46"/> | |
50 | 52 | <constraints> |
51 | 53 | <constraint firstAttribute="width" constant="45" id="hHa-aE-1zd"/> |
52 | 54 | </constraints> |
... | ... | @@ -68,46 +70,48 @@ |
68 | 70 | <constraint firstAttribute="height" constant="46" id="u2G-4s-RB5"/> |
69 | 71 | </constraints> |
70 | 72 | </view> |
71 | - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YWV-pS-TCo"> | |
72 | - <rect key="frame" x="15" y="54" width="345" height="21"/> | |
73 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YWV-pS-TCo"> | |
74 | + <rect key="frame" x="15" y="54" width="290" height="21"/> | |
73 | 75 | <constraints> |
74 | 76 | <constraint firstAttribute="height" constant="21" id="fQO-ja-W9R"/> |
75 | 77 | </constraints> |
76 | - <fontDescription key="fontDescription" type="system" pointSize="17"/> | |
78 | + <fontDescription key="fontDescription" type="system" pointSize="15"/> | |
77 | 79 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
78 | 80 | <nil key="highlightedColor"/> |
79 | 81 | </label> |
80 | - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O8z-6V-YFd"> | |
81 | - <rect key="frame" x="15" y="85" width="243" height="60"/> | |
82 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O8z-6V-YFd"> | |
83 | + <rect key="frame" x="15" y="85" width="188" height="60"/> | |
84 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
82 | 85 | <constraints> |
83 | - <constraint firstAttribute="height" constant="60" id="Bid-NM-Ree"/> | |
86 | + <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="60" id="Bid-NM-Ree"/> | |
84 | 87 | </constraints> |
85 | - <fontDescription key="fontDescription" type="system" pointSize="17"/> | |
88 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
86 | 89 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
87 | 90 | <nil key="highlightedColor"/> |
88 | 91 | </label> |
89 | - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bdy-dI-j47"> | |
90 | - <rect key="frame" x="15" y="161" width="345" height="80"/> | |
92 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bdy-dI-j47"> | |
93 | + <rect key="frame" x="15" y="160" width="290" height="0.0"/> | |
91 | 94 | <constraints> |
92 | - <constraint firstAttribute="height" constant="80" id="jgH-57-Bae"/> | |
95 | + <constraint firstAttribute="height" relation="greaterThanOrEqual" id="jgH-57-Bae"/> | |
93 | 96 | </constraints> |
94 | - <fontDescription key="fontDescription" type="system" pointSize="17"/> | |
97 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
95 | 98 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
96 | 99 | <nil key="highlightedColor"/> |
97 | 100 | </label> |
98 | 101 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="qYg-Gw-R2b"> |
99 | - <rect key="frame" x="280" y="85" width="80" height="60"/> | |
102 | + <rect key="frame" x="225" y="85" width="80" height="60"/> | |
100 | 103 | <constraints> |
101 | 104 | <constraint firstAttribute="width" constant="80" id="NEk-vg-zus"/> |
102 | 105 | <constraint firstAttribute="height" constant="60" id="qlv-ht-SUw"/> |
103 | 106 | </constraints> |
104 | 107 | </imageView> |
105 | 108 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gBg-k9-tgw" customClass="AutoTransButton"> |
106 | - <rect key="frame" x="15" y="271" width="162" height="30"/> | |
109 | + <rect key="frame" x="15" y="190" width="134.5" height="30"/> | |
107 | 110 | <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
108 | 111 | <constraints> |
109 | 112 | <constraint firstAttribute="height" constant="30" id="6Ir-ZZ-NOb"/> |
110 | 113 | </constraints> |
114 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
111 | 115 | <state key="normal" title="メンバーを見る"> |
112 | 116 | <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
113 | 117 | </state> |
... | ... | @@ -117,13 +121,17 @@ |
117 | 121 | </userDefinedRuntimeAttribute> |
118 | 122 | <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.grDetail.bt.viewMem"/> |
119 | 123 | </userDefinedRuntimeAttributes> |
124 | + <connections> | |
125 | + <action selector="clickSwitch:" destination="-1" eventType="touchUpInside" id="z4V-ym-fqS"/> | |
126 | + </connections> | |
120 | 127 | </button> |
121 | - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="caN-x7-hJz" customClass="AutoTransButton"> | |
122 | - <rect key="frame" x="197" y="271" width="162" height="30"/> | |
128 | + <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="caN-x7-hJz" customClass="AutoTransButton"> | |
129 | + <rect key="frame" x="169.5" y="190" width="134.5" height="30"/> | |
123 | 130 | <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
124 | 131 | <constraints> |
125 | 132 | <constraint firstAttribute="height" constant="30" id="gIs-Km-dbx"/> |
126 | 133 | </constraints> |
134 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
127 | 135 | <state key="normal" title="グループに参加する"> |
128 | 136 | <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
129 | 137 | </state> |
... | ... | @@ -133,9 +141,12 @@ |
133 | 141 | </userDefinedRuntimeAttribute> |
134 | 142 | <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.grDetail.bt.joinGr"/> |
135 | 143 | </userDefinedRuntimeAttributes> |
144 | + <connections> | |
145 | + <action selector="clickJoin:" destination="-1" eventType="touchUpInside" id="Ukt-bi-Sw2"/> | |
146 | + </connections> | |
136 | 147 | </button> |
137 | 148 | <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" rowHeight="100" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="4VU-Ye-7Au"> |
138 | - <rect key="frame" x="0.0" y="311" width="375" height="306"/> | |
149 | + <rect key="frame" x="0.0" y="230" width="320" height="287"/> | |
139 | 150 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
140 | 151 | <connections> |
141 | 152 | <outlet property="dataSource" destination="-1" id="TLB-6X-bRI"/> |
... | ... | @@ -167,9 +178,10 @@ |
167 | 178 | <constraint firstItem="gBg-k9-tgw" firstAttribute="top" secondItem="Bdy-dI-j47" secondAttribute="bottom" constant="30" id="mgw-uX-VOK"/> |
168 | 179 | <constraint firstAttribute="trailing" secondItem="YWV-pS-TCo" secondAttribute="trailing" constant="15" id="rEO-bb-Pqr"/> |
169 | 180 | <constraint firstAttribute="trailing" secondItem="caN-x7-hJz" secondAttribute="trailing" constant="16" id="rRn-Vw-t5g"/> |
170 | - <constraint firstItem="Bdy-dI-j47" firstAttribute="top" secondItem="qYg-Gw-R2b" secondAttribute="bottom" constant="16" id="xXi-T2-c6K"/> | |
181 | + <constraint firstItem="Bdy-dI-j47" firstAttribute="top" secondItem="O8z-6V-YFd" secondAttribute="bottom" constant="15" id="xEO-fP-Riz"/> | |
171 | 182 | <constraint firstAttribute="trailing" secondItem="4VU-Ye-7Au" secondAttribute="trailing" id="ylN-vm-QF2"/> |
172 | 183 | </constraints> |
184 | + <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> | |
173 | 185 | <point key="canvasLocation" x="24.5" y="52.5"/> |
174 | 186 | </view> |
175 | 187 | </objects> |
LifeLog/LifeLog/GroupObject.h
... | ... | @@ -13,6 +13,14 @@ |
13 | 13 | @property (nonatomic) int groupID; |
14 | 14 | @property (nonatomic) int numSearch; |
15 | 15 | |
16 | +@property (nonatomic) int walkGoal; | |
17 | +@property (nonatomic) int runGoal; | |
18 | +@property (nonatomic) int bikeGoal; | |
19 | +@property (nonatomic) int stepGoal; | |
20 | +@property (nonatomic) int gymGoal; | |
21 | +@property (nonatomic) int beginGoal; | |
22 | + | |
23 | +@property (nonatomic) BOOL isJoin; | |
16 | 24 | @property (nonatomic) BOOL walkMode; |
17 | 25 | @property (nonatomic) BOOL runMode; |
18 | 26 | @property (nonatomic) BOOL bikeMode; |
... | ... | @@ -22,8 +30,12 @@ |
22 | 30 | |
23 | 31 | @property (nonatomic, strong) NSString * name; |
24 | 32 | @property (nonatomic, strong) NSString * avatar; |
33 | +@property (nonatomic, strong) NSString * goal; | |
34 | + | |
25 | 35 | @property (nonatomic, strong) NSDate * createDate; |
26 | 36 | |
37 | +-(id) initWithShortData : (NSDictionary *) dict; | |
27 | 38 | -(id) initWithData : (NSDictionary *) dict; |
28 | - | |
39 | +-(id) initWithData : (NSDictionary *) dict andGroupID : (int) groupID; | |
40 | +-(void) updateDate : (GroupObject *) obj; | |
29 | 41 | @end |
LifeLog/LifeLog/GroupObject.m
... | ... | @@ -11,23 +11,81 @@ |
11 | 11 | |
12 | 12 | @implementation GroupObject |
13 | 13 | |
14 | --(id) initWithData : (NSDictionary *) dict { | |
15 | - if([dict objectForKey:@"group_id"] != nil) { | |
16 | - self.groupID = [dict[@"group_id"] intValue]; | |
14 | +-(id) initWithShortData : (NSDictionary *) dict { | |
15 | + if([dict objectForKey:@"id"] != nil) { | |
16 | + self.groupID = [dict[@"id"] intValue]; | |
17 | 17 | } |
18 | 18 | if([dict objectForKey:@"group_name"] != nil) { |
19 | 19 | self.name = dict[@"group_name"]; |
20 | 20 | } |
21 | + return self; | |
22 | +} | |
23 | + | |
24 | +-(id) initWithData : (NSDictionary *) dict { | |
25 | + if([dict objectForKey:@"group_id"] != nil) { | |
26 | + self.groupID = [dict[@"group_id"] intValue]; | |
27 | + } | |
21 | 28 | if([dict objectForKey:@"group_avatar"] != nil) { |
22 | 29 | self.avatar = dict[@"group_avatar"]; |
23 | 30 | } |
31 | + if([dict objectForKey:@"created_at"] != nil && ![[dict objectForKey:@"created_at"] isKindOfClass:[NSNull class]]) { | |
32 | + NSString *dateString = dict[@"created_at"]; | |
33 | + self.createDate = [Utilities dateFromString:dateString withFormat:@"yyyy-MM-dd hh:mm:ss"]; | |
34 | + } | |
35 | + else { | |
36 | + self.createDate = [NSDate date]; | |
37 | + } | |
38 | + if([dict objectForKey:@"num_search"] != nil) { | |
39 | + self.numSearch = [dict[@"num_search"] intValue]; | |
40 | + } | |
41 | + [self parseData:dict]; | |
42 | + return self; | |
43 | +} | |
44 | + | |
45 | +-(id) initWithData : (NSDictionary *) dict andGroupID : (int) groupID { | |
46 | + self.groupID = groupID; | |
47 | + if([dict objectForKey:@"join_group"] != nil && ![[dict objectForKey:@"join_group"] isKindOfClass:[NSNull class]]) { | |
48 | + self.isJoin = [dict[@"join_group"] boolValue]; | |
49 | + } | |
50 | + if([dict objectForKey:@"goal"] != nil && ![[dict objectForKey:@"goal"] isKindOfClass:[NSNull class]]) { | |
51 | + self.goal = dict[@"goal"]; | |
52 | + } | |
53 | + else { | |
54 | + self.goal = @""; | |
55 | + } | |
56 | + if([dict objectForKey:@"walk_mode_goal"] != nil && ![[dict objectForKey:@"walk_mode_goal"] isKindOfClass:[NSNull class]]) { | |
57 | + self.walkGoal = [dict[@"walk_mode_goal"] intValue]; | |
58 | + } | |
59 | + if([dict objectForKey:@"run_mode_goal"] != nil && ![[dict objectForKey:@"run_mode_goal"] isKindOfClass:[NSNull class]]) { | |
60 | + self.runGoal = [dict[@"run_mode_goal"] intValue]; | |
61 | + } | |
62 | + if([dict objectForKey:@"bike_mode_goal"] != nil && ![[dict objectForKey:@"bike_mode_goal"] isKindOfClass:[NSNull class]]) { | |
63 | + self.bikeGoal = [dict[@"bike_mode_goal"] intValue]; | |
64 | + } | |
65 | + if([dict objectForKey:@"step_mode_goal"] != nil && ![[dict objectForKey:@"step_mode_goal"] isKindOfClass:[NSNull class]]) { | |
66 | + self.stepGoal = [dict[@"step_mode_goal"] intValue]; | |
67 | + } | |
68 | + if([dict objectForKey:@"gym_mode_goal"] != nil && ![[dict objectForKey:@"gym_mode_goal"] isKindOfClass:[NSNull class]]) { | |
69 | + self.gymGoal = [dict[@"gym_mode_goal"] intValue]; | |
70 | + } | |
71 | + if([dict objectForKey:@"beginer_mode_goal"] != nil && ![[dict objectForKey:@"beginer_mode_goal"] isKindOfClass:[NSNull class]]) { | |
72 | + self.beginGoal = [dict[@"beginer_mode_goal"] intValue]; | |
73 | + } | |
74 | + [self parseData:dict]; | |
75 | + return self; | |
76 | +} | |
77 | + | |
78 | +-(void) parseData : (NSDictionary *) dict { | |
79 | + if([dict objectForKey:@"group_name"] != nil) { | |
80 | + self.name = dict[@"group_name"]; | |
81 | + } | |
24 | 82 | if([dict objectForKey:@"walk_mode_active"] != nil && ![[dict objectForKey:@"walk_mode_active"] isKindOfClass:[NSNull class]]) { |
25 | 83 | self.walkMode = [dict[@"walk_mode_active"] boolValue]; |
26 | 84 | } |
27 | 85 | if([dict objectForKey:@"run_mode_active"] != nil && ![[dict objectForKey:@"run_mode_active"] isKindOfClass:[NSNull class]]) { |
28 | 86 | self.runMode = [dict[@"run_mode_active"] boolValue]; |
29 | 87 | } |
30 | - if([dict objectForKey:@"run_mode_active"] != nil && ![[dict objectForKey:@"run_mode_active"] isKindOfClass:[NSNull class]]) { | |
88 | + if([dict objectForKey:@"bike_mode_active"] != nil && ![[dict objectForKey:@"bike_mode_active"] isKindOfClass:[NSNull class]]) { | |
31 | 89 | self.bikeMode = [dict[@"bike_mode_active"] boolValue]; |
32 | 90 | } |
33 | 91 | if([dict objectForKey:@"step_mode_active"] != nil && ![[dict objectForKey:@"step_mode_active"] isKindOfClass:[NSNull class]]) { |
... | ... | @@ -39,17 +97,24 @@ |
39 | 97 | if([dict objectForKey:@"beginer_mode_active"] != nil && ![[dict objectForKey:@"beginer_mode_active"] isKindOfClass:[NSNull class]]) { |
40 | 98 | self.beginMode = [dict[@"beginer_mode_active"] boolValue]; |
41 | 99 | } |
42 | - if([dict objectForKey:@"created_at"] != nil) { | |
43 | - NSString *dateString = dict[@"created_at"]; | |
44 | - self.createDate = [Utilities dateFromString:dateString withFormat:@"yyyy-MM-dd hh:mm:ss"]; | |
45 | - } | |
46 | - else { | |
47 | - self.createDate = [NSDate date]; | |
48 | - } | |
49 | - if([dict objectForKey:@"num_search"] != nil) { | |
50 | - self.numSearch = [dict[@"num_search"] intValue]; | |
51 | - } | |
52 | - return self; | |
100 | +} | |
101 | + | |
102 | +-(void) updateDate : (GroupObject *) obj { | |
103 | + self.name = obj.name; | |
104 | + self.walkMode = obj.walkMode; | |
105 | + self.runMode = obj.runMode; | |
106 | + self.bikeMode = obj.bikeMode; | |
107 | + self.stepMode = obj.stepMode; | |
108 | + self.gymMode = obj.gymMode; | |
109 | + self.beginMode = obj.beginMode; | |
110 | + self.isJoin = obj.isJoin; | |
111 | + self.goal = obj.goal; | |
112 | + self.walkGoal = obj.walkGoal; | |
113 | + self.runGoal = obj.runGoal; | |
114 | + self.bikeGoal = obj.bikeGoal; | |
115 | + self.stepGoal = obj.stepGoal; | |
116 | + self.gymGoal = obj.gymGoal; | |
117 | + self.beginGoal = obj.beginGoal; | |
53 | 118 | } |
54 | 119 | |
55 | 120 | @end |
LifeLog/LifeLog/HistoryObject.h
LifeLog/LifeLog/HistoryObject.m
... | ... | @@ -11,17 +11,17 @@ |
11 | 11 | @implementation HistoryObject |
12 | 12 | |
13 | 13 | -(id) initWithData : (NSDictionary *) dict { |
14 | - if([dict objectForKey:@"step"] != nil) { | |
14 | + if([dict objectForKey:@"steps"] != nil) { | |
15 | 15 | self.step = [dict[@"step"] intValue]; |
16 | 16 | } |
17 | 17 | if([dict objectForKey:@"target"] != nil) { |
18 | 18 | self.target = [dict[@"target"] intValue]; |
19 | 19 | } |
20 | - if([dict objectForKey:@"missing"] != nil) { | |
21 | - self.missing = [dict[@"missing"] intValue]; | |
20 | + if([dict objectForKey:@"step_remain"] != nil) { | |
21 | + self.missing = [dict[@"step_remain"] intValue]; | |
22 | 22 | } |
23 | - if([dict objectForKey:@"percent"] != nil) { | |
24 | - self.percent = [dict[@"percent"] floatValue]; | |
23 | + if([dict objectForKey:@"complete_percent"] != nil) { | |
24 | + self.percent = [dict[@"complete_percent"] floatValue]; | |
25 | 25 | } |
26 | 26 | if([dict objectForKey:@"distance"] != nil) { |
27 | 27 | if([dict[@"distance"] isKindOfClass:[NSString class]]) { |
... | ... | @@ -52,6 +52,15 @@ |
52 | 52 | else { |
53 | 53 | self.date = [NSDate date]; |
54 | 54 | } |
55 | + if([dict objectForKey:@"data_chart"] != nil) { | |
56 | + self.dataGraph = [[NSMutableArray alloc] init]; | |
57 | + NSDictionary * graph = [dict objectForKey:@"data_chart"]; | |
58 | + if([graph count] == 24) { | |
59 | + for(int i = 0; i < 24; i++) { | |
60 | + [self.dataGraph addObject:[graph objectForKey:[NSString stringWithFormat:@"%d", i]]]; | |
61 | + } | |
62 | + } | |
63 | + } | |
55 | 64 | return self; |
56 | 65 | } |
57 | 66 | @end |
LifeLog/LifeLog/HistoryViewController.h
... | ... | @@ -15,10 +15,11 @@ |
15 | 15 | #import "Entities.h" |
16 | 16 | |
17 | 17 | @interface HistoryViewController : BaseTableViewController <UIScrollViewDelegate> { |
18 | - NSDate * _curDate; | |
19 | - HistoryObject * _curHisObj; | |
20 | - HistoryGraphObject * _curHisGraphObj; | |
18 | + NSDate * _startDate; | |
19 | + NSDate * _endDate; | |
20 | + NSArray * _curHisArray; | |
21 | 21 | } |
22 | +@property (weak, nonatomic) IBOutlet UILabel *lblDatetime; | |
22 | 23 | |
23 | 24 | @property (weak, nonatomic) IBOutlet UILabel *lblCircleStep; |
24 | 25 | @property (weak, nonatomic) IBOutlet UILabel *lblCircleRemain; |
... | ... | @@ -39,5 +40,7 @@ |
39 | 40 | @property (weak, nonatomic) IBOutlet UIScrollView *scrollView; |
40 | 41 | |
41 | 42 | - (IBAction)swipeAction:(UISwipeGestureRecognizer *)sender; |
43 | +- (IBAction)clickBackward:(UIButton *)sender; | |
44 | +- (IBAction)clickForward:(UIButton *)sender; | |
42 | 45 | |
43 | 46 | @end |
LifeLog/LifeLog/HistoryViewController.m
... | ... | @@ -26,7 +26,10 @@ |
26 | 26 | [self setupView]; |
27 | 27 | [self setupChartView]; |
28 | 28 | |
29 | - _curDate = [NSDate date]; | |
29 | + _startDate = [NSDate date]; | |
30 | + _endDate = _startDate; | |
31 | + | |
32 | + self.lblDatetime.text = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日 EEEE" locale:@"ja_JP"]; | |
30 | 33 | |
31 | 34 | [self checkRequestData]; |
32 | 35 | |
... | ... | @@ -54,7 +57,7 @@ |
54 | 57 | [self.viewCollectionType setSpacing:2]; |
55 | 58 | [self.viewCollectionType setArrayTitle:typeTitle]; |
56 | 59 | self.viewCollectionType.changeCurrentIndex = ^(int index){ |
57 | - [self checkRequestData]; | |
60 | + [self changeDate]; | |
58 | 61 | }; |
59 | 62 | |
60 | 63 | NSArray *modeTitle = [NSArray arrayWithObjects:NSLocalizedString(@"lifelog.history.mode.1", nil), NSLocalizedString(@"lifelog.history.mode.2", nil), NSLocalizedString(@"lifelog.history.mode.3", nil), nil]; |
... | ... | @@ -64,7 +67,7 @@ |
64 | 67 | [self.viewCollectionMode setNormalColor:[Utilities convertHecToColor:0x191919] highlightColor:[Utilities convertHecToColor:0x474747] textColor:[UIColor whiteColor]]; |
65 | 68 | [self.viewCollectionMode setArrayTitle:modeTitle]; |
66 | 69 | self.viewCollectionMode.changeCurrentIndex = ^(int index){ |
67 | - [self checkRequestData]; | |
70 | + [self updateView]; | |
68 | 71 | }; |
69 | 72 | |
70 | 73 | 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]; |
... | ... | @@ -102,19 +105,23 @@ |
102 | 105 | } |
103 | 106 | |
104 | 107 | -(void) updateView { |
105 | - self.lblStep.text = [NSString stringWithFormat:@"%d", _curHisObj.step]; | |
106 | - self.lblRemaining.text = [NSString stringWithFormat:@"%d", _curHisObj.missing]; | |
107 | - self.lblPercent.text = [NSString stringWithFormat:@"%0.2f", _curHisObj.percent * 100]; | |
108 | - self.lblCalories.text = [NSString stringWithFormat:@"%0.2f", _curHisObj.calories]; | |
109 | - self.lblDistance.text = [NSString stringWithFormat:@"%0.1f", _curHisObj.distance]; | |
110 | - self.lblTime.text = _curHisObj.time; | |
108 | + HistoryObject * obj = [_curHisArray objectAtIndex:self.viewCollectionMode.getCurrentIndex]; | |
109 | + self.lblStep.text = [NSString stringWithFormat:@"%d", obj.step]; | |
110 | + self.lblRemaining.text = [NSString stringWithFormat:@"%d", obj.missing]; | |
111 | + self.lblPercent.text = [NSString stringWithFormat:@"%0.2f", obj.percent * 100]; | |
112 | + self.lblCalories.text = [NSString stringWithFormat:@"%0.2f", obj.calories]; | |
113 | + self.lblDistance.text = [NSString stringWithFormat:@"%0.1f", obj.distance]; | |
114 | + self.lblTime.text = obj.time; | |
115 | + [self updateGraphView]; | |
111 | 116 | } |
112 | 117 | |
113 | 118 | -(void) updateGraphView { |
119 | + HistoryObject * obj = [_curHisArray objectAtIndex:self.viewCollectionMode.getCurrentIndex]; | |
120 | + | |
114 | 121 | NSMutableArray *yVals = [[NSMutableArray alloc] init]; |
115 | - for (int i = 0; i < _curHisGraphObj.arrayStep.count; i++) | |
122 | + for (int i = 0; i < obj.dataGraph.count; i++) | |
116 | 123 | { |
117 | - [yVals addObject:[[BarChartDataEntry alloc] initWithX:i y:[[_curHisGraphObj.arrayStep objectAtIndex:i] doubleValue]]]; | |
124 | + [yVals addObject:[[BarChartDataEntry alloc] initWithX:i y:[[obj.dataGraph objectAtIndex:i] doubleValue]]]; | |
118 | 125 | } |
119 | 126 | |
120 | 127 | BarChartDataSet *set1 = nil; |
... | ... | @@ -143,10 +150,8 @@ |
143 | 150 | -(void) checkRequestData { |
144 | 151 | if(self.tableBase.alpha == 0.0) { |
145 | 152 | NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; |
146 | - int type = self.viewCollectionType.getCurrentIndex; | |
147 | - int mode = self.viewCollectionMode.getCurrentIndex + 1; | |
148 | 153 | MBProgressHUD *hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; |
149 | - [[ServerAPI server] requestHistory:token atDate:_curDate withType:type andMode:mode CompletionHandler:^(HistoryObject *object, NSError *error) { | |
154 | + [[ServerAPI server] requestHistory:token startDate:_startDate endDate:_endDate CompletionHandler:^(NSArray *array, NSError *error) { | |
150 | 155 | HistoryViewController __weak *weakSelf = self; |
151 | 156 | dispatch_async(dispatch_get_main_queue(), ^{ |
152 | 157 | if(hudView != nil) { |
... | ... | @@ -154,7 +159,7 @@ |
154 | 159 | } |
155 | 160 | }); |
156 | 161 | if(error == nil) { |
157 | - _curHisObj = object; | |
162 | + _curHisArray = array; | |
158 | 163 | dispatch_async(dispatch_get_main_queue(), ^{ |
159 | 164 | [weakSelf updateView]; |
160 | 165 | }); |
... | ... | @@ -166,22 +171,6 @@ |
166 | 171 | }); |
167 | 172 | } |
168 | 173 | }]; |
169 | - | |
170 | - [[ServerAPI server] requestHistoryGraph:token withType:type andMode:mode CompletionHandler:^(HistoryGraphObject *object, NSError *error) { | |
171 | - HistoryViewController __weak *weakSelf = self; | |
172 | - if(error == nil) { | |
173 | - _curHisGraphObj = object; | |
174 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
175 | - [self updateGraphView]; | |
176 | - }); | |
177 | - } | |
178 | - else { | |
179 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
180 | - NSString *message = [error.userInfo objectForKey:@"message"]; | |
181 | - [Utilities showErrorMessage:message withViewController:weakSelf]; | |
182 | - }); | |
183 | - } | |
184 | - }]; | |
185 | 174 | } |
186 | 175 | else { |
187 | 176 | [self resetData]; |
... | ... | @@ -209,6 +198,27 @@ |
209 | 198 | }]; |
210 | 199 | } |
211 | 200 | |
201 | +- (void) changeDate { | |
202 | + switch (self.viewCollectionType.getCurrentIndex) { | |
203 | + case 1: | |
204 | + _startDate = [_endDate dateByAddingTimeInterval:-86400 * 7]; | |
205 | + break; | |
206 | + case 2: | |
207 | + _startDate = [_endDate dateByAddingTimeInterval:-86400 * 30]; | |
208 | + break; | |
209 | + case 3: | |
210 | + _startDate = [_endDate dateByAddingTimeInterval:-86400 * 30 * 3]; | |
211 | + break; | |
212 | + case 4: | |
213 | + _startDate = [_endDate dateByAddingTimeInterval:-86400 * 30 * 6]; | |
214 | + break; | |
215 | + default: | |
216 | + _startDate = _endDate; | |
217 | + break; | |
218 | + } | |
219 | + [self checkRequestData]; | |
220 | +} | |
221 | + | |
212 | 222 | #pragma mark IBAction |
213 | 223 | -(void) swipeAction:(UISwipeGestureRecognizer *)sender { |
214 | 224 | bool alphaValue = self.scrollView.alpha == 1.0 ? 1.0 : 0.0; |
... | ... | @@ -220,6 +230,18 @@ |
220 | 230 | }]; |
221 | 231 | } |
222 | 232 | |
233 | +- (IBAction)clickBackward:(UIButton *)sender { | |
234 | + _endDate = [_endDate dateByAddingTimeInterval:-86400]; | |
235 | + self.lblDatetime.text = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日 EEEE" locale:@"ja_JP"]; | |
236 | + [self changeDate]; | |
237 | +} | |
238 | + | |
239 | +- (IBAction)clickForward:(UIButton *)sender { | |
240 | + _endDate = [_endDate dateByAddingTimeInterval:86400]; | |
241 | + self.lblDatetime.text = [Utilities stringFromDate:_endDate withFormat:@"YYYY年MM月dd日 EEEE" locale:@"ja_JP"]; | |
242 | + [self changeDate]; | |
243 | +} | |
244 | + | |
223 | 245 | -(void)gestureAction:(UITapGestureRecognizer *) sender |
224 | 246 | { |
225 | 247 | CGPoint touchLocation = [sender locationOfTouch:0 inView:self.viewCollectionShare]; |
LifeLog/LifeLog/HistoryViewController.xib
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
3 | 3 | <device id="retina4_7" orientation="portrait"> |
4 | 4 | <adaptation id="fullscreen"/> |
5 | 5 | </device> |
6 | 6 | <dependencies> |
7 | - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> | |
7 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> | |
8 | 8 | <capability name="Aspect ratio constraints" minToolsVersion="5.1"/> |
9 | 9 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
10 | 10 | </dependencies> |
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | <outlet property="lblCalories" destination="dAE-C8-QLr" id="WaS-S3-Qxh"/> |
15 | 15 | <outlet property="lblCircleRemain" destination="Kr7-S0-Fpl" id="UQe-Bt-i0X"/> |
16 | 16 | <outlet property="lblCircleStep" destination="oWg-A8-aCr" id="Q9g-UY-hyv"/> |
17 | + <outlet property="lblDatetime" destination="EM7-vA-s1e" id="0fK-4u-TaK"/> | |
17 | 18 | <outlet property="lblDistance" destination="1tR-JC-pyw" id="q4s-Ru-vLO"/> |
18 | 19 | <outlet property="lblPercent" destination="8Ru-Jc-Ouv" id="ZHn-Kt-0Qk"/> |
19 | 20 | <outlet property="lblRemaining" destination="1NH-b3-ST8" id="hFc-q9-b0h"/> |
... | ... | @@ -45,7 +46,7 @@ |
45 | 46 | <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.history.title"/> |
46 | 47 | </userDefinedRuntimeAttributes> |
47 | 48 | </label> |
48 | - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ytc-zM-ZGC"> | |
49 | + <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ytc-zM-ZGC"> | |
49 | 50 | <rect key="frame" x="0.0" y="5" width="70" height="36"/> |
50 | 51 | <constraints> |
51 | 52 | <constraint firstAttribute="width" constant="70" id="xAE-oP-WEf"/> |
... | ... | @@ -84,11 +85,17 @@ |
84 | 85 | <constraint firstAttribute="width" secondItem="6T2-M9-9wV" secondAttribute="height" multiplier="1:1" id="RlM-6u-eer"/> |
85 | 86 | </constraints> |
86 | 87 | <state key="normal" backgroundImage="arrow_back"/> |
88 | + <connections> | |
89 | + <action selector="clickBackward:" destination="-1" eventType="touchUpInside" id="pwN-yT-qyp"/> | |
90 | + </connections> | |
87 | 91 | </button> |
88 | 92 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Cwb-8M-pDi"> |
89 | 93 | <rect key="frame" x="320" y="0.0" width="35" height="35"/> |
90 | 94 | <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
91 | 95 | <state key="normal" backgroundImage="arrow_next"/> |
96 | + <connections> | |
97 | + <action selector="clickForward:" destination="-1" eventType="touchUpInside" id="1NC-km-Lfe"/> | |
98 | + </connections> | |
92 | 99 | </button> |
93 | 100 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2017年1月1日 日曜日" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EM7-vA-s1e"> |
94 | 101 | <rect key="frame" x="40" y="2" width="275" height="31"/> |
LifeLog/LifeLog/Localizable.strings
No preview for this file type
LifeLog/LifeLog/MemberObject.h
... | ... | @@ -0,0 +1,25 @@ |
1 | +// | |
2 | +// MemberObject.h | |
3 | +// LifeLog | |
4 | +// | |
5 | +// Created by nvtu on 8/18/17. | |
6 | +// Copyright © 2017 PhongNV. All rights reserved. | |
7 | +// | |
8 | + | |
9 | +#import <Foundation/Foundation.h> | |
10 | + | |
11 | +@interface MemberObject : NSObject | |
12 | + | |
13 | +@property (nonatomic) int userID; | |
14 | +@property (nonatomic) int gender; | |
15 | + | |
16 | +@property (nonatomic, strong) NSString * userName; | |
17 | +@property (nonatomic, strong) NSString * nickName; | |
18 | +@property (nonatomic, strong) NSString * avatar; | |
19 | + | |
20 | +@property (nonatomic, strong) NSDate * joinDate; | |
21 | +@property (nonatomic, strong) NSDate * birthDay; | |
22 | + | |
23 | +-(id) initWithData : (NSDictionary *) dict; | |
24 | + | |
25 | +@end |
LifeLog/LifeLog/MemberObject.m
... | ... | @@ -0,0 +1,47 @@ |
1 | +// | |
2 | +// MemberObject.m | |
3 | +// LifeLog | |
4 | +// | |
5 | +// Created by nvtu on 8/18/17. | |
6 | +// Copyright © 2017 PhongNV. All rights reserved. | |
7 | +// | |
8 | + | |
9 | +#import "MemberObject.h" | |
10 | +#import "Utilities.h" | |
11 | + | |
12 | +@implementation MemberObject | |
13 | + | |
14 | +-(id) initWithData : (NSDictionary *) dict { | |
15 | + if([dict objectForKey:@"user_id"] != nil) { | |
16 | + self.userID = [dict[@"user_id"] intValue]; | |
17 | + } | |
18 | + if([dict objectForKey:@"gender"] != nil) { | |
19 | + self.gender = [dict[@"gender"] intValue]; | |
20 | + } | |
21 | + if([dict objectForKey:@"username"] != nil) { | |
22 | + self.userName = dict[@"username"]; | |
23 | + } | |
24 | + if([dict objectForKey:@"nickname"] != nil) { | |
25 | + self.nickName = dict[@"nickname"]; | |
26 | + } | |
27 | + if([dict objectForKey:@"profile_image"] != nil) { | |
28 | + self.avatar = dict[@"profile_image"]; | |
29 | + } | |
30 | + if([dict objectForKey:@"birthday"] != nil) { | |
31 | + NSString *dateString = dict[@"birthday"]; | |
32 | + self.birthDay = [Utilities dateFromString:dateString withFormat:@"yyyy-MM-dd"]; | |
33 | + } | |
34 | + else { | |
35 | + self.birthDay = [NSDate date]; | |
36 | + } | |
37 | + if([dict objectForKey:@"join_date"] != nil) { | |
38 | + NSString *dateString = dict[@"join_date"]; | |
39 | + self.joinDate = [Utilities dateFromString:dateString withFormat:@"yyyy-MM-dd HH:mm:ss"]; | |
40 | + } | |
41 | + else { | |
42 | + self.joinDate = [NSDate date]; | |
43 | + } | |
44 | + return self; | |
45 | +} | |
46 | + | |
47 | +@end |
LifeLog/LifeLog/MyGroupViewController.h
... | ... | @@ -0,0 +1,23 @@ |
1 | +// | |
2 | +// MyGroupViewController.h | |
3 | +// LifeLog | |
4 | +// | |
5 | +// Created by nvtu on 8/20/17. | |
6 | +// Copyright © 2017 PhongNV. All rights reserved. | |
7 | +// | |
8 | + | |
9 | +#import <UIKit/UIKit.h> | |
10 | +#import "GroupDetailViewController.h" | |
11 | +#import "AutoTransButton.h" | |
12 | +#import "Entities.h" | |
13 | + | |
14 | +@interface MyGroupViewController : GroupDetailViewController { | |
15 | + NSMutableArray *_curListGrp; | |
16 | +} | |
17 | + | |
18 | +@property (weak, nonatomic) IBOutlet UITableView *tableGrp; | |
19 | +@property (weak, nonatomic) IBOutlet UIButton *btShowGrp; | |
20 | + | |
21 | +- (IBAction)clickShowGrp:(id)sender; | |
22 | + | |
23 | +@end |
LifeLog/LifeLog/MyGroupViewController.m
... | ... | @@ -0,0 +1,170 @@ |
1 | +// | |
2 | +// MyGroupViewController.m | |
3 | +// LifeLog | |
4 | +// | |
5 | +// Created by nvtu on 8/20/17. | |
6 | +// Copyright © 2017 PhongNV. All rights reserved. | |
7 | +// | |
8 | + | |
9 | +#import "MyGroupViewController.h" | |
10 | +#import <SDWebImage/UIImageView+WebCache.h> | |
11 | + | |
12 | +#import "Utilities.h" | |
13 | +#import "ServerAPI.h" | |
14 | +#import "SNSRecentTopicTableViewCell.h" | |
15 | + | |
16 | +@interface MyGroupViewController () | |
17 | + | |
18 | +@end | |
19 | + | |
20 | +@implementation MyGroupViewController | |
21 | + | |
22 | +- (void)viewDidLoad { | |
23 | + [super viewDidLoad]; | |
24 | + isMemberList = false; | |
25 | + _curListGrp = [[NSMutableArray alloc] init]; | |
26 | + [self.tableBase registerNib:[UINib nibWithNibName:@"SNSRecentTopicTableViewCell" bundle:nil] forCellReuseIdentifier:@"RecentTopicCell"]; | |
27 | + | |
28 | + [self requestGroupList]; | |
29 | + // Do any additional setup after loading the view from its nib. | |
30 | +} | |
31 | + | |
32 | +- (void)didReceiveMemoryWarning { | |
33 | + [super didReceiveMemoryWarning]; | |
34 | + // Dispose of any resources that can be recreated. | |
35 | +} | |
36 | + | |
37 | +#pragma mark IBAction | |
38 | + | |
39 | +- (IBAction)clickBack:(id)sender { | |
40 | + [self.navigationController popViewControllerAnimated:true]; | |
41 | +} | |
42 | + | |
43 | +- (IBAction)clickShowGrp:(id)sender { | |
44 | + self.tableGrp.hidden = !self.tableGrp.isHidden; | |
45 | +} | |
46 | + | |
47 | +- (IBAction)clickSwitch:(id)sender { | |
48 | + isMemberList = !isMemberList; | |
49 | + if(isMemberList) { | |
50 | + [sender setTitle:NSLocalizedString(@"lifelog.grDetail.bt.viewTweet", nil) forState:UIControlStateNormal]; | |
51 | + } | |
52 | + else { | |
53 | + [sender setTitle:NSLocalizedString(@"lifelog.grDetail.bt.viewMem", nil) forState:UIControlStateNormal]; | |
54 | + } | |
55 | + [sender setUserInteractionEnabled:false]; | |
56 | + [self resetData]; | |
57 | +} | |
58 | + | |
59 | +#pragma mark UITableView Delegate | |
60 | +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { | |
61 | + if(tableView == self.tableGrp) | |
62 | + return 1; | |
63 | + else | |
64 | + return [super numberOfSectionsInTableView:tableView]; | |
65 | +} | |
66 | + | |
67 | +- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
68 | + if(tableView == self.tableGrp) | |
69 | + return _curListGrp.count; | |
70 | + else | |
71 | + return [super tableView:tableView numberOfRowsInSection:section]; | |
72 | +} | |
73 | + | |
74 | +- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
75 | + if(tableView == self.tableGrp) { | |
76 | + UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"GroupCell"]; | |
77 | + if(cell == nil) { | |
78 | + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"GroupCell"]; | |
79 | + } | |
80 | + GroupObject *object = [_curListGrp objectAtIndex:indexPath.row]; | |
81 | + cell.textLabel.text = object.name; | |
82 | + return cell; | |
83 | + } | |
84 | + else { | |
85 | + SNSRecentTopicTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"RecentTopicCell"]; | |
86 | + if(isMemberList) { | |
87 | + MemberObject *object = [_curDataList objectAtIndex:indexPath.row]; | |
88 | + if(object.avatar && ![object.avatar isKindOfClass:[NSNull class]]) { | |
89 | + [cell.imgAvatar sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:object.avatar]]]; | |
90 | + } | |
91 | + else { | |
92 | + [cell.imgAvatar setImage:[UIImage imageNamed:@"avatar_default"]]; | |
93 | + } | |
94 | + cell.lblUsername.text = @""; | |
95 | + cell.lblDateTime.text = @""; | |
96 | + cell.lblDes.text = object.userName; | |
97 | + cell.lblMode.text = @""; | |
98 | + cell.lblDistance.text = @""; | |
99 | + cell.lblDuration.text = @""; | |
100 | + } | |
101 | + else { | |
102 | + TweetObject *object = [_curDataList objectAtIndex:indexPath.row]; | |
103 | + if(object.avatar && ![object.avatar isKindOfClass:[NSNull class]]) { | |
104 | + [cell.imgAvatar sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:object.avatar]]]; | |
105 | + } | |
106 | + else { | |
107 | + [cell.imgAvatar setImage:[UIImage imageNamed:@"avatar_default"]]; | |
108 | + } | |
109 | + cell.lblDateTime.text = [Utilities stringFromDate:object.createDate withFormat:@"YYYY/MM/dd hh:mm" locale:@""]; | |
110 | + cell.lblUsername.text = object.userName; | |
111 | + cell.lblDes.text = object.content; | |
112 | + cell.lblMode.text = object.mode; | |
113 | + cell.lblDistance.text = [NSString stringWithFormat:@"%.0f m", object.distance]; | |
114 | + cell.lblDuration.text = object.time; | |
115 | + } | |
116 | + return cell; | |
117 | + } | |
118 | +} | |
119 | + | |
120 | +- (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { | |
121 | + if(tableView == self.tableGrp) { | |
122 | + return; | |
123 | + } | |
124 | + [super tableView:tableView willDisplayCell:cell forRowAtIndexPath:indexPath]; | |
125 | +} | |
126 | + | |
127 | +-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | |
128 | + if(tableView == self.tableGrp) { | |
129 | + [tableView setHidden:true]; | |
130 | + [self resetGroupData:indexPath.row]; | |
131 | + } | |
132 | +} | |
133 | + | |
134 | +#pragma mark Private Function | |
135 | + | |
136 | +- (void) resetGroupData : (int) index { | |
137 | + _curGroup = [_curListGrp objectAtIndex:index]; | |
138 | + self.lblGrpName.text = _curGroup.name; | |
139 | + [_curDataList removeAllObjects]; | |
140 | + [self.tableBase reloadData]; | |
141 | + [self requestGroupDetail]; | |
142 | +} | |
143 | + | |
144 | +- (void) requestGroupList { | |
145 | + NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; | |
146 | + MBProgressHUD *hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; | |
147 | + [[ServerAPI server] requestGroupList:token CompletionHandler:^(NSArray *array, NSError *error) { | |
148 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
149 | + [hudView hideAnimated:true]; | |
150 | + }); | |
151 | + if(error == nil) { | |
152 | + [_curListGrp removeAllObjects]; | |
153 | + [_curListGrp addObjectsFromArray:array]; | |
154 | + MyGroupViewController __weak *weakSelf = self; | |
155 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
156 | + [hudView hideAnimated:true]; | |
157 | + [self.tableGrp reloadData]; | |
158 | + if(_curListGrp.count > 0) { | |
159 | + [weakSelf resetGroupData:0]; | |
160 | + } | |
161 | + else { | |
162 | + weakSelf.lblGrpName.text = @"No Group"; | |
163 | + } | |
164 | + [weakSelf.btShowGrp setEnabled:(_curListGrp.count > 0)]; | |
165 | + }); | |
166 | + } | |
167 | + }]; | |
168 | +} | |
169 | + | |
170 | +@end |
LifeLog/LifeLog/MyGroupViewController.xib
... | ... | @@ -0,0 +1,241 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
3 | + <device id="retina4_7" orientation="portrait"> | |
4 | + <adaptation id="fullscreen"/> | |
5 | + </device> | |
6 | + <dependencies> | |
7 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> | |
8 | + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | |
9 | + </dependencies> | |
10 | + <objects> | |
11 | + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MyGroupViewController"> | |
12 | + <connections> | |
13 | + <outlet property="btShowGrp" destination="MvK-5R-njL" id="bcb-N7-jbu"/> | |
14 | + <outlet property="btSwitch" destination="eBu-7L-nsx" id="od6-v0-6eh"/> | |
15 | + <outlet property="lbbGrpActiveMode" destination="P1r-ft-imP" id="gw7-xu-kL1"/> | |
16 | + <outlet property="lblGrpGoal" destination="ftA-wa-19F" id="YFk-py-xd2"/> | |
17 | + <outlet property="lblGrpName" destination="xXv-SO-m4h" id="qik-wo-Usx"/> | |
18 | + <outlet property="tableBase" destination="ubS-v9-zCa" id="gea-9H-gpI"/> | |
19 | + <outlet property="tableGrp" destination="dtD-J5-dze" id="ahq-Cd-85X"/> | |
20 | + <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> | |
21 | + </connections> | |
22 | + </placeholder> | |
23 | + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | |
24 | + <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> | |
25 | + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | |
26 | + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | |
27 | + <subviews> | |
28 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vxT-xe-7mV" userLabel="ViewHeader"> | |
29 | + <rect key="frame" x="0.0" y="0.0" width="375" height="46"/> | |
30 | + <subviews> | |
31 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SNS" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Txe-1I-61m" customClass="AutoTransLabel"> | |
32 | + <rect key="frame" x="0.0" y="0.0" width="375" height="46"/> | |
33 | + <fontDescription key="fontDescription" type="system" pointSize="17"/> | |
34 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
35 | + <nil key="highlightedColor"/> | |
36 | + <userDefinedRuntimeAttributes> | |
37 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.grDetail.title"/> | |
38 | + </userDefinedRuntimeAttributes> | |
39 | + </label> | |
40 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DjI-qB-WTG"> | |
41 | + <rect key="frame" x="0.0" y="5" width="70" height="36"/> | |
42 | + <constraints> | |
43 | + <constraint firstAttribute="width" constant="70" id="Q1G-tI-sgx"/> | |
44 | + </constraints> | |
45 | + <state key="normal" image="today_back_button"/> | |
46 | + <connections> | |
47 | + <action selector="clickBack:" destination="-1" eventType="touchUpInside" id="93y-uZ-J2W"/> | |
48 | + </connections> | |
49 | + </button> | |
50 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7gh-nf-sKZ"> | |
51 | + <rect key="frame" x="330" y="0.0" width="45" height="46"/> | |
52 | + <constraints> | |
53 | + <constraint firstAttribute="width" constant="45" id="Vw3-60-kvV"/> | |
54 | + </constraints> | |
55 | + <state key="normal" image="icon_menu"/> | |
56 | + </button> | |
57 | + </subviews> | |
58 | + <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
59 | + <constraints> | |
60 | + <constraint firstAttribute="trailing" secondItem="7gh-nf-sKZ" secondAttribute="trailing" id="2JD-YU-WS2"/> | |
61 | + <constraint firstItem="Txe-1I-61m" firstAttribute="leading" secondItem="vxT-xe-7mV" secondAttribute="leading" id="30c-J3-6ba"/> | |
62 | + <constraint firstAttribute="bottom" secondItem="7gh-nf-sKZ" secondAttribute="bottom" id="61g-Gv-ka0"/> | |
63 | + <constraint firstAttribute="bottom" secondItem="Txe-1I-61m" secondAttribute="bottom" id="BZZ-wj-MGj"/> | |
64 | + <constraint firstItem="7gh-nf-sKZ" firstAttribute="top" secondItem="vxT-xe-7mV" secondAttribute="top" id="DKT-Ea-U3k"/> | |
65 | + <constraint firstAttribute="trailing" secondItem="Txe-1I-61m" secondAttribute="trailing" id="WA1-1W-49C"/> | |
66 | + <constraint firstItem="DjI-qB-WTG" firstAttribute="leading" secondItem="vxT-xe-7mV" secondAttribute="leading" id="tA3-JF-Kjj"/> | |
67 | + <constraint firstAttribute="bottom" secondItem="DjI-qB-WTG" secondAttribute="bottom" constant="5" id="uFc-I1-M2c"/> | |
68 | + <constraint firstItem="Txe-1I-61m" firstAttribute="top" secondItem="vxT-xe-7mV" secondAttribute="top" id="ucO-rK-wAV"/> | |
69 | + <constraint firstItem="DjI-qB-WTG" firstAttribute="top" secondItem="vxT-xe-7mV" secondAttribute="top" constant="5" id="vR3-xv-3hD"/> | |
70 | + <constraint firstAttribute="height" constant="46" id="yIJ-Mu-bPA"/> | |
71 | + </constraints> | |
72 | + </view> | |
73 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hhh-nO-yn5"> | |
74 | + <rect key="frame" x="15" y="54" width="345" height="36"/> | |
75 | + <subviews> | |
76 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MvK-5R-njL"> | |
77 | + <rect key="frame" x="289" y="0.0" width="56" height="36"/> | |
78 | + <constraints> | |
79 | + <constraint firstAttribute="width" constant="56" id="l8Q-On-RNy"/> | |
80 | + </constraints> | |
81 | + <state key="normal" backgroundImage="arrow_down"/> | |
82 | + <connections> | |
83 | + <action selector="clickShowGrp:" destination="-1" eventType="touchUpInside" id="yfd-Yu-fTF"/> | |
84 | + </connections> | |
85 | + </button> | |
86 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="No group" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xXv-SO-m4h"> | |
87 | + <rect key="frame" x="5" y="0.0" width="284" height="36"/> | |
88 | + <fontDescription key="fontDescription" type="system" pointSize="15"/> | |
89 | + <nil key="textColor"/> | |
90 | + <nil key="highlightedColor"/> | |
91 | + </label> | |
92 | + </subviews> | |
93 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
94 | + <constraints> | |
95 | + <constraint firstAttribute="trailing" secondItem="MvK-5R-njL" secondAttribute="trailing" id="IS8-5J-ypb"/> | |
96 | + <constraint firstAttribute="bottom" secondItem="MvK-5R-njL" secondAttribute="bottom" id="IVS-f9-RjH"/> | |
97 | + <constraint firstAttribute="bottom" secondItem="xXv-SO-m4h" secondAttribute="bottom" id="Ino-7v-CKz"/> | |
98 | + <constraint firstItem="MvK-5R-njL" firstAttribute="top" secondItem="hhh-nO-yn5" secondAttribute="top" id="NlH-tz-ByC"/> | |
99 | + <constraint firstAttribute="height" constant="36" id="O8T-vH-tg6"/> | |
100 | + <constraint firstItem="MvK-5R-njL" firstAttribute="leading" secondItem="xXv-SO-m4h" secondAttribute="trailing" id="V51-fg-KCf"/> | |
101 | + <constraint firstItem="xXv-SO-m4h" firstAttribute="leading" secondItem="hhh-nO-yn5" secondAttribute="leading" constant="5" id="eY6-uq-qWx"/> | |
102 | + <constraint firstItem="xXv-SO-m4h" firstAttribute="top" secondItem="hhh-nO-yn5" secondAttribute="top" id="l3a-Th-4Kb"/> | |
103 | + </constraints> | |
104 | + <userDefinedRuntimeAttributes> | |
105 | + <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> | |
106 | + <integer key="value" value="5"/> | |
107 | + </userDefinedRuntimeAttribute> | |
108 | + </userDefinedRuntimeAttributes> | |
109 | + </view> | |
110 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SNe-1B-nwV"> | |
111 | + <rect key="frame" x="15" y="105" width="345" height="105"/> | |
112 | + <subviews> | |
113 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="グループ VMAP アメリカルート61完走" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hyY-rU-WJx"> | |
114 | + <rect key="frame" x="8" y="8" width="329" height="20"/> | |
115 | + <constraints> | |
116 | + <constraint firstAttribute="height" constant="20" id="dx4-Lw-gRP"/> | |
117 | + </constraints> | |
118 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
119 | + <nil key="textColor"/> | |
120 | + <nil key="highlightedColor"/> | |
121 | + </label> | |
122 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P1r-ft-imP"> | |
123 | + <rect key="frame" x="8" y="36" width="155" height="61"/> | |
124 | + <constraints> | |
125 | + <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="61" id="6m3-4u-yjQ"/> | |
126 | + <constraint firstAttribute="width" constant="155" id="bJa-4P-B84"/> | |
127 | + </constraints> | |
128 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
129 | + <nil key="textColor"/> | |
130 | + <nil key="highlightedColor"/> | |
131 | + </label> | |
132 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fXA-Zh-ABB" customClass="AutoTransButton"> | |
133 | + <rect key="frame" x="171" y="67" width="166" height="30"/> | |
134 | + <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/> | |
135 | + <constraints> | |
136 | + <constraint firstAttribute="height" constant="30" id="4bu-TU-hhR"/> | |
137 | + <constraint firstAttribute="width" constant="166" id="hcm-Nd-TE4"/> | |
138 | + </constraints> | |
139 | + <state key="normal" title="VMAP"> | |
140 | + <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
141 | + </state> | |
142 | + <userDefinedRuntimeAttributes> | |
143 | + <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> | |
144 | + <integer key="value" value="10"/> | |
145 | + </userDefinedRuntimeAttribute> | |
146 | + </userDefinedRuntimeAttributes> | |
147 | + </button> | |
148 | + </subviews> | |
149 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
150 | + <constraints> | |
151 | + <constraint firstItem="P1r-ft-imP" firstAttribute="leading" secondItem="SNe-1B-nwV" secondAttribute="leading" constant="8" id="PCO-gJ-aUC"/> | |
152 | + <constraint firstItem="P1r-ft-imP" firstAttribute="top" secondItem="hyY-rU-WJx" secondAttribute="bottom" constant="8" id="TFE-rm-YuC"/> | |
153 | + <constraint firstItem="hyY-rU-WJx" firstAttribute="leading" secondItem="SNe-1B-nwV" secondAttribute="leading" constant="8" id="Urc-sV-0AF"/> | |
154 | + <constraint firstAttribute="bottom" secondItem="P1r-ft-imP" secondAttribute="bottom" constant="8" id="YYl-bN-XH2"/> | |
155 | + <constraint firstItem="hyY-rU-WJx" firstAttribute="top" secondItem="SNe-1B-nwV" secondAttribute="top" constant="8" id="a68-ja-X4x"/> | |
156 | + <constraint firstAttribute="trailing" secondItem="fXA-Zh-ABB" secondAttribute="trailing" constant="8" id="hNz-cE-JQc"/> | |
157 | + <constraint firstAttribute="trailing" secondItem="hyY-rU-WJx" secondAttribute="trailing" constant="8" id="tHp-Xw-Emj"/> | |
158 | + <constraint firstAttribute="bottom" secondItem="fXA-Zh-ABB" secondAttribute="bottom" constant="8" id="vRs-Al-kct"/> | |
159 | + </constraints> | |
160 | + </view> | |
161 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ftA-wa-19F"> | |
162 | + <rect key="frame" x="15" y="218" width="345" height="40"/> | |
163 | + <constraints> | |
164 | + <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="40" id="sns-tn-c0d"/> | |
165 | + </constraints> | |
166 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
167 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
168 | + <nil key="highlightedColor"/> | |
169 | + </label> | |
170 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eBu-7L-nsx" customClass="AutoTransButton"> | |
171 | + <rect key="frame" x="194" y="268" width="166" height="30"/> | |
172 | + <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/> | |
173 | + <constraints> | |
174 | + <constraint firstAttribute="width" constant="166" id="Rrn-lf-raV"/> | |
175 | + <constraint firstAttribute="height" constant="30" id="y2E-RH-aan"/> | |
176 | + </constraints> | |
177 | + <state key="normal" title="メンバー"> | |
178 | + <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
179 | + </state> | |
180 | + <userDefinedRuntimeAttributes> | |
181 | + <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> | |
182 | + <integer key="value" value="10"/> | |
183 | + </userDefinedRuntimeAttribute> | |
184 | + </userDefinedRuntimeAttributes> | |
185 | + <connections> | |
186 | + <action selector="clickSwitch:" destination="-1" eventType="touchUpInside" id="B7a-Hl-IlY"/> | |
187 | + </connections> | |
188 | + </button> | |
189 | + <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" rowHeight="100" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ubS-v9-zCa"> | |
190 | + <rect key="frame" x="0.0" y="313" width="375" height="304"/> | |
191 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
192 | + <connections> | |
193 | + <outlet property="dataSource" destination="-1" id="HIG-w5-mXN"/> | |
194 | + <outlet property="delegate" destination="-1" id="GIa-bX-Av9"/> | |
195 | + </connections> | |
196 | + </tableView> | |
197 | + <tableView hidden="YES" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="35" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="dtD-J5-dze"> | |
198 | + <rect key="frame" x="15" y="91" width="345" height="140"/> | |
199 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
200 | + <constraints> | |
201 | + <constraint firstAttribute="height" constant="140" id="CrG-Ni-f6b"/> | |
202 | + </constraints> | |
203 | + <connections> | |
204 | + <outlet property="dataSource" destination="-1" id="2bH-mm-vKH"/> | |
205 | + <outlet property="delegate" destination="-1" id="9tr-mh-5Ir"/> | |
206 | + </connections> | |
207 | + </tableView> | |
208 | + </subviews> | |
209 | + <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> | |
210 | + <constraints> | |
211 | + <constraint firstItem="ftA-wa-19F" firstAttribute="top" secondItem="SNe-1B-nwV" secondAttribute="bottom" constant="8" id="4iN-BW-Eaa"/> | |
212 | + <constraint firstItem="vxT-xe-7mV" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="5np-jI-7iK"/> | |
213 | + <constraint firstAttribute="trailing" secondItem="eBu-7L-nsx" secondAttribute="trailing" constant="15" id="AkN-Cv-ULu"/> | |
214 | + <constraint firstItem="SNe-1B-nwV" firstAttribute="top" secondItem="hhh-nO-yn5" secondAttribute="bottom" constant="15" id="BL0-Cv-jlz"/> | |
215 | + <constraint firstItem="ubS-v9-zCa" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="Dt8-xl-lI8"/> | |
216 | + <constraint firstAttribute="trailing" secondItem="SNe-1B-nwV" secondAttribute="trailing" constant="15" id="QiL-ts-ryc"/> | |
217 | + <constraint firstItem="dtD-J5-dze" firstAttribute="top" secondItem="hhh-nO-yn5" secondAttribute="bottom" constant="1" id="QzJ-aS-NQ0"/> | |
218 | + <constraint firstItem="SNe-1B-nwV" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="15" id="T4b-fq-Gc8"/> | |
219 | + <constraint firstAttribute="trailing" secondItem="hhh-nO-yn5" secondAttribute="trailing" constant="15" id="YB3-2b-4yx"/> | |
220 | + <constraint firstAttribute="bottom" secondItem="ubS-v9-zCa" secondAttribute="bottom" constant="50" id="ZNH-0B-rWz"/> | |
221 | + <constraint firstItem="ftA-wa-19F" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="15" id="bnx-K2-jVS"/> | |
222 | + <constraint firstAttribute="trailing" secondItem="ubS-v9-zCa" secondAttribute="trailing" id="bsK-wi-RYU"/> | |
223 | + <constraint firstAttribute="trailing" secondItem="vxT-xe-7mV" secondAttribute="trailing" id="eld-fc-V95"/> | |
224 | + <constraint firstItem="hhh-nO-yn5" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="15" id="gDN-Hr-2vm"/> | |
225 | + <constraint firstItem="vxT-xe-7mV" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="iBy-99-6Ky"/> | |
226 | + <constraint firstItem="dtD-J5-dze" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="15" id="ie5-ll-WkY"/> | |
227 | + <constraint firstAttribute="trailing" secondItem="ftA-wa-19F" secondAttribute="trailing" constant="15" id="jaz-L9-glj"/> | |
228 | + <constraint firstItem="eBu-7L-nsx" firstAttribute="top" secondItem="ftA-wa-19F" secondAttribute="bottom" constant="10" id="lF2-iL-Xa6"/> | |
229 | + <constraint firstItem="ubS-v9-zCa" firstAttribute="top" secondItem="eBu-7L-nsx" secondAttribute="bottom" constant="15" id="ofF-9P-pq9"/> | |
230 | + <constraint firstItem="hhh-nO-yn5" firstAttribute="top" secondItem="vxT-xe-7mV" secondAttribute="bottom" constant="8" id="qIL-RX-3zl"/> | |
231 | + <constraint firstAttribute="trailing" secondItem="dtD-J5-dze" secondAttribute="trailing" constant="15" id="uHa-ot-bT0"/> | |
232 | + </constraints> | |
233 | + <point key="canvasLocation" x="24.5" y="52.5"/> | |
234 | + </view> | |
235 | + </objects> | |
236 | + <resources> | |
237 | + <image name="arrow_down" width="28" height="18"/> | |
238 | + <image name="icon_menu" width="30" height="30"/> | |
239 | + <image name="today_back_button" width="73" height="37"/> | |
240 | + </resources> | |
241 | +</document> |
LifeLog/LifeLog/RankingViewController.xib
... | ... | @@ -34,7 +34,7 @@ |
34 | 34 | <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.rank.title"/> |
35 | 35 | </userDefinedRuntimeAttributes> |
36 | 36 | </label> |
37 | - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qPe-ff-jRp"> | |
37 | + <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qPe-ff-jRp"> | |
38 | 38 | <rect key="frame" x="0.0" y="5" width="70" height="36"/> |
39 | 39 | <constraints> |
40 | 40 | <constraint firstAttribute="width" constant="70" id="bEy-jt-69Q"/> |
LifeLog/LifeLog/SNSViewController.m
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | #import "Utilities.h" |
15 | 15 | |
16 | 16 | #import "SNSRecentTopicTableViewCell.h" |
17 | +#import "MyGroupViewController.h" | |
17 | 18 | #import "SearchGroupViewController.h" |
18 | 19 | #import "GroupDetailViewController.h" |
19 | 20 | |
... | ... | @@ -46,18 +47,21 @@ |
46 | 47 | } |
47 | 48 | |
48 | 49 | - (IBAction)clickMyGroup:(id)sender { |
49 | -// GroupDetailViewController * detail = [[GroupDetailViewController alloc] init]; | |
50 | -// [self.navigationController pushViewController:detail animated:true]; | |
50 | + MyGroupViewController * myGrp = [[MyGroupViewController alloc] init]; | |
51 | + [self.navigationController pushViewController:myGrp animated:true]; | |
51 | 52 | } |
52 | 53 | |
53 | 54 | #pragma mark UITableView Delegate |
54 | 55 | - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
55 | 56 | SNSRecentTopicTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"RecentTopicCell"]; |
56 | 57 | TweetObject *object = [_curDataList objectAtIndex:indexPath.row]; |
57 | - if(object.avatarLink && ![object.avatarLink isKindOfClass:[NSNull class]]) { | |
58 | - [cell.imgAvatar sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:object.avatarLink]]]; | |
58 | + if(object.avatar && ![object.avatar isKindOfClass:[NSNull class]]) { | |
59 | + [cell.imgAvatar sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:object.avatar]]]; | |
59 | 60 | } |
60 | - cell.lblDateTime.text = [Utilities stringFromDate:object.createDate withFormat:@"YYYY/MM/dd hh:mm"]; | |
61 | + else { | |
62 | + [cell.imgAvatar setImage:[UIImage imageNamed:@"avatar_default"]]; | |
63 | + } | |
64 | + cell.lblDateTime.text = [Utilities stringFromDate:object.createDate withFormat:@"YYYY/MM/dd hh:mm" locale:@""]; | |
61 | 65 | cell.lblUsername.text = object.userName; |
62 | 66 | cell.lblDes.text = object.content; |
63 | 67 | cell.lblMode.text = object.mode; |
LifeLog/LifeLog/SNSViewController.xib
... | ... | @@ -31,7 +31,7 @@ |
31 | 31 | <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.sns.title"/> |
32 | 32 | </userDefinedRuntimeAttributes> |
33 | 33 | </label> |
34 | - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BIE-oM-ejb"> | |
34 | + <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BIE-oM-ejb"> | |
35 | 35 | <rect key="frame" x="0.0" y="5" width="70" height="36"/> |
36 | 36 | <constraints> |
37 | 37 | <constraint firstAttribute="width" constant="70" id="ZpD-Ru-8wG"/> |
LifeLog/LifeLog/SearchGroupViewController.h
... | ... | @@ -9,7 +9,9 @@ |
9 | 9 | #import <UIKit/UIKit.h> |
10 | 10 | #import "BaseTableViewController.h" |
11 | 11 | |
12 | -@interface SearchGroupViewController : BaseTableViewController<UITextFieldDelegate> | |
12 | +@interface SearchGroupViewController : BaseTableViewController<UITextFieldDelegate> { | |
13 | + NSTimer *timerSearch; | |
14 | +} | |
13 | 15 | |
14 | 16 | @property (weak, nonatomic) IBOutlet UITextField *textFieldSearch; |
15 | 17 |
LifeLog/LifeLog/SearchGroupViewController.m
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | #import "Utilities.h" |
15 | 15 | |
16 | 16 | #import "SearchGroupTableViewCell.h" |
17 | +#import "CreateGroupViewController.h" | |
17 | 18 | #import "GroupDetailViewController.h" |
18 | 19 | |
19 | 20 | @interface SearchGroupViewController () |
... | ... | @@ -42,11 +43,18 @@ |
42 | 43 | } |
43 | 44 | |
44 | 45 | - (IBAction)clickSearch:(id)sender { |
46 | + [self.view endEditing:true]; | |
45 | 47 | [self resetData]; |
46 | 48 | } |
47 | 49 | |
48 | 50 | - (IBAction)clickCreateGroup:(id)sender { |
49 | - | |
51 | + CreateGroupViewController * create = [[CreateGroupViewController alloc] init]; | |
52 | + create.createGroupSuccess = ^(GroupObject *object){ | |
53 | + GroupDetailViewController * detail = [[GroupDetailViewController alloc] init]; | |
54 | + [detail setGroup:object]; | |
55 | + [self.navigationController pushViewController:detail animated:true]; | |
56 | + }; | |
57 | + [self.navigationController pushViewController:create animated:true]; | |
50 | 58 | } |
51 | 59 | |
52 | 60 | #pragma mark UITableView Delegate |
... | ... | @@ -56,6 +64,9 @@ |
56 | 64 | if(object.avatar && ![object.avatar isKindOfClass:[NSNull class]]) { |
57 | 65 | [cell.imgAvatar sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:object.avatar]]]; |
58 | 66 | } |
67 | + else { | |
68 | + [cell.imgAvatar setImage:[UIImage imageNamed:@"avatar_default"]]; | |
69 | + } | |
59 | 70 | cell.lblName.text = object.name; |
60 | 71 | return cell; |
61 | 72 | } |
... | ... | @@ -71,8 +82,16 @@ |
71 | 82 | } |
72 | 83 | |
73 | 84 | #pragma mark UITextField Delegate |
85 | +-(BOOL) textFieldShouldReturn:(UITextField *)textField { | |
86 | + [self.view endEditing:true]; | |
87 | + return true; | |
88 | +} | |
89 | + | |
74 | 90 | -(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { |
75 | - [self resetData]; | |
91 | + if(timerSearch != nil) { | |
92 | + [timerSearch invalidate]; | |
93 | + } | |
94 | + timerSearch = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(resetData) userInfo:nil repeats:false]; | |
76 | 95 | return true; |
77 | 96 | } |
78 | 97 |
LifeLog/LifeLog/SearchGroupViewController.xib
... | ... | @@ -112,7 +112,7 @@ |
112 | 112 | <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.searchGr.bt.createGr"/> |
113 | 113 | </userDefinedRuntimeAttributes> |
114 | 114 | <connections> |
115 | - <action selector="clickCreateGroup:" destination="-1" eventType="touchUpOutside" id="iYI-HB-mhb"/> | |
115 | + <action selector="clickCreateGroup:" destination="-1" eventType="touchUpInside" id="J9P-5a-SrT"/> | |
116 | 116 | </connections> |
117 | 117 | </button> |
118 | 118 | <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" rowHeight="70" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="yF3-ZN-ebL"> |
LifeLog/LifeLog/ServerAPI.h
... | ... | @@ -30,9 +30,12 @@ extern NSString *const kNotificationToken; |
30 | 30 | - (void)requestCreateLog:(int)mode withStep:(int)numStep startDate:(NSString *)startDate endDate:(NSString *)endDate CompletionHandler:(void (^)(NSError *))completion; |
31 | 31 | |
32 | 32 | #pragma mark - History Screen Function |
33 | -- (void) requestHistory:(NSString *)token atDate:(NSDate *)date withType:(int)type andMode:(int) mode CompletionHandler:(void (^)(HistoryObject *, NSError *)) completion; | |
33 | +- (void) requestHistory:(NSString *)token startDate:(NSDate *)startDate endDate:(NSDate *)endDate CompletionHandler:(void (^)(NSArray *, NSError *)) completion; | |
34 | 34 | - (void) requestHistoryGraph:(NSString *)token withType:(int)type andMode:(int) mode CompletionHandler:(void (^)(HistoryGraphObject *, NSError *)) completion; |
35 | 35 | - (void) requestHistoryList:(NSString *)token withType:(int)type andMode:(int) mode AtPage:(int) page CompletionHandler:(void (^)(NSArray *, NSError *)) completion; |
36 | +- (void) requestJoinGroup:(NSString *)token groupID: (int) groupID CompletionHandler:(void (^)(NSError *)) completion; | |
37 | +-(void) requestCreateGroup:(NSString *)token withGroup:(GroupObject *)group CompletionHandler:(void (^)(GroupObject *, NSError *)) completion; | |
38 | +- (void) requestGroupList:(NSString *)token CompletionHandler:(void (^)(NSArray *, NSError *)) completion; | |
36 | 39 | |
37 | 40 | #pragma mark - SNS Screen Function |
38 | 41 | /* |
... | ... | @@ -41,6 +44,11 @@ extern NSString *const kNotificationToken; |
41 | 44 | */ |
42 | 45 | - (void) requestTweetsList:(NSString *)token groupID: (int) groupID withPage:(int)page CompletionHandler:(void (^)(NSArray *, NSError *)) completion; |
43 | 46 | - (void) searchGroup:(NSString *)token withKey:(NSString *)key andPage:(int)page CompletionHandler:(void (^)(NSArray *, NSError *)) completion; |
47 | + | |
48 | +#pragma mark - Group Function | |
49 | +- (void) getGroupDetail:(NSString *)token withGroupID:(int)groupID CompletionHandler:(void (^)(GroupObject *, NSError *)) completion; | |
50 | +- (void) requestMemberList:(NSString *)token groupID: (int) groupID withPage:(int)page CompletionHandler:(void (^)(NSArray *, NSError *)) completion; | |
51 | + | |
44 | 52 | #pragma mark - Common API |
45 | 53 | - (void)refreshToken: (NSString *)userID CompletionHandler:(void (^)(NSString *, NSError *))completion; |
46 | 54 | @end |
LifeLog/LifeLog/ServerAPI.m
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | // |
8 | 8 | |
9 | 9 | #import "ServerAPI.h" |
10 | +#import "Utilities.h" | |
10 | 11 | |
11 | 12 | NSString *const kServerAddress = @"http://clover.timesfun.jp:9001/"; |
12 | 13 | NSString *const kUser = @"KEY_USER"; |
... | ... | @@ -406,8 +407,8 @@ NSURLSessionDataTask * searchTask; |
406 | 407 | } |
407 | 408 | |
408 | 409 | #pragma mark - History Screen Function |
409 | -- (void) requestHistory:(NSString *)token atDate:(NSDate *)date withType:(int)type andMode:(int) mode CompletionHandler:(void (^)(HistoryObject *, NSError *)) completion { | |
410 | - NSString *url = [kServerAddress stringByAppendingFormat:@"/api/history/%@/%d", [self convertIntToString:type], mode]; | |
410 | +- (void) requestHistory:(NSString *)token startDate:(NSDate *)startDate endDate:(NSDate *)endDate CompletionHandler:(void (^)(NSArray *, NSError *)) completion { | |
411 | + NSString *url = [kServerAddress stringByAppendingFormat:@"/api/history/%@/%@", [Utilities stringFromDate:startDate withFormat:@"YYYYMMdd" locale:@""], [Utilities stringFromDate:endDate withFormat:@"YYYYMMdd" locale:@""]]; | |
411 | 412 | NSLog(@"requestHistory link %@", url); |
412 | 413 | [self _request:url method:@"GET" token:token paras:nil completion:^(NSData *data, NSError *error) { |
413 | 414 | |
... | ... | @@ -421,8 +422,22 @@ NSURLSessionDataTask * searchTask; |
421 | 422 | NSLog(@"%@", dataResult); |
422 | 423 | int status = [dataResult[@"status"] intValue]; |
423 | 424 | if (status == 1) { // status = 1 success |
424 | - HistoryObject * object = [[HistoryObject alloc] initWithData:dataResult[@"result"]]; | |
425 | - completion(object, nil); | |
425 | + NSMutableArray * arrayHistory = [[NSMutableArray alloc] init]; | |
426 | + NSDictionary * arrResult = dataResult[@"result"]; | |
427 | + if(arrResult != nil) { | |
428 | + NSArray *arrayKey = [NSArray arrayWithObjects:@"mode_1", @"mode_2", @"mode_3", nil]; | |
429 | + for(NSString * key in arrayKey) { | |
430 | + NSDictionary *mode = [arrResult objectForKey:key]; | |
431 | + if(mode.count > 0) { | |
432 | + HistoryObject * objectMode = [[HistoryObject alloc] initWithData:mode]; | |
433 | + [arrayHistory addObject:objectMode]; | |
434 | + } | |
435 | + else { | |
436 | + [arrayHistory addObject:[[HistoryObject alloc] init]]; | |
437 | + } | |
438 | + } | |
439 | + } | |
440 | + completion(arrayHistory, nil); | |
426 | 441 | } |
427 | 442 | else { |
428 | 443 | NSString *message = dataResult[@"message"]; |
... | ... | @@ -433,7 +448,7 @@ NSURLSessionDataTask * searchTask; |
433 | 448 | if ([message isEqualToString:@"Token is invalid"]) { |
434 | 449 | [self performSelectorOnMainThread:@selector(checkToken) withObject:nil waitUntilDone:YES]; |
435 | 450 | NSString *tokenNew = [[NSUserDefaults standardUserDefaults] objectForKey:kToken]; |
436 | - [self requestHistory:tokenNew atDate:date withType:type andMode:mode CompletionHandler:completion]; | |
451 | + [self requestHistory:tokenNew startDate:startDate endDate:endDate CompletionHandler:completion]; | |
437 | 452 | } |
438 | 453 | else { |
439 | 454 | NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":message}]; |
... | ... | @@ -646,6 +661,265 @@ NSURLSessionDataTask * searchTask; |
646 | 661 | }]; |
647 | 662 | } |
648 | 663 | |
664 | +#pragma mark - Group Function | |
665 | +-(void) requestCreateGroup:(NSString *)token withGroup:(GroupObject *)group CompletionHandler:(void (^)(GroupObject *, NSError *)) completion { | |
666 | + NSString *url = [kServerAddress stringByAppendingFormat:@"api/groups/newGroup"]; | |
667 | + NSLog(@"requestCreateGroup link %@", url); | |
668 | + NSDictionary * dict = @{@"group_name":group.name, | |
669 | + @"goal":group.goal, | |
670 | + @"walk_mode_active":[NSNumber numberWithBool:group.walkMode], | |
671 | + @"run_mode_active":[NSNumber numberWithBool:group.runMode], | |
672 | + @"bike_mode_active":[NSNumber numberWithBool:group.bikeMode], | |
673 | + @"step_mode_active":[NSNumber numberWithBool:group.stepMode], | |
674 | + @"gym_mode_active":[NSNumber numberWithBool:group.gymMode], | |
675 | + @"beginer_mode_active":[NSNumber numberWithBool:group.beginMode], | |
676 | + @"walk_mode_goal":[NSNumber numberWithBool:group.walkGoal], | |
677 | + @"run_mode_goal":[NSNumber numberWithBool:group.runGoal], | |
678 | + @"bike_mode_goal":[NSNumber numberWithBool:group.bikeGoal]}; | |
679 | + | |
680 | + [self _request:url method:@"POST" token:token paras:dict completion:^(NSData *data, NSError *error) { | |
681 | + | |
682 | + if (completion == NULL) { | |
683 | + return ; | |
684 | + } | |
685 | + | |
686 | + if (error == nil) | |
687 | + { | |
688 | + NSDictionary *dataResult = [NSJSONSerialization JSONObjectWithData:data options: NSJSONReadingAllowFragments error: &error]; | |
689 | + NSLog(@"%@", dataResult); | |
690 | + int status = [dataResult[@"status"] intValue]; | |
691 | + if (status == 1) { // status = 1 success | |
692 | + if(dataResult[@"result"] != nil) { | |
693 | + NSDictionary * dict = dataResult[@"result"]; | |
694 | + group.groupID = [dict[@"group_id"] intValue]; | |
695 | + completion(group, nil); | |
696 | + } | |
697 | + else { | |
698 | + NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":@"Unknown Error"}]; | |
699 | + completion(nil, errorObject); | |
700 | + } | |
701 | + } | |
702 | + else { | |
703 | + NSString *message = dataResult[@"message"]; | |
704 | + if (message == nil) { | |
705 | + message = @"Unknown error"; | |
706 | + } | |
707 | + | |
708 | + if ([message isEqualToString:@"Token is invalid"]) { | |
709 | + [self performSelectorOnMainThread:@selector(checkToken) withObject:nil waitUntilDone:YES]; | |
710 | + NSString *tokenNew = [[NSUserDefaults standardUserDefaults] objectForKey:kToken]; | |
711 | + [self requestCreateGroup:tokenNew withGroup:group CompletionHandler:completion]; | |
712 | + } | |
713 | + else { | |
714 | + NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":message}]; | |
715 | + completion(nil, errorObject); | |
716 | + } | |
717 | + } | |
718 | + } | |
719 | + else | |
720 | + { | |
721 | + completion(nil, error); | |
722 | + } | |
723 | + }]; | |
724 | +} | |
725 | + | |
726 | +- (void) getGroupDetail:(NSString *)token withGroupID:(int)groupID CompletionHandler:(void (^)(GroupObject *, NSError *)) completion { | |
727 | + NSString *url = [kServerAddress stringByAppendingFormat:@"api/sns/group/detail/%d", groupID]; | |
728 | + NSLog(@"getGroupDetail link %@", url); | |
729 | + [self _request:url method:@"GET" token:token paras:nil completion:^(NSData *data, NSError *error) { | |
730 | + | |
731 | + if (completion == NULL) { | |
732 | + return ; | |
733 | + } | |
734 | + | |
735 | + if (error == nil) | |
736 | + { | |
737 | + NSDictionary *dataResult = [NSJSONSerialization JSONObjectWithData:data options: NSJSONReadingAllowFragments error: &error]; | |
738 | + NSLog(@"%@", dataResult); | |
739 | + int status = [dataResult[@"status"] intValue]; | |
740 | + if (status == 1) { // status = 1 success | |
741 | + if(dataResult[@"result"] != nil) { | |
742 | + NSArray * array = dataResult[@"result"]; | |
743 | + GroupObject * object = [[GroupObject alloc] initWithData:array[0] andGroupID:groupID]; | |
744 | + completion(object, nil); | |
745 | + } | |
746 | + else { | |
747 | + NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":@"Unknown Error"}]; | |
748 | + completion(nil, errorObject); | |
749 | + } | |
750 | + } | |
751 | + else { | |
752 | + NSString *message = dataResult[@"message"]; | |
753 | + if (message == nil) { | |
754 | + message = @"Unknown error"; | |
755 | + } | |
756 | + | |
757 | + if ([message isEqualToString:@"Token is invalid"]) { | |
758 | + [self performSelectorOnMainThread:@selector(checkToken) withObject:nil waitUntilDone:YES]; | |
759 | + NSString *tokenNew = [[NSUserDefaults standardUserDefaults] objectForKey:kToken]; | |
760 | + [self getGroupDetail:tokenNew withGroupID:groupID CompletionHandler:completion]; | |
761 | + } | |
762 | + else { | |
763 | + NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":message}]; | |
764 | + completion(nil, errorObject); | |
765 | + } | |
766 | + } | |
767 | + } | |
768 | + else | |
769 | + { | |
770 | + completion(nil, error); | |
771 | + } | |
772 | + }]; | |
773 | +} | |
774 | + | |
775 | +- (void) requestMemberList:(NSString *)token groupID: (int) groupID withPage:(int)page CompletionHandler:(void (^)(NSArray *, NSError *)) completion { | |
776 | + NSString *url = [kServerAddress stringByAppendingFormat:@"api/sns/group/member/%d/%d", groupID, page]; | |
777 | + NSLog(@"requestMemberList link %@ page %d", url, page); | |
778 | + | |
779 | + [self _request:url method:@"GET" token:token paras:nil completion:^(NSData *data, NSError *error) { | |
780 | + if (completion == NULL) { | |
781 | + return ; | |
782 | + } | |
783 | + | |
784 | + if (error == nil) | |
785 | + { | |
786 | + NSDictionary *dataResult = [NSJSONSerialization JSONObjectWithData:data options: NSJSONReadingAllowFragments error: &error]; | |
787 | + NSLog(@"%@", dataResult); | |
788 | + int status = [dataResult[@"status"] intValue]; | |
789 | + if (status == 1) { // status = 1 success | |
790 | + if(dataResult[@"result"] != nil) { | |
791 | + NSArray * array = dataResult[@"result"]; | |
792 | + NSMutableArray * arrayTweets = [[NSMutableArray alloc] init]; | |
793 | + for(NSDictionary * dict in array) { | |
794 | + MemberObject * object = [[MemberObject alloc] initWithData:dict]; | |
795 | + [arrayTweets addObject:object]; | |
796 | + } | |
797 | + completion(arrayTweets, nil); | |
798 | + } | |
799 | + else { | |
800 | + NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":@"Unknown Error"}]; | |
801 | + completion(nil, errorObject); | |
802 | + } | |
803 | + } | |
804 | + else { | |
805 | + NSString *message = dataResult[@"message"]; | |
806 | + if (message == nil) { | |
807 | + message = @"Unknown error"; | |
808 | + } | |
809 | + | |
810 | + if ([message isEqualToString:@"Token is invalid"]) { | |
811 | + [self performSelectorOnMainThread:@selector(checkToken) withObject:nil waitUntilDone:YES]; | |
812 | + NSString *tokenNew = [[NSUserDefaults standardUserDefaults] objectForKey:kToken]; | |
813 | + [self requestMemberList:tokenNew groupID:groupID withPage:page CompletionHandler:completion]; | |
814 | + } | |
815 | + else { | |
816 | + NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":message}]; | |
817 | + completion(nil, errorObject); | |
818 | + } | |
819 | + } | |
820 | + } | |
821 | + else | |
822 | + { | |
823 | + completion(nil, error); | |
824 | + } | |
825 | + }]; | |
826 | +} | |
827 | + | |
828 | +- (void) requestJoinGroup:(NSString *)token groupID: (int) groupID CompletionHandler:(void (^)(NSError *)) completion { | |
829 | + NSString *url = [kServerAddress stringByAppendingFormat:@"api/sns/group/join"]; | |
830 | + NSLog(@"requestJoinGroup link %@", url); | |
831 | + | |
832 | + [self _request:url method:@"POST" token:token paras:@{@"group_id": [NSNumber numberWithInt:groupID]} completion:^(NSData *data, NSError *error) { | |
833 | + if (completion == NULL) { | |
834 | + return ; | |
835 | + } | |
836 | + | |
837 | + if (error == nil) | |
838 | + { | |
839 | + NSDictionary *dataResult = [NSJSONSerialization JSONObjectWithData:data options: NSJSONReadingAllowFragments error: &error]; | |
840 | + NSLog(@"%@", dataResult); | |
841 | + int status = [dataResult[@"status"] intValue]; | |
842 | + if (status == 1) { // status = 1 success | |
843 | + if(dataResult[@"result"] != nil) { | |
844 | + completion(nil); | |
845 | + } | |
846 | + else { | |
847 | + NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":@"Unknown Error"}]; | |
848 | + completion(errorObject); | |
849 | + } | |
850 | + } | |
851 | + else { | |
852 | + NSString *message = dataResult[@"message"]; | |
853 | + if ([message isEqualToString:@"Token is invalid"]) { | |
854 | + [self performSelectorOnMainThread:@selector(checkToken) withObject:nil waitUntilDone:YES]; | |
855 | + NSString *tokenNew = [[NSUserDefaults standardUserDefaults] objectForKey:kToken]; | |
856 | + [self requestJoinGroup:tokenNew groupID:groupID CompletionHandler:completion]; | |
857 | + } | |
858 | + else { | |
859 | + NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":message}]; | |
860 | + completion(errorObject); | |
861 | + } | |
862 | + } | |
863 | + } | |
864 | + else | |
865 | + { | |
866 | + completion(error); | |
867 | + } | |
868 | + }]; | |
869 | +} | |
870 | + | |
871 | +- (void) requestGroupList:(NSString *)token CompletionHandler:(void (^)(NSArray *, NSError *)) completion { | |
872 | + NSString *url = [kServerAddress stringByAppendingFormat:@"api/groups/list"]; | |
873 | + NSLog(@"requestGroupList link %@", url); | |
874 | + | |
875 | + [self _request:url method:@"GET" token:token paras:nil completion:^(NSData *data, NSError *error) { | |
876 | + if (completion == NULL) { | |
877 | + return ; | |
878 | + } | |
879 | + | |
880 | + if (error == nil) | |
881 | + { | |
882 | + NSDictionary *dataResult = [NSJSONSerialization JSONObjectWithData:data options: NSJSONReadingAllowFragments error: &error]; | |
883 | + NSLog(@"%@", dataResult); | |
884 | + int status = [dataResult[@"status"] intValue]; | |
885 | + if (status == 1) { // status = 1 success | |
886 | + if(dataResult[@"result"] != nil) { | |
887 | + NSArray * array = dataResult[@"result"]; | |
888 | + NSMutableArray * arrayGroup = [[NSMutableArray alloc] init]; | |
889 | + for(NSDictionary * dict in array) { | |
890 | + GroupObject * object = [[GroupObject alloc] initWithShortData:dict]; | |
891 | + [arrayGroup addObject:object]; | |
892 | + } | |
893 | + completion(arrayGroup, nil); | |
894 | + } | |
895 | + else { | |
896 | + NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":@"Unknown Error"}]; | |
897 | + completion(nil, errorObject); | |
898 | + } | |
899 | + } | |
900 | + else { | |
901 | + NSString *message = dataResult[@"message"]; | |
902 | + if (message == nil) { | |
903 | + message = @"Unknown error"; | |
904 | + } | |
905 | + | |
906 | + if ([message isEqualToString:@"Token is invalid"]) { | |
907 | + [self performSelectorOnMainThread:@selector(checkToken) withObject:nil waitUntilDone:YES]; | |
908 | + NSString *tokenNew = [[NSUserDefaults standardUserDefaults] objectForKey:kToken]; | |
909 | + [self requestGroupList:tokenNew CompletionHandler:completion]; | |
910 | + } | |
911 | + else { | |
912 | + NSError *errorObject = [NSError errorWithDomain:@"LifeLog_Domain" code:-1 userInfo:@{@"message":message}]; | |
913 | + completion(nil, errorObject); | |
914 | + } | |
915 | + } | |
916 | + } | |
917 | + else | |
918 | + { | |
919 | + completion(nil, error); | |
920 | + } | |
921 | + }]; | |
922 | +} | |
649 | 923 | #pragma mark - Common API |
650 | 924 | - (void)refreshToken: (NSString *)userID CompletionHandler:(void (^)(NSString *, NSError *))completion { |
651 | 925 | [self _request:[kServerAddress stringByAppendingFormat: @"refreshToken"] method:@"POST" token:@"" paras:@{@"userId":userID} completion:^(NSData *data, NSError *error) { |
LifeLog/LifeLog/TweetObject.h
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | @property (nonatomic, strong) NSString * mode; |
20 | 20 | @property (nonatomic, strong) NSString * time; |
21 | 21 | @property (nonatomic, strong) NSString * userName; |
22 | -@property (nonatomic, strong) NSString * avatarLink; | |
22 | +@property (nonatomic, strong) NSString * avatar; | |
23 | 23 | @property (nonatomic, strong) NSDate * createDate; |
24 | 24 | |
25 | 25 | -(id) initWithData : (NSDictionary *) dict; |
LifeLog/LifeLog/TweetObject.m
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | self.userName = dict[@"full_name"]; |
55 | 55 | } |
56 | 56 | if([dict objectForKey:@"profile_image"] != nil) { |
57 | - self.avatarLink = dict[@"profile_image"]; | |
57 | + self.avatar = dict[@"profile_image"]; | |
58 | 58 | } |
59 | 59 | if([dict objectForKey:@"created_at"] != nil) { |
60 | 60 | NSString *dateString = dict[@"created_at"]; |
LifeLog/LifeLog/Utilities.h
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | @interface Utilities : NSObject |
13 | 13 | + (NSString *)addCommaFromNumber:(NSInteger)number; |
14 | 14 | + (UIColor *)convertHecToColor:(int) hex; |
15 | ++ (void)showMessage:(NSString *)message withViewController:(UIViewController *)vc; | |
15 | 16 | + (void)showErrorMessage:(NSString *)message withViewController:(UIViewController *)vc; |
16 | 17 | + (NSString *) getImageLink : (NSString *) path; |
17 | 18 | |
... | ... | @@ -23,5 +24,5 @@ |
23 | 24 | |
24 | 25 | //convert date time |
25 | 26 | + (NSDate *) dateFromString : (NSString *) dateString withFormat: (NSString *) format; |
26 | -+ (NSString *) stringFromDate : (NSDate *) date withFormat: (NSString *) format; | |
27 | ++ (NSString *) stringFromDate : (NSDate *) date withFormat: (NSString *) format locale:(NSString *) locale; | |
27 | 28 | @end |
LifeLog/LifeLog/Utilities.m
... | ... | @@ -29,6 +29,28 @@ |
29 | 29 | blue:((float)(hex & 0xFF))/255.0 alpha:1.0]; |
30 | 30 | } |
31 | 31 | |
32 | ++ (void)showMessage:(NSString *)message withViewController:(UIViewController *)vc | |
33 | +{ | |
34 | + if (message.length > 0) { | |
35 | + UIAlertController * alert= [UIAlertController | |
36 | + alertControllerWithTitle:@"Message" | |
37 | + message:message | |
38 | + preferredStyle:UIAlertControllerStyleAlert]; | |
39 | + | |
40 | + UIAlertAction* ok = [UIAlertAction | |
41 | + actionWithTitle:@"OK" | |
42 | + style:UIAlertActionStyleDefault | |
43 | + handler:^(UIAlertAction * action) | |
44 | + { | |
45 | + [alert dismissViewControllerAnimated:YES completion:nil]; | |
46 | + }]; | |
47 | + | |
48 | + [alert addAction:ok]; | |
49 | + | |
50 | + [vc presentViewController:alert animated:YES completion:nil]; | |
51 | + } | |
52 | +} | |
53 | + | |
32 | 54 | + (void)showErrorMessage:(NSString *)message withViewController:(UIViewController *)vc |
33 | 55 | { |
34 | 56 | if (message.length > 0) { |
... | ... | @@ -43,7 +65,6 @@ |
43 | 65 | handler:^(UIAlertAction * action) |
44 | 66 | { |
45 | 67 | [alert dismissViewControllerAnimated:YES completion:nil]; |
46 | - | |
47 | 68 | }]; |
48 | 69 | |
49 | 70 | [alert addAction:ok]; |
... | ... | @@ -136,9 +157,12 @@ |
136 | 157 | return date; |
137 | 158 | } |
138 | 159 | |
139 | -+ (NSString *) stringFromDate : (NSDate *) date withFormat: (NSString *) format { | |
160 | ++ (NSString *) stringFromDate : (NSDate *) date withFormat: (NSString *) format locale:(NSString *) locale { | |
140 | 161 | NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; |
141 | 162 | [dateFormat setDateFormat:format]; |
163 | + if(![locale isEqual: @""]) { | |
164 | + [dateFormat setLocale:[[NSLocale alloc] initWithLocaleIdentifier:locale]]; | |
165 | + } | |
142 | 166 | NSString *dateString = [dateFormat stringFromDate:date]; |
143 | 167 | return dateString; |
144 | 168 | } |