git.iko.soy/dashared/GDproject
on master help sign in
minor changes: fixed a few bugs
commit25c84f200522f65ac580f833c9b71abb4e1507a5 authorDarya Rednikina <rednikina.com@yandex.ru> dateFri 15 Mar 2019, 23:17 (8 years ago) parent8056914
6 files changed+25−9
GDproject/Base.lproj/Main.storyboard+3−2 GDproject/Controller/ News and channels/ChannelController.swift+7 GDproject/Controller/ News and channels/ChannelListController.swift+2−2 GDproject/Controller/ News and channels/NewPostViewController.swift+7−1 GDproject/Controller/ News and channels/SimplifiedChannelsList.swift+5−3 GDproject/Controller/Profile/ProfileViewController.swift+1−1
GDproject/Base.lproj/Main.storyboard+3−2
@@ -223,7 +223,7 @@
223223 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
224224 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
225225 <prototypes>
226− <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" restorationIdentifier="cell" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="cell" textLabel="mZB-IA-VFq" detailTextLabel="6A8-yj-Eqe" style="IBUITableViewCellStyleSubtitle" id="6dT-km-gZC">
226+ <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" restorationIdentifier="cell" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="cell1" textLabel="mZB-IA-VFq" detailTextLabel="6A8-yj-Eqe" style="IBUITableViewCellStyleSubtitle" id="6dT-km-gZC">
227227 <rect key="frame" x="0.0" y="28" width="375" height="44"/>
228228 <autoresizingMask key="autoresizingMask"/>
229229 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="6dT-km-gZC" id="h7U-va-4PX">
@@ -256,7 +256,7 @@
256256 </tableViewController>
257257 <placeholder placeholderIdentifier="IBFirstResponder" id="731-nV-bC3" userLabel="First Responder" sceneMemberID="firstResponder"/>
258258 </objects>
259− <point key="canvasLocation" x="4445.6000000000004" y="-598.65067466266873"/>
259+ <point key="canvasLocation" x="4372" y="-598"/>
260260 </scene>
261261 <!--Channel List Controller-->
262262 <scene sceneID="4eb-Jz-gcx">
@@ -528,6 +528,7 @@
528528 <objects>
529529 <navigationController storyboardIdentifier="root" id="609-2j-gc9" sceneMemberID="viewController">
530530 <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Ah8-NU-AsD">
531+ <rect key="frame" x="0.0" y="20" width="375" height="44"/>
531532 <autoresizingMask key="autoresizingMask"/>
532533 </navigationBar>
533534 </navigationController>
GDproject/Controller/ News and channels/ChannelController.swift+7
@@ -45,10 +45,17 @@ class ChannelController: UIViewController, UITableViewDelegate, UITableViewDataS
4545 tableView.reloadData()
4646 }
4747
48+ var reloadtable: Bool = false {
49+ didSet{
50+ tableView.reloadData()
51+ }
52+ }
53+
4854 override func viewWillAppear(_ animated: Bool) {
4955 super.viewWillAppear(animated)
5056 Model.getUsers(for: channel!.people) { [weak self] (people) in
5157 self?.dataSourcePeople = Array(people.values)
58+ self?.reloadtable = true
5259 }
5360 }
5461
GDproject/Controller/ News and channels/ChannelListController.swift+2−2
@@ -151,7 +151,7 @@ class ChannelListController: UITableViewController, DataDelegate {
151151 vc.channel = self?.dataSource[indexPath.row]
152152 self?.navigationController?.pushViewController(vc, animated: true)
153153 }
154− editButton.backgroundColor = .green
154+ editButton.backgroundColor = #colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1)
155155
156156
157157 let deleteButton = UITableViewRowAction(style: .normal, title: "Delete") { [weak self] (action, indexPath) in
@@ -170,7 +170,7 @@ class ChannelListController: UITableViewController, DataDelegate {
170170 self?.tableView.endUpdates()
171171 }
172172
173− deleteButton.backgroundColor = .red
173+ deleteButton.backgroundColor = #colorLiteral(red: 1, green: 0.1491314173, blue: 0, alpha: 1)
174174
175175 return [editButton, deleteButton]
176176 }
GDproject/Controller/ News and channels/NewPostViewController.swift+7−1
@@ -26,6 +26,8 @@ class NewPostViewController: UIViewController, UITextViewDelegate {
2626 var myProtocol: NewPostDelegate?
2727
2828 static var draft: String = ""
29+ static var hashTagsDraft: [String] = []
30+
2931 var textView: UITextView!
3032
3133 // buttons for attaching images
@@ -95,6 +97,8 @@ class NewPostViewController: UIViewController, UITextViewDelegate {
9597 navigationController?.navigationBar.prefersLargeTitles = false
9698 navigationItem.title = "New post"
9799 textView.text = NewPostViewController.draft
100+ tagsField.addTags(NewPostViewController.hashTagsDraft)
101+
98102 }
99103
100104 func setUpAccessoryView(){
@@ -227,6 +231,7 @@ class NewPostViewController: UIViewController, UITextViewDelegate {
227231 [weak self]
228232 _ in
229233 NewPostViewController.draft = self?.textView.text ?? ""
234+ NewPostViewController.hashTagsDraft = self?.tagsField.tags.map { $0.text } ?? []
230235 self?.moveBackToParentVC()
231236 }
232237
@@ -235,6 +240,7 @@ class NewPostViewController: UIViewController, UITextViewDelegate {
235240 [weak self] (_)
236241 in
237242 NewPostViewController.draft = ""
243+ NewPostViewController.hashTagsDraft = []
238244 self?.moveBackToParentVC()
239245 }
240246
@@ -307,7 +313,7 @@ extension NewPostViewController: UITextFieldDelegate {
307313
308314 func textFieldShouldReturn(_ textField: UITextField) -> Bool {
309315 if textField == tagsField {
310− // hz
316+ textView.becomeFirstResponder()
311317 }
312318 return true
313319 }
GDproject/Controller/ News and channels/SimplifiedChannelsList.swift+5−3
@@ -24,9 +24,10 @@ class SimplifiedChannelsList: UITableViewController {
2424 override func viewDidLoad() {
2525 super.viewDidLoad()
2626 setUpNavigationButtons()
27+ navigationItem.title = "All channels"
2728 navigationItem.largeTitleDisplayMode = .never
2829 self.navigationItem.setHidesBackButton(true, animated:true)
29− tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
30+ tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell1")
3031 }
3132
3233 override func viewWillAppear(_ animated: Bool) {
@@ -56,6 +57,7 @@ class SimplifiedChannelsList: UITableViewController {
5657
5758 override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
5859 let viewHeader = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 30))
60+ viewHeader.backgroundColor = .white
5961 let label = UILabel()
6062
6163 label.text = "All channels"
@@ -82,10 +84,10 @@ class SimplifiedChannelsList: UITableViewController {
8284 }
8385
8486 override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
85− let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
87+ let cell = tableView.dequeueReusableCell(withIdentifier: "cell1", for: indexPath)
8688
8789 cell.textLabel?.text = dataSource![indexPath.row].name
88− cell.detailTextLabel?.text = "\(dataSource![indexPath.row].id!)"
90+ cell.detailTextLabel?.text = "hello"
8991
9092 return cell
9193 }
GDproject/Controller/Profile/ProfileViewController.swift+1−1
@@ -138,7 +138,7 @@ class ProfileViewController: UIViewController
138138 // saved
139139
140140 let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
141− let channelAction = UIAlertAction(title: "Add to the channel", style: .default){
141+ let channelAction = UIAlertAction(title: "Add to a channel", style: .default){
142142 [weak self] (_) in
143143
144144 let vc = self?.storyboard?.instantiateViewController(withIdentifier: simplifiedChannelsList) as! SimplifiedChannelsList