Commit 3b284106dee2ed153d5a4cf8b79b2072b127945f
1 parent
fa0d79042b
Exists in
master
and in
1 other branch
Add UI group detail and API load tweet of group
Showing 13 changed files with 359 additions and 5 deletions Side-by-side Diff
- LifeLog/LifeLog.xcodeproj/project.pbxproj
- LifeLog/LifeLog/GroupDetailViewController.h
- LifeLog/LifeLog/GroupDetailViewController.m
- LifeLog/LifeLog/GroupDetailViewController.xib
- LifeLog/LifeLog/Localizable.strings
- LifeLog/LifeLog/SNSViewController.h
- LifeLog/LifeLog/SNSViewController.m
- LifeLog/LifeLog/SNSViewController.xib
- LifeLog/LifeLog/SearchGroupViewController.m
- LifeLog/LifeLog/SearchGroupViewController.xib
- LifeLog/LifeLog/ServerAPI.h
- LifeLog/LifeLog/ServerAPI.m
- LifeLog/LifeLog/TweetObject.m
LifeLog/LifeLog.xcodeproj/project.pbxproj
... | ... | @@ -49,6 +49,8 @@ |
49 | 49 | E933E6701F3E09B6002926F5 /* SearchGroupTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E933E66E1F3E09B6002926F5 /* SearchGroupTableViewCell.m */; }; |
50 | 50 | E933E6711F3E09B6002926F5 /* SearchGroupTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E933E66F1F3E09B6002926F5 /* SearchGroupTableViewCell.xib */; }; |
51 | 51 | E933E6741F3E0E4E002926F5 /* GroupObject.m in Sources */ = {isa = PBXBuildFile; fileRef = E933E6731F3E0E4E002926F5 /* GroupObject.m */; }; |
52 | + E933E6791F40513C002926F5 /* GroupDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E933E6771F40513C002926F5 /* GroupDetailViewController.m */; }; | |
53 | + E933E67A1F40513C002926F5 /* GroupDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E933E6781F40513C002926F5 /* GroupDetailViewController.xib */; }; | |
52 | 54 | E9373E471F3596940059355A /* AutoTransLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = E9373E461F3596940059355A /* AutoTransLabel.m */; }; |
53 | 55 | E9373E4A1F35AA180059355A /* HistoryObject.m in Sources */ = {isa = PBXBuildFile; fileRef = E9373E491F35AA180059355A /* HistoryObject.m */; }; |
54 | 56 | E9373E4D1F361A230059355A /* HistoryGraphObject.m in Sources */ = {isa = PBXBuildFile; fileRef = E9373E4C1F361A230059355A /* HistoryGraphObject.m */; }; |
... | ... | @@ -161,6 +163,9 @@ |
161 | 163 | E933E66F1F3E09B6002926F5 /* SearchGroupTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SearchGroupTableViewCell.xib; sourceTree = "<group>"; }; |
162 | 164 | E933E6721F3E0E4E002926F5 /* GroupObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupObject.h; sourceTree = "<group>"; }; |
163 | 165 | E933E6731F3E0E4E002926F5 /* GroupObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupObject.m; sourceTree = "<group>"; }; |
166 | + E933E6761F40513C002926F5 /* GroupDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupDetailViewController.h; sourceTree = "<group>"; }; | |
167 | + E933E6771F40513C002926F5 /* GroupDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupDetailViewController.m; sourceTree = "<group>"; }; | |
168 | + E933E6781F40513C002926F5 /* GroupDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = GroupDetailViewController.xib; sourceTree = "<group>"; }; | |
164 | 169 | E9373E451F3596940059355A /* AutoTransLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoTransLabel.h; sourceTree = "<group>"; }; |
165 | 170 | E9373E461F3596940059355A /* AutoTransLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AutoTransLabel.m; sourceTree = "<group>"; }; |
166 | 171 | E9373E481F35AA180059355A /* HistoryObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryObject.h; sourceTree = "<group>"; }; |
... | ... | @@ -410,6 +415,7 @@ |
410 | 415 | 6E84E3AC1F27A954001EB88E /* SNS */ = { |
411 | 416 | isa = PBXGroup; |
412 | 417 | children = ( |
418 | + E933E6751F4050E6002926F5 /* GrouDetail */, | |
413 | 419 | E933E6671F3E0479002926F5 /* SeachGroup */, |
414 | 420 | 6E84E3BC1F27A9B1001EB88E /* SNSViewController.h */, |
415 | 421 | 6E84E3BD1F27A9B1001EB88E /* SNSViewController.m */, |
... | ... | @@ -526,6 +532,16 @@ |
526 | 532 | name = SeachGroup; |
527 | 533 | sourceTree = "<group>"; |
528 | 534 | }; |
535 | + E933E6751F4050E6002926F5 /* GrouDetail */ = { | |
536 | + isa = PBXGroup; | |
537 | + children = ( | |
538 | + E933E6761F40513C002926F5 /* GroupDetailViewController.h */, | |
539 | + E933E6771F40513C002926F5 /* GroupDetailViewController.m */, | |
540 | + E933E6781F40513C002926F5 /* GroupDetailViewController.xib */, | |
541 | + ); | |
542 | + name = GrouDetail; | |
543 | + sourceTree = "<group>"; | |
544 | + }; | |
529 | 545 | E9373E441F35966D0059355A /* AutoTranslateView */ = { |
530 | 546 | isa = PBXGroup; |
531 | 547 | children = ( |
... | ... | @@ -686,6 +702,7 @@ |
686 | 702 | 6E84E3B61F27A98B001EB88E /* HistoryViewController.xib in Resources */, |
687 | 703 | E933E66C1F3E04A6002926F5 /* SearchGroupViewController.xib in Resources */, |
688 | 704 | E96855121F3C5D9A00317CEF /* SNSRecentTopicTableViewCell.xib in Resources */, |
705 | + E933E67A1F40513C002926F5 /* GroupDetailViewController.xib in Resources */, | |
689 | 706 | E99E13B21F33720600C78787 /* LabelCollectionViewCell.xib in Resources */, |
690 | 707 | E9F73DCD1F338A0F004A3A6F /* HistoryListTableViewCell.xib in Resources */, |
691 | 708 | ); |
... | ... | @@ -779,6 +796,7 @@ |
779 | 796 | 6E7F93441F35872B00EFBC71 /* TPKeyboardAvoidingTableView.m in Sources */, |
780 | 797 | E9F73DCC1F338A0F004A3A6F /* HistoryListTableViewCell.m in Sources */, |
781 | 798 | 6EDC8BF41F2C68D700765ACC /* CMMotionActivityExtra.m in Sources */, |
799 | + E933E6791F40513C002926F5 /* GroupDetailViewController.m in Sources */, | |
782 | 800 | 9CBDA0FF1F2F03810055DED1 /* RegisterViewController.m in Sources */, |
783 | 801 | E9373E4A1F35AA180059355A /* HistoryObject.m in Sources */, |
784 | 802 | 9CA8AEEA1F31BB4600C5FC74 /* ConfirmForgetPassViewController.m in Sources */, |
LifeLog/LifeLog/GroupDetailViewController.h
1 | +// | |
2 | +// GroupDetailViewController.h | |
3 | +// LifeLog | |
4 | +// | |
5 | +// Created by nvtu on 8/13/17. | |
6 | +// Copyright ยฉ 2017 PhongNV. All rights reserved. | |
7 | +// | |
8 | + | |
9 | +#import <UIKit/UIKit.h> | |
10 | +#import "BaseTableViewController.h" | |
11 | +#import "Entities.h" | |
12 | + | |
13 | +@interface GroupDetailViewController : BaseTableViewController { | |
14 | + GroupObject * _curGroup; | |
15 | +} | |
16 | +@property (weak, nonatomic) IBOutlet UIImageView *imgAva; | |
17 | + | |
18 | +@property (weak, nonatomic) IBOutlet UILabel *lblGrpName; | |
19 | +@property (weak, nonatomic) IBOutlet UILabel *lbbGrpActiveMode; | |
20 | +@property (weak, nonatomic) IBOutlet UILabel *lblGrpGoal; | |
21 | + | |
22 | +- (IBAction)clickBack:(id)sender; | |
23 | + | |
24 | +- (void) setGroup : (GroupObject *) object; | |
25 | +@end |
LifeLog/LifeLog/GroupDetailViewController.m
1 | +// | |
2 | +// GroupDetailViewController.m | |
3 | +// LifeLog | |
4 | +// | |
5 | +// Created by nvtu on 8/13/17. | |
6 | +// Copyright ยฉ 2017 PhongNV. All rights reserved. | |
7 | +// | |
8 | + | |
9 | +#import "GroupDetailViewController.h" | |
10 | +#import <SDWebImage/UIImageView+WebCache.h> | |
11 | + | |
12 | +#import "Utilities.h" | |
13 | +#import "ServerAPI.h" | |
14 | +#import "SNSRecentTopicTableViewCell.h" | |
15 | + | |
16 | +@interface GroupDetailViewController () | |
17 | + | |
18 | +@end | |
19 | + | |
20 | +@implementation GroupDetailViewController | |
21 | + | |
22 | +- (void)viewDidLoad { | |
23 | + [super viewDidLoad]; | |
24 | + [self setupView]; | |
25 | + | |
26 | + //register nib for table view | |
27 | + [self.tableBase registerNib:[UINib nibWithNibName:@"SNSRecentTopicTableViewCell" bundle:nil] forCellReuseIdentifier:@"RecentTopicCell"]; | |
28 | + | |
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 | +- (void) setGroup : (GroupObject *) object { | |
38 | + _curGroup = object; | |
39 | +} | |
40 | + | |
41 | +- (void)setupView { | |
42 | + if(_curGroup != nil) { | |
43 | + self.lblGrpName.text = _curGroup.name; | |
44 | + if(_curGroup.avatar && ![_curGroup.avatar isKindOfClass:[NSNull class]]) { | |
45 | + [self.imgAva sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:_curGroup.avatar]]]; | |
46 | + } | |
47 | + [self callRequestToUpdateData]; | |
48 | + } | |
49 | +} | |
50 | + | |
51 | +#pragma mark IBAction | |
52 | + | |
53 | +- (IBAction)clickBack:(id)sender { | |
54 | + [self.navigationController popViewControllerAnimated:true]; | |
55 | +} | |
56 | + | |
57 | +#pragma mark UITableView Delegate | |
58 | +- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
59 | + 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]]]; | |
63 | + } | |
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; | |
70 | + return cell; | |
71 | +} | |
72 | + | |
73 | +#pragma mark Private Function | |
74 | + | |
75 | +-(void) callRequestToUpdateData { | |
76 | + [super callRequestToUpdateData]; | |
77 | + | |
78 | + NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; | |
79 | + MBProgressHUD *hudView = nil; | |
80 | + if(_curPage == 1 && !self.refreshControl.isRefreshing) { | |
81 | + hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; | |
82 | + } | |
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 | + }]; | |
92 | +} | |
93 | + | |
94 | +@end |
LifeLog/LifeLog/GroupDetailViewController.xib
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="GroupDetailViewController"> | |
12 | + <connections> | |
13 | + <outlet property="imgAva" destination="qYg-Gw-R2b" id="f9w-A2-u4G"/> | |
14 | + <outlet property="lbbGrpActiveMode" destination="O8z-6V-YFd" id="s8J-3i-pW3"/> | |
15 | + <outlet property="lblGrpGoal" destination="Bdy-dI-j47" id="AKx-8y-Ifm"/> | |
16 | + <outlet property="lblGrpName" destination="YWV-pS-TCo" id="VeU-Ov-uSD"/> | |
17 | + <outlet property="tableBase" destination="4VU-Ye-7Au" id="m1e-cS-Sxf"/> | |
18 | + <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> | |
19 | + </connections> | |
20 | + </placeholder> | |
21 | + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | |
22 | + <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> | |
23 | + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | |
24 | + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | |
25 | + <subviews> | |
26 | + <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"/> | |
28 | + <subviews> | |
29 | + <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"/> | |
31 | + <fontDescription key="fontDescription" type="system" pointSize="17"/> | |
32 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
33 | + <nil key="highlightedColor"/> | |
34 | + <userDefinedRuntimeAttributes> | |
35 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.grDetail.title"/> | |
36 | + </userDefinedRuntimeAttributes> | |
37 | + </label> | |
38 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="O3M-Ba-zHF"> | |
39 | + <rect key="frame" x="0.0" y="5" width="70" height="36"/> | |
40 | + <constraints> | |
41 | + <constraint firstAttribute="width" constant="70" id="2Mk-ly-c0t"/> | |
42 | + </constraints> | |
43 | + <state key="normal" image="today_back_button"/> | |
44 | + <connections> | |
45 | + <action selector="clickBack:" destination="-1" eventType="touchUpInside" id="gS4-F3-fzi"/> | |
46 | + </connections> | |
47 | + </button> | |
48 | + <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"/> | |
50 | + <constraints> | |
51 | + <constraint firstAttribute="width" constant="45" id="hHa-aE-1zd"/> | |
52 | + </constraints> | |
53 | + <state key="normal" image="icon_menu"/> | |
54 | + </button> | |
55 | + </subviews> | |
56 | + <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
57 | + <constraints> | |
58 | + <constraint firstItem="y09-DG-Krp" firstAttribute="top" secondItem="25d-3H-0fr" secondAttribute="top" id="65z-ZM-a3D"/> | |
59 | + <constraint firstItem="O3M-Ba-zHF" firstAttribute="leading" secondItem="25d-3H-0fr" secondAttribute="leading" id="CQk-IB-W9y"/> | |
60 | + <constraint firstAttribute="bottom" secondItem="y09-DG-Krp" secondAttribute="bottom" id="IWC-4b-gp6"/> | |
61 | + <constraint firstItem="O3M-Ba-zHF" firstAttribute="top" secondItem="25d-3H-0fr" secondAttribute="top" constant="5" id="JWL-bD-I2Z"/> | |
62 | + <constraint firstItem="DxD-Cy-0wi" firstAttribute="top" secondItem="25d-3H-0fr" secondAttribute="top" id="WYM-oV-6xn"/> | |
63 | + <constraint firstAttribute="bottom" secondItem="O3M-Ba-zHF" secondAttribute="bottom" constant="5" id="ZA0-Bo-IQF"/> | |
64 | + <constraint firstItem="DxD-Cy-0wi" firstAttribute="leading" secondItem="25d-3H-0fr" secondAttribute="leading" id="cbx-fE-OaR"/> | |
65 | + <constraint firstAttribute="trailing" secondItem="DxD-Cy-0wi" secondAttribute="trailing" id="i0L-w8-Oxm"/> | |
66 | + <constraint firstAttribute="trailing" secondItem="y09-DG-Krp" secondAttribute="trailing" id="nNZ-jP-k6U"/> | |
67 | + <constraint firstAttribute="bottom" secondItem="DxD-Cy-0wi" secondAttribute="bottom" id="oxP-oa-3FJ"/> | |
68 | + <constraint firstAttribute="height" constant="46" id="u2G-4s-RB5"/> | |
69 | + </constraints> | |
70 | + </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 | + <constraints> | |
74 | + <constraint firstAttribute="height" constant="21" id="fQO-ja-W9R"/> | |
75 | + </constraints> | |
76 | + <fontDescription key="fontDescription" type="system" pointSize="17"/> | |
77 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
78 | + <nil key="highlightedColor"/> | |
79 | + </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 | + <constraints> | |
83 | + <constraint firstAttribute="height" constant="60" id="Bid-NM-Ree"/> | |
84 | + </constraints> | |
85 | + <fontDescription key="fontDescription" type="system" pointSize="17"/> | |
86 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
87 | + <nil key="highlightedColor"/> | |
88 | + </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"/> | |
91 | + <constraints> | |
92 | + <constraint firstAttribute="height" constant="80" id="jgH-57-Bae"/> | |
93 | + </constraints> | |
94 | + <fontDescription key="fontDescription" type="system" pointSize="17"/> | |
95 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
96 | + <nil key="highlightedColor"/> | |
97 | + </label> | |
98 | + <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"/> | |
100 | + <constraints> | |
101 | + <constraint firstAttribute="width" constant="80" id="NEk-vg-zus"/> | |
102 | + <constraint firstAttribute="height" constant="60" id="qlv-ht-SUw"/> | |
103 | + </constraints> | |
104 | + </imageView> | |
105 | + <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"/> | |
107 | + <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
108 | + <constraints> | |
109 | + <constraint firstAttribute="height" constant="30" id="6Ir-ZZ-NOb"/> | |
110 | + </constraints> | |
111 | + <state key="normal" title="ใกใณใใผใ่ฆใ"> | |
112 | + <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
113 | + </state> | |
114 | + <userDefinedRuntimeAttributes> | |
115 | + <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> | |
116 | + <integer key="value" value="5"/> | |
117 | + </userDefinedRuntimeAttribute> | |
118 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.grDetail.bt.viewMem"/> | |
119 | + </userDefinedRuntimeAttributes> | |
120 | + </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"/> | |
123 | + <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
124 | + <constraints> | |
125 | + <constraint firstAttribute="height" constant="30" id="gIs-Km-dbx"/> | |
126 | + </constraints> | |
127 | + <state key="normal" title="ใฐใซใผใใซๅๅ ใใ"> | |
128 | + <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
129 | + </state> | |
130 | + <userDefinedRuntimeAttributes> | |
131 | + <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> | |
132 | + <integer key="value" value="5"/> | |
133 | + </userDefinedRuntimeAttribute> | |
134 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.grDetail.bt.joinGr"/> | |
135 | + </userDefinedRuntimeAttributes> | |
136 | + </button> | |
137 | + <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"/> | |
139 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | |
140 | + <connections> | |
141 | + <outlet property="dataSource" destination="-1" id="TLB-6X-bRI"/> | |
142 | + <outlet property="delegate" destination="-1" id="QcJ-Yh-deE"/> | |
143 | + </connections> | |
144 | + </tableView> | |
145 | + </subviews> | |
146 | + <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> | |
147 | + <constraints> | |
148 | + <constraint firstItem="25d-3H-0fr" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="5o2-0w-AL5"/> | |
149 | + <constraint firstAttribute="trailing" secondItem="25d-3H-0fr" secondAttribute="trailing" id="7IX-2R-C0n"/> | |
150 | + <constraint firstItem="O8z-6V-YFd" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="15" id="81K-BQ-6tU"/> | |
151 | + <constraint firstAttribute="bottom" secondItem="4VU-Ye-7Au" secondAttribute="bottom" constant="50" id="GKY-NB-YYF"/> | |
152 | + <constraint firstItem="O8z-6V-YFd" firstAttribute="top" secondItem="YWV-pS-TCo" secondAttribute="bottom" constant="10" id="HOo-rH-ysj"/> | |
153 | + <constraint firstItem="Bdy-dI-j47" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="15" id="I1a-bY-ME9"/> | |
154 | + <constraint firstItem="YWV-pS-TCo" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="15" id="IS9-SU-75m"/> | |
155 | + <constraint firstAttribute="trailing" secondItem="Bdy-dI-j47" secondAttribute="trailing" constant="15" id="Ka2-Ki-Pu6"/> | |
156 | + <constraint firstItem="qYg-Gw-R2b" firstAttribute="top" secondItem="YWV-pS-TCo" secondAttribute="bottom" constant="10" id="One-fp-LTK"/> | |
157 | + <constraint firstAttribute="trailing" secondItem="qYg-Gw-R2b" secondAttribute="trailing" constant="15" id="PMd-CT-MVj"/> | |
158 | + <constraint firstItem="gBg-k9-tgw" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="15" id="bTf-qW-d1y"/> | |
159 | + <constraint firstItem="YWV-pS-TCo" firstAttribute="top" secondItem="25d-3H-0fr" secondAttribute="bottom" constant="8" id="cKj-l3-dgv"/> | |
160 | + <constraint firstItem="4VU-Ye-7Au" firstAttribute="top" secondItem="caN-x7-hJz" secondAttribute="bottom" constant="10" id="eQe-Kl-cMp"/> | |
161 | + <constraint firstItem="4VU-Ye-7Au" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="fru-BN-M5T"/> | |
162 | + <constraint firstItem="caN-x7-hJz" firstAttribute="top" secondItem="gBg-k9-tgw" secondAttribute="top" id="gUS-Ty-4Hk"/> | |
163 | + <constraint firstItem="qYg-Gw-R2b" firstAttribute="leading" secondItem="O8z-6V-YFd" secondAttribute="trailing" constant="22" id="gzU-2Q-G96"/> | |
164 | + <constraint firstItem="caN-x7-hJz" firstAttribute="leading" secondItem="gBg-k9-tgw" secondAttribute="trailing" constant="20" id="hWK-jf-zee"/> | |
165 | + <constraint firstItem="25d-3H-0fr" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="jhT-CE-fr7"/> | |
166 | + <constraint firstItem="caN-x7-hJz" firstAttribute="width" secondItem="gBg-k9-tgw" secondAttribute="width" id="mD6-eL-KB7"/> | |
167 | + <constraint firstItem="gBg-k9-tgw" firstAttribute="top" secondItem="Bdy-dI-j47" secondAttribute="bottom" constant="30" id="mgw-uX-VOK"/> | |
168 | + <constraint firstAttribute="trailing" secondItem="YWV-pS-TCo" secondAttribute="trailing" constant="15" id="rEO-bb-Pqr"/> | |
169 | + <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"/> | |
171 | + <constraint firstAttribute="trailing" secondItem="4VU-Ye-7Au" secondAttribute="trailing" id="ylN-vm-QF2"/> | |
172 | + </constraints> | |
173 | + <point key="canvasLocation" x="24.5" y="52.5"/> | |
174 | + </view> | |
175 | + </objects> | |
176 | + <resources> | |
177 | + <image name="icon_menu" width="30" height="30"/> | |
178 | + <image name="today_back_button" width="73" height="37"/> | |
179 | + </resources> | |
180 | +</document> |
LifeLog/LifeLog/Localizable.strings
No preview for this file type
LifeLog/LifeLog/SNSViewController.h
LifeLog/LifeLog/SNSViewController.m
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | |
16 | 16 | #import "SNSRecentTopicTableViewCell.h" |
17 | 17 | #import "SearchGroupViewController.h" |
18 | +#import "GroupDetailViewController.h" | |
18 | 19 | |
19 | 20 | @interface SNSViewController () |
20 | 21 | |
... | ... | @@ -44,6 +45,11 @@ |
44 | 45 | [self.navigationController pushViewController:search animated:true]; |
45 | 46 | } |
46 | 47 | |
48 | +- (IBAction)clickMyGroup:(id)sender { | |
49 | +// GroupDetailViewController * detail = [[GroupDetailViewController alloc] init]; | |
50 | +// [self.navigationController pushViewController:detail animated:true]; | |
51 | +} | |
52 | + | |
47 | 53 | #pragma mark UITableView Delegate |
48 | 54 | - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
49 | 55 | SNSRecentTopicTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"RecentTopicCell"]; |
... | ... | @@ -70,7 +76,7 @@ |
70 | 76 | if(_curPage == 1 && !self.refreshControl.isRefreshing) { |
71 | 77 | hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; |
72 | 78 | } |
73 | - [[ServerAPI server] requestRecentlyTweetsList:token withPage:_curPage CompletionHandler:^(NSArray *array, NSError *error){ | |
79 | + [[ServerAPI server] requestTweetsList:token groupID:-1 withPage:_curPage CompletionHandler:^(NSArray *array, NSError *error){ | |
74 | 80 | dispatch_async(dispatch_get_main_queue(), ^{ |
75 | 81 | if(hudView != nil) { |
76 | 82 | [hudView hideAnimated:true]; |
LifeLog/LifeLog/SNSViewController.xib
... | ... | @@ -103,6 +103,9 @@ |
103 | 103 | </userDefinedRuntimeAttribute> |
104 | 104 | <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.sns.bt.mygroup"/> |
105 | 105 | </userDefinedRuntimeAttributes> |
106 | + <connections> | |
107 | + <action selector="clickMyGroup:" destination="-1" eventType="touchUpInside" id="ph8-DF-WMt"/> | |
108 | + </connections> | |
106 | 109 | </button> |
107 | 110 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ๆ่ฟใฎ่ฉฑ้ก" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zzn-bU-X6s" customClass="AutoTransLabel"> |
108 | 111 | <rect key="frame" x="20" y="226" width="335" height="21"/> |
LifeLog/LifeLog/SearchGroupViewController.m
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | #import "Utilities.h" |
15 | 15 | |
16 | 16 | #import "SearchGroupTableViewCell.h" |
17 | +#import "GroupDetailViewController.h" | |
17 | 18 | |
18 | 19 | @interface SearchGroupViewController () |
19 | 20 | |
... | ... | @@ -61,6 +62,12 @@ |
61 | 62 | |
62 | 63 | -(void) scrollViewDidScroll:(UIScrollView *)scrollView { |
63 | 64 | [self.view endEditing:true]; |
65 | +} | |
66 | + | |
67 | +-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | |
68 | + GroupDetailViewController * detail = [[GroupDetailViewController alloc] init]; | |
69 | + [detail setGroup:[_curDataList objectAtIndex:indexPath.row]]; | |
70 | + [self.navigationController pushViewController:detail animated:true]; | |
64 | 71 | } |
65 | 72 | |
66 | 73 | #pragma mark UITextField Delegate |
LifeLog/LifeLog/SearchGroupViewController.xib
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
30 | 30 | <nil key="highlightedColor"/> |
31 | 31 | <userDefinedRuntimeAttributes> |
32 | - <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.sns.title"/> | |
32 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.searchGr.title"/> | |
33 | 33 | </userDefinedRuntimeAttributes> |
34 | 34 | </label> |
35 | 35 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pK9-Nf-LNR"> |
LifeLog/LifeLog/ServerAPI.h
... | ... | @@ -28,7 +28,11 @@ |
28 | 28 | - (void) requestHistoryList:(NSString *)token withType:(int)type andMode:(int) mode AtPage:(int) page CompletionHandler:(void (^)(NSArray *, NSError *)) completion; |
29 | 29 | |
30 | 30 | #pragma mark - SNS Screen Function |
31 | -- (void) requestRecentlyTweetsList:(NSString *)token withPage:(int)page CompletionHandler:(void (^)(NSArray *, NSError *)) completion; | |
31 | +/* | |
32 | + Get tweet of group and get recent tweet is same API | |
33 | + If groupID equal -1, it will request recent tweet. Otherwise will request tweet of group | |
34 | +*/ | |
35 | +- (void) requestTweetsList:(NSString *)token groupID: (int) groupID withPage:(int)page CompletionHandler:(void (^)(NSArray *, NSError *)) completion; | |
32 | 36 | - (void) searchGroup:(NSString *)token withKey:(NSString *)key andPage:(int)page CompletionHandler:(void (^)(NSArray *, NSError *)) completion; |
33 | 37 | @end |
LifeLog/LifeLog/ServerAPI.m
... | ... | @@ -398,9 +398,12 @@ |
398 | 398 | } |
399 | 399 | |
400 | 400 | #pragma mark - SNS Screen Function |
401 | -- (void) requestRecentlyTweetsList:(NSString *)token withPage:(int)page CompletionHandler:(void (^)(NSArray *, NSError *)) completion { | |
401 | +- (void) requestTweetsList:(NSString *)token groupID: (int) groupID withPage:(int)page CompletionHandler:(void (^)(NSArray *, NSError *)) completion { | |
402 | 402 | NSString *url = [kServerAddress stringByAppendingFormat:@"/api/sns/%d", page]; |
403 | - NSLog(@"requestRecentlyTweetsList link %@", url); | |
403 | + if(groupID > -1) { | |
404 | + url = [kServerAddress stringByAppendingFormat:@"api/tweet/list?group_id=%d&page=%d&record=10", groupID, page]; | |
405 | + } | |
406 | + NSLog(@"requestTweetsList link %@", url); | |
404 | 407 | [self _request:url method:@"GET" token:token paras:nil completion:^(NSData *data, NSError *error) { |
405 | 408 | |
406 | 409 | if (completion == NULL) { |
LifeLog/LifeLog/TweetObject.m
... | ... | @@ -44,14 +44,26 @@ |
44 | 44 | if([dict objectForKey:@"user_id"] != nil) { |
45 | 45 | self.userID = [dict[@"user_id"] intValue]; |
46 | 46 | } |
47 | + if([dict objectForKey:@"user_created"] != nil) { | |
48 | + self.userID = [dict[@"user_created"] intValue]; | |
49 | + } | |
47 | 50 | if([dict objectForKey:@"username"] != nil) { |
48 | 51 | self.userName = dict[@"username"]; |
49 | 52 | } |
53 | + if([dict objectForKey:@"full_name"] != nil) { | |
54 | + self.userName = dict[@"full_name"]; | |
55 | + } | |
50 | 56 | if([dict objectForKey:@"profile_image"] != nil) { |
51 | 57 | self.avatarLink = dict[@"profile_image"]; |
52 | 58 | } |
53 | 59 | if([dict objectForKey:@"created_at"] != nil) { |
54 | 60 | NSString *dateString = dict[@"created_at"]; |
61 | + self.createDate = [Utilities dateFromString:dateString withFormat:@"yyyy-MM-dd hh:mm:ss"]; | |
62 | + } | |
63 | + else if([dict objectForKey:@"date_created"] != nil && [dict objectForKey:@"time_created"] != nil) { | |
64 | + NSString *dateString = dict[@"date_created"]; | |
65 | + [dateString stringByAppendingString:@" "]; | |
66 | + [dateString stringByAppendingString:dict[@"time_created"]]; | |
55 | 67 | self.createDate = [Utilities dateFromString:dateString withFormat:@"yyyy-MM-dd hh:mm:ss"]; |
56 | 68 | } |
57 | 69 | else { |