Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Feature development
Browse files Browse the repository at this point in the history
Mod list page added.
  • Loading branch information
Thornaci committed Feb 18, 2018
1 parent 1c65fc4 commit 83a7b22
Show file tree
Hide file tree
Showing 14 changed files with 315 additions and 48 deletions.
40 changes: 28 additions & 12 deletions SteemitApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
8F0D2DA319ADFBAC93253D59 /* Pods_SteemitAppWidget.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 852814DD7BACC71EFCEBA815 /* Pods_SteemitAppWidget.framework */; };
ABFFC2526324D20A127D4979 /* Pods_SteemitApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CEC947916BFFF1BA92135A0 /* Pods_SteemitApp.framework */; };
C00B710E202E45DE00219433 /* PostHistoryWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C00B710D202E45DE00219433 /* PostHistoryWebViewController.swift */; };
C034A08A2039964600C9C805 /* SideMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A0892039964600C9C805 /* SideMenuViewController.swift */; };
C034A08D20399DBD00C9C805 /* CategoryTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A08B20399DBD00C9C805 /* CategoryTableViewCell.swift */; };
C034A08E20399DBD00C9C805 /* CategoryTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C034A08C20399DBD00C9C805 /* CategoryTableViewCell.xib */; };
C034A08A2039964600C9C805 /* ThoListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A0892039964600C9C805 /* ThoListViewController.swift */; };
C034A08D20399DBD00C9C805 /* TitleTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A08B20399DBD00C9C805 /* TitleTableViewCell.swift */; };
C034A08E20399DBD00C9C805 /* TitleTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C034A08C20399DBD00C9C805 /* TitleTableViewCell.xib */; };
C034A0902039BEDB00C9C805 /* HomeUtopian.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C034A08F2039BEDB00C9C805 /* HomeUtopian.storyboard */; };
C034A0932039BFBA00C9C805 /* HomeUtopianViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A0922039BFBA00C9C805 /* HomeUtopianViewController.swift */; };
C034A0952039C09800C9C805 /* HomeCategories.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A0942039C09800C9C805 /* HomeCategories.swift */; };
C034A0972039C9DD00C9C805 /* ViewControllerStoryboardIDContants.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A0962039C9DD00C9C805 /* ViewControllerStoryboardIDContants.swift */; };
C034A0992039C9FA00C9C805 /* StoryboardConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A0982039C9FA00C9C805 /* StoryboardConstants.swift */; };
C034A09B2039DA2800C9C805 /* ThoSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A09A2039DA2800C9C805 /* ThoSlider.swift */; };
C034A09E203A15F700C9C805 /* UtopianModeratorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A09D203A15F700C9C805 /* UtopianModeratorModel.swift */; };
C034A0A0203A204100C9C805 /* ModeratorListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C034A09F203A204100C9C805 /* ModeratorListViewController.swift */; };
C03D22C02032180B0077F1F5 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C03D22BF2032180A0077F1F5 /* Info.plist */; };
C03D22C2203218A50077F1F5 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C03D22C1203218A50077F1F5 /* GoogleService-Info.plist */; };
C0420037201E04A700311654 /* FollowersViewControllerTableViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0420036201E04A700311654 /* FollowersViewControllerTableViewExtension.swift */; };
Expand Down Expand Up @@ -126,15 +128,17 @@
852814DD7BACC71EFCEBA815 /* Pods_SteemitAppWidget.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SteemitAppWidget.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C0007AF82013A40700C533F7 /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C00B710D202E45DE00219433 /* PostHistoryWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHistoryWebViewController.swift; sourceTree = "<group>"; };
C034A0892039964600C9C805 /* SideMenuViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SideMenuViewController.swift; sourceTree = "<group>"; };
C034A08B20399DBD00C9C805 /* CategoryTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryTableViewCell.swift; sourceTree = "<group>"; };
C034A08C20399DBD00C9C805 /* CategoryTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CategoryTableViewCell.xib; sourceTree = "<group>"; };
C034A0892039964600C9C805 /* ThoListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThoListViewController.swift; sourceTree = "<group>"; };
C034A08B20399DBD00C9C805 /* TitleTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleTableViewCell.swift; sourceTree = "<group>"; };
C034A08C20399DBD00C9C805 /* TitleTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleTableViewCell.xib; sourceTree = "<group>"; };
C034A08F2039BEDB00C9C805 /* HomeUtopian.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = HomeUtopian.storyboard; sourceTree = "<group>"; };
C034A0922039BFBA00C9C805 /* HomeUtopianViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeUtopianViewController.swift; sourceTree = "<group>"; };
C034A0942039C09800C9C805 /* HomeCategories.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeCategories.swift; sourceTree = "<group>"; };
C034A0962039C9DD00C9C805 /* ViewControllerStoryboardIDContants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewControllerStoryboardIDContants.swift; sourceTree = "<group>"; };
C034A0982039C9FA00C9C805 /* StoryboardConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoryboardConstants.swift; sourceTree = "<group>"; };
C034A09A2039DA2800C9C805 /* ThoSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThoSlider.swift; sourceTree = "<group>"; };
C034A09D203A15F700C9C805 /* UtopianModeratorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtopianModeratorModel.swift; sourceTree = "<group>"; };
C034A09F203A204100C9C805 /* ModeratorListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModeratorListViewController.swift; sourceTree = "<group>"; };
C03D22BF2032180A0077F1F5 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C03D22C1203218A50077F1F5 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
C0420036201E04A700311654 /* FollowersViewControllerTableViewExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowersViewControllerTableViewExtension.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -253,7 +257,7 @@
C034A0882039961E00C9C805 /* Custom View Controllers */ = {
isa = PBXGroup;
children = (
C034A0892039964600C9C805 /* SideMenuViewController.swift */,
C034A0892039964600C9C805 /* ThoListViewController.swift */,
);
path = "Custom View Controllers";
sourceTree = "<group>";
Expand All @@ -262,10 +266,19 @@
isa = PBXGroup;
children = (
C034A0922039BFBA00C9C805 /* HomeUtopianViewController.swift */,
C034A09F203A204100C9C805 /* ModeratorListViewController.swift */,
);
path = HomeUtopian;
sourceTree = "<group>";
};
C034A09C203A15CE00C9C805 /* Utopian */ = {
isa = PBXGroup;
children = (
C034A09D203A15F700C9C805 /* UtopianModeratorModel.swift */,
);
path = Utopian;
sourceTree = "<group>";
};
C048DE582031B13E0070C5D5 /* SteemitAppTests */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -323,6 +336,7 @@
C062EF512003682600B9C3D2 /* Models */ = {
isa = PBXGroup;
children = (
C034A09C203A15CE00C9C805 /* Utopian */,
C062EF5220036ACF00B9C3D2 /* CoinModel.swift */,
C062EF622003B6EE00B9C3D2 /* UserModel.swift */,
C0ADEB782020EBDE0053C3BF /* OptionModel.swift */,
Expand Down Expand Up @@ -469,8 +483,8 @@
C0420039201E0F2000311654 /* FollowerTableViewCell.xib */,
C0656513202CC08C005F9089 /* PostContentTableViewCell.swift */,
C0656514202CC08C005F9089 /* PostContentTableViewCell.xib */,
C034A08B20399DBD00C9C805 /* CategoryTableViewCell.swift */,
C034A08C20399DBD00C9C805 /* CategoryTableViewCell.xib */,
C034A08B20399DBD00C9C805 /* TitleTableViewCell.swift */,
C034A08C20399DBD00C9C805 /* TitleTableViewCell.xib */,
);
path = "Custom Cells";
sourceTree = "<group>";
Expand Down Expand Up @@ -710,7 +724,7 @@
C0ADEB7C2020F7B80053C3BF /* History.storyboard in Resources */,
C0B899EA2014C15100A45554 /* FavoriteTableViewCell.xib in Resources */,
C0656516202CC08C005F9089 /* PostContentTableViewCell.xib in Resources */,
C034A08E20399DBD00C9C805 /* CategoryTableViewCell.xib in Resources */,
C034A08E20399DBD00C9C805 /* TitleTableViewCell.xib in Resources */,
C091EE372019DA120010209F /* Follower.storyboard in Resources */,
C0ADEB712020E85B0053C3BF /* Information.storyboard in Resources */,
C042003B201E0F2000311654 /* FollowerTableViewCell.xib in Resources */,
Expand Down Expand Up @@ -921,8 +935,8 @@
C062EF592003968500B9C3D2 /* CoinTypes.swift in Sources */,
C0B899EC2014D21600A45554 /* Helpers.swift in Sources */,
C073B1802022F26E00598305 /* TagHistoryModel.swift in Sources */,
C034A08A2039964600C9C805 /* SideMenuViewController.swift in Sources */,
C034A08D20399DBD00C9C805 /* CategoryTableViewCell.swift in Sources */,
C034A08A2039964600C9C805 /* ThoListViewController.swift in Sources */,
C034A08D20399DBD00C9C805 /* TitleTableViewCell.swift in Sources */,
C034A0932039BFBA00C9C805 /* HomeUtopianViewController.swift in Sources */,
C07C623D202A21AB004A5378 /* PostHistoryContentsViewController.swift in Sources */,
C0B899E92014C15100A45554 /* FavoriteTableViewCell.swift in Sources */,
Expand All @@ -933,6 +947,7 @@
C034A0952039C09800C9C805 /* HomeCategories.swift in Sources */,
C062EF4E200364EB00B9C3D2 /* BaseViewController.swift in Sources */,
C062EF5F2003B10200B9C3D2 /* TextChanger.swift in Sources */,
C034A0A0203A204100C9C805 /* ModeratorListViewController.swift in Sources */,
C0420037201E04A700311654 /* FollowersViewControllerTableViewExtension.swift in Sources */,
C0ADEB7F2020F7F60053C3BF /* TagHistoryViewController.swift in Sources */,
C062EF5620038FE500B9C3D2 /* DateExtension.swift in Sources */,
Expand All @@ -946,6 +961,7 @@
C062EF612003B31500B9C3D2 /* SearchViewController.swift in Sources */,
C0E56AE9202DA26600E0A249 /* BaseTabBarViewController.swift in Sources */,
C0F8BF182004FBFB009C1585 /* PopupManager.swift in Sources */,
C034A09E203A15F700C9C805 /* UtopianModeratorModel.swift in Sources */,
C062EF472003649500B9C3D2 /* InfoViewController.swift in Sources */,
C0BD90432023A329009B58E7 /* ThoButton.swift in Sources */,
C062EF5D2003B06600B9C3D2 /* CurrencyTypes.swift in Sources */,
Expand Down
Binary file not shown.
5 changes: 3 additions & 2 deletions SteemitApp/Controllers/Home/Search/SearchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class SearchViewController: BaseViewController {
let optionVC = segue.destination as! OptionsViewController
optionVC.username = usernameTextField.text!
} else if segue.identifier == "leftSideMenu" {
let menuVC = segue.destination as! SideMenuViewController
let menuVC = segue.destination as! ThoListViewController
menuVC.categoryList = HomeCategories.categoryList
menuVC.delegate = self
}
}
Expand All @@ -54,7 +55,7 @@ class SearchViewController: BaseViewController {
}
}

extension SearchViewController: SideMenuViewControllerDelegate {
extension SearchViewController: ThoListViewControllerDelegate {
func changePage(_ category: String) {
if category == "Utopian-io" {
let vc = UIStoryboard.init(name: "HomeUtopian",
Expand Down
39 changes: 34 additions & 5 deletions SteemitApp/Controllers/HomeUtopian/HomeUtopianViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,53 @@ import UIKit
class HomeUtopianViewController: BaseViewController {

let nm = NetworkManager()
let helper = Helpers()

@IBOutlet weak var percentView: ThoSlider!
@IBOutlet weak var steemPowerPercentLabel: UILabel!
@IBOutlet weak var lastVoteTimeLabel: ThoLabel!
@IBOutlet weak var postNumberLabel: ThoLabel!
@IBOutlet weak var moderatorNumberLabel: ThoLabel!

var moderators = [UtopianModeratorModel]()

override func viewDidLoad() {
// getUtopianInfo()
navigationItem.title = "Utopian"
getUtopianInfo()
}

func getUtopianInfo() {
private func getUtopianInfo() {
nm.getSteemitAccount(user: "utopian-io", success: { utopianData in

self.updateUserInfo(utopianData)
}) { (error) in
print(error)
}

nm.getUtopianModeratorList(success: { (mods) in
self.moderators = mods
}) { (error) in
print(error)
}
}

private func updateUserInfo(_ user: UserModel) {
percentView.updateBar(user.votingPower/10000)
steemPowerPercentLabel.text = "%\(user.votingPower/100)"
lastVoteTimeLabel.text = user.lastvoteTime?.replacingOccurrences(of: "T", with: " ")
}

@IBAction func showMods(_ sender: Any) {
performSegue(withIdentifier: "showMods", sender: nil)
}

@IBAction func closeScreen(_ sender: Any) {
// self.navigationController?.dismiss(animated: true, completion: nil)
percentView.updateBar(0.9)
self.navigationController?.dismiss(animated: true, completion: nil)
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showMods" {
let vc = segue.destination as! ModeratorListViewController
vc.moderators = moderators
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// ModeratorListViewController.swift
// SteemitApp
//
// Created by Burak Tayfun on 2/18/18.
// Copyright © 2018 Burak Tayfun. All rights reserved.
//

import UIKit

class ModeratorListViewController: UIViewController {

var moderators = [UtopianModeratorModel]()

override func viewDidLoad() {
navigationItem.title = "Moderators"
navigationController?.navigationBar.topItem?.title = ""
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "moderatorList" {
let menuVC = segue.destination as! ThoListViewController
var names = [String]()
for mod in moderators {
names.append(mod.name!)
}
menuVC.categoryList = names
menuVC.delegate = self
}
}
}

extension ModeratorListViewController: ThoListViewControllerDelegate {
func changePage(_ category: String) {

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// CategoryTableViewCell.swift
// TitleTableViewCell.swift
// SteemitApp
//
// Created by Burak Tayfun on 2/18/18.
Expand All @@ -8,7 +8,7 @@

import UIKit

class CategoryTableViewCell: UITableViewCell {
class TitleTableViewCell: UITableViewCell {

@IBOutlet weak var headerLabel: UILabel!
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="CategoryTableViewCell" id="KGk-i7-Jjw" customClass="CategoryTableViewCell" customModule="SteemitApp" customModuleProvider="target">
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="TitleTableViewCell" id="KGk-i7-Jjw" customClass="TitleTableViewCell" customModule="SteemitApp" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
Expand Down Expand Up @@ -53,7 +53,7 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="headerLabel" destination="mb2-FJ-nUB" id="xK3-j5-cz9"/>
<outlet property="headerLabel" destination="mb2-FJ-nUB" id="UJX-oU-bXz"/>
</connections>
</tableViewCell>
</objects>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// SideMenuViewController.swift
// ThoListViewController.swift
// SteemitApp
//
// Created by Burak Tayfun on 2/18/18.
Expand All @@ -8,39 +8,38 @@

import UIKit

protocol SideMenuViewControllerDelegate: class {
protocol ThoListViewControllerDelegate: class {
func changePage(_ category: String)
}

class SideMenuViewController: UIViewController {
class ThoListViewController: UIViewController {

@IBOutlet weak var categoriesTableView: UITableView!

var categoryList = [String]()
let categoryTableViewCellIdentifier = "CategoryTableViewCell"
weak var delegate: SideMenuViewControllerDelegate?
let categoryTableViewCellIdentifier = "TitleTableViewCell"
weak var delegate: ThoListViewControllerDelegate?

override func viewDidLoad() {
super.viewDidLoad()
categoryList = HomeCategories.categoryList
categoriesTableView.register(UINib.init(nibName: categoryTableViewCellIdentifier, bundle: nil), forCellReuseIdentifier: categoryTableViewCellIdentifier)
}
}

extension SideMenuViewController: UITableViewDataSource {
extension ThoListViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return categoryList.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: categoryTableViewCellIdentifier, for: indexPath) as! CategoryTableViewCell
let cell = tableView.dequeueReusableCell(withIdentifier: categoryTableViewCellIdentifier, for: indexPath) as! TitleTableViewCell
cell.headerLabel.text = categoryList[indexPath.row]

return cell
}
}

extension SideMenuViewController: UITableViewDelegate {
extension ThoListViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
delegate?.changePage(categoryList[indexPath.row])
}
Expand Down
Loading

0 comments on commit 83a7b22

Please sign in to comment.