Skip to content

Commit

Permalink
Revert "New application main color (#112)"
Browse files Browse the repository at this point in the history
This reverts commit d3b9bde.
  • Loading branch information
Ostrenkiy authored Sep 15, 2017
1 parent d3b9bde commit c699923
Show file tree
Hide file tree
Showing 179 changed files with 1,002 additions and 1,423 deletions.
18 changes: 9 additions & 9 deletions JSQWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ class WebViewController: UIViewController {
super.viewDidLoad()
title = urlRequest.url?.host

if allowsToOpenInSafari {
navigationItem.rightBarButtonItem = UIBarButtonItem(
image: Images.safariBarButtonItemImage,
style: UIBarButtonItemStyle.plain,
target: self,
action: #selector(WebViewController.didTapSafariButton(_:)))
navigationItem.rightBarButtonItem?.tintColor = UIColor.stepicGreenColor()
}

// navigationItem.rightBarButtonItem = UIBarButtonItem(
// barButtonSystemItem: .Action,
// target: self,
Expand All @@ -154,15 +163,6 @@ class WebViewController: UIViewController {
assert(navigationController != nil, "\(WebViewController.self) must be presented in a \(UINavigationController.self)")
super.viewWillAppear(animated)

if allowsToOpenInSafari {
navigationItem.rightBarButtonItem = UIBarButtonItem(
image: Images.safariBarButtonItemImage,
style: UIBarButtonItemStyle.plain,
target: self,
action: #selector(WebViewController.didTapSafariButton(_:)))
navigationItem.rightBarButtonItem?.tintColor = UIColor.mainDark
}

if presentingViewController?.presentedViewController != nil {
let doneItem = backButtonStyle.barButtonItem
doneItem.target = self
Expand Down
8 changes: 0 additions & 8 deletions PagerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,6 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI
_ = self.tabsView?.alignTrailingEdge(with: self.view, predicate: "0")
_ = self.tabsView?.constrainHeight("44")

let shadowView = UIView()
self.contentView.addSubview(shadowView)
shadowView.backgroundColor = UIColor.lightGray
_ = shadowView.constrainHeight("0.5")
_ = shadowView.alignTopEdge(with: contentView, predicate: "22")
_ = shadowView.alignLeadingEdge(with: contentView, predicate: "0")
_ = shadowView.alignTrailingEdge(with: contentView, predicate: "0")

// Set setup done
self.defaultSetupDone = true
}
Expand Down
144 changes: 37 additions & 107 deletions Stepic.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Stepic/AnalyticsEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ struct AnalyticsEvents {
static let toolbarSelected = "code_toolbar_selected"
static let hideKeyboard = "code_hide_keyboard"
}

struct Profile {
static let clickSettings = "main_choice_settings"
struct Settings {
Expand Down
3 changes: 0 additions & 3 deletions Stepic/ApplicationInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ class ApplicationInfo {
static let redirect = "password.redirect_uri"
}
}
struct Colors {
static let mainText = "colors.mainText"
}
}

private var settings: NSDictionary?
Expand Down
47 changes: 39 additions & 8 deletions Stepic/ArtView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

import Foundation

class ArtView: NibInitializableView {
class ArtView: UIView {

@IBOutlet weak var artImageView: UIImageView!
@IBOutlet weak var artImageViewWidth: NSLayoutConstraint!

var onTap : (() -> Void)?

var onTap : ((Void) -> Void)?
var art: UIImage? {
didSet {
artImageView.image = art
Expand All @@ -27,11 +27,7 @@ class ArtView: NibInitializableView {
}
}

override var nibName: String {
return "ArtView"
}

override func setupSubviews() {
private func initialize() {
artImageView.image = art
artImageView.isUserInteractionEnabled = true
let tapG = UITapGestureRecognizer(target: self, action: #selector(ArtView.didTap))
Expand All @@ -41,4 +37,39 @@ class ArtView: NibInitializableView {
func didTap() {
onTap?()
}

private var view: UIView!

private func setup() {
view = loadViewFromNib()
view.frame = bounds
view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
addSubview(view)
initialize()
}

private func loadViewFromNib() -> UIView {
let bundle = Bundle(for: type(of: self))
let nib = UINib(nibName: "ArtView", bundle: bundle)
let view = nib.instantiate(withOwner: self, options: nil)[0] as! UIView
return view
}

override init(frame: CGRect) {
// 1. setup any properties here

// 2. call super.init(frame:)
super.init(frame: frame)
setup()
}

required init?(coder aDecoder: NSCoder) {
// 1. setup any properties here

// 2. call super.init(coder:)
super.init(coder: aDecoder)

// 3. Setup view from .xib file
setup()
}
}
32 changes: 16 additions & 16 deletions Stepic/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<!--All Courses-->
<scene sceneID="Xcs-LO-Ogd">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="hRS-2a-8JM" customClass="StyledNavigationViewController" customModule="Adaptive_1838" customModuleProvider="target" sceneMemberID="viewController">
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="hRS-2a-8JM" customClass="GreenNavigationViewController" customModule="Stepic" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="All Courses" image="tab-find-courses" selectedImage="tab-find-courses" id="D6B-Zy-xmi"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="wyf-cv-uU2">
Expand All @@ -115,7 +115,7 @@
<!--My courses-->
<scene sceneID="Eot-ep-83N">
<objects>
<navigationController id="NxB-SA-EGM" customClass="StyledNavigationViewController" customModule="Adaptive_1838" customModuleProvider="target" sceneMemberID="viewController">
<navigationController id="NxB-SA-EGM" customClass="GreenNavigationViewController" customModule="Stepic" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="My courses" image="tab-my-courses" selectedImage="tab-my-courses" id="I8C-zf-fZb"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="nen-ML-6eo">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
Expand Down Expand Up @@ -613,7 +613,7 @@
<constraint firstAttribute="height" constant="50" id="Etj-Uj-4eI"/>
<constraint firstAttribute="width" constant="50" id="ahh-oE-9Rq"/>
</constraints>
<state key="normal" image="play_dark"/>
<state key="normal" image="stepic_play"/>
<connections>
<action selector="playButtonPressed:" destination="D75-Zh-Yxy" eventType="touchUpInside" id="pJi-Xm-63s"/>
</connections>
Expand Down Expand Up @@ -641,7 +641,7 @@
<rect key="frame" x="0.0" y="0.0" width="383" height="118.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Course name" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8q0-dk-g4x" customClass="StepikLabel" customModule="Adaptive_1838" customModuleProvider="target">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Course name" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8q0-dk-g4x">
<rect key="frame" x="8" y="8" width="367" height="27"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -714,7 +714,7 @@
</collectionViewFlowLayout>
<cells/>
</collectionView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Teachers" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yls-tG-Jse" customClass="StepikLabel" customModule="Adaptive_1838" customModuleProvider="target">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Teachers" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yls-tG-Jse">
<rect key="frame" x="16" y="8" width="359" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -783,11 +783,11 @@
<viewControllerLayoutGuide type="bottom" id="L7p-o7-VTy"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="z7c-c8-8wj">
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="L6O-ow-pfW">
<rect key="frame" x="0.0" y="0.0" width="375" height="554"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="618"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<navigationBar key="tableFooterView" contentMode="scaleToFill" id="OA9-cU-ctc">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
Expand Down Expand Up @@ -835,11 +835,11 @@
<viewControllerLayoutGuide type="bottom" id="dbc-fW-0PT"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="eEo-OZ-NVq">
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Q7F-3H-ipp">
<rect key="frame" x="0.0" y="0.0" width="375" height="554"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="618"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="dataSource" destination="8ik-tt-HOc" id="d6o-oi-Nnu"/>
Expand Down Expand Up @@ -909,7 +909,7 @@
<constraint firstAttribute="height" constant="50" id="5LT-2m-88H"/>
<constraint firstAttribute="width" constant="50" id="Pvt-Ch-E4a"/>
</constraints>
<state key="normal" image="play_dark"/>
<state key="normal" image="stepic_play"/>
<connections>
<action selector="playButtonPressed:" destination="3W9-IK-cIE" eventType="touchUpInside" id="kVm-QE-2Cq"/>
</connections>
Expand Down Expand Up @@ -1186,7 +1186,7 @@
<!--Downloads-->
<scene sceneID="Laj-7g-BZD">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="MT9-2h-A7A" customClass="StyledNavigationViewController" customModule="Adaptive_1838" customModuleProvider="target" sceneMemberID="viewController">
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="MT9-2h-A7A" customClass="GreenNavigationViewController" customModule="Stepic" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Downloads" image="tab-downloads" selectedImage="tab-downloads" id="Wmp-3r-xny"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="W60-es-dLX">
Expand All @@ -1200,12 +1200,12 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="KcB-yW-iiN" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="916" y="2163"/>
<point key="canvasLocation" x="917" y="2163"/>
</scene>
<!--Certificates-->
<scene sceneID="3uD-23-Gsy">
<objects>
<navigationController id="4bs-eV-3LS" customClass="StyledNavigationViewController" customModule="Adaptive_1838" customModuleProvider="target" sceneMemberID="viewController">
<navigationController id="4bs-eV-3LS" customClass="GreenNavigationViewController" customModule="Stepic" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Certificates" image="tab-certificates" selectedImage="tab-certificates" id="mwm-pG-FxV"/>
<nil key="simulatedBottomBarMetrics"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="E6m-D0-KUL">
Expand Down Expand Up @@ -1274,17 +1274,17 @@
<resources>
<image name="Circled User Male" width="25" height="25"/>
<image name="Info" width="25" height="25"/>
<image name="play_dark" width="154" height="154"/>
<image name="stepic_play" width="150" height="150"/>
<image name="success" width="28" height="28"/>
<image name="tab-certificates" width="25" height="25"/>
<image name="tab-downloads" width="20" height="22"/>
<image name="tab-find-courses" width="22" height="22"/>
<image name="tab-my-courses" width="26" height="26"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="nf5-of-tUO"/>
<segue reference="Had-eU-CRB"/>
<segue reference="ste-Lr-Bip"/>
<segue reference="bJP-cn-CC7"/>
<segue reference="gVj-jL-WXR"/>
<segue reference="LaP-cg-j2K"/>
</inferredMetricsTieBreakers>
</document>
33 changes: 29 additions & 4 deletions Stepic/Block+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,38 @@ extension Block {
}

var image: UIImage {
var resultName = "ic_theory"
switch (name) {
case "video" : return #imageLiteral(resourceName: "ic_video_dark")
case "text" : return #imageLiteral(resourceName: "ic_theory_dark")
case "code", "dataset", "admin" : return #imageLiteral(resourceName: "ic_hard_dark")
default: return #imageLiteral(resourceName: "ic_easy_dark")
case "animation" : resultName = "ic_animation"
case "video" : resultName = "video"
case "text" : resultName = "ic_theory"
case "code", "dataset", "admin" : resultName = "ic_admin"
default: resultName = "easy_quiz"
}

if let img = UIImage(named: resultName) {
return img
} else {
print("Unknown image name -> \(resultName)")
return UIImage(named: "ic_theory")!
}
}

// var image : UIImage {
// var resultName = "ic_theory"
// switch (name) {
// case "text" : resultName = "ic_theory"
// case "schulte" : resultName = "ic_table"
// default: resultName = "ic_\(name)"
// }
//
// if let img = UIImage(named: resultName) {
// return img
// } else {
// print("Unknown image name -> \(resultName)")
// return UIImage(named: "ic_theory")!
// }
// }
}

enum BlockTypes: String {
Expand Down
14 changes: 7 additions & 7 deletions Stepic/ButtonExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ extension UIButton {
// }
//
// func setEnabledJoined() {
// let attributedTitle = NSAttributedString(string: Constants.joinCourseButtonText, attributes: [NSForegroundColorAttributeName : UIColor.stepicGreen])
// let attributedTitle = NSAttributedString(string: Constants.joinCourseButtonText, attributes: [NSForegroundColorAttributeName : UIColor.stepicGreenColor()])
// setAttributedTitle(attributedTitle, for: UIControlState() )
// //enabled = false
// layer.borderColor = UIColor.stepicGreen.cgColor
// self.titleLabel?.textColor = UIColor.stepicGreen
// layer.borderColor = UIColor.stepicGreenColor().cgColor
// self.titleLabel?.textColor = UIColor.stepicGreenColor()
// }

func setStepicGreenStyle() {
self.setRoundedCorners(cornerRadius: 8.0, borderWidth: 0.0, borderColor: UIColor.mainDark)
self.setRoundedCorners(cornerRadius: 8.0, borderWidth: 0.0, borderColor: UIColor.stepicGreenColor())
self.setTitleColor(UIColor.white, for: UIControlState())
self.backgroundColor = UIColor.mainDark
self.backgroundColor = UIColor.stepicGreenColor()
}

func setStepicWhiteStyle() {
self.setRoundedCorners(cornerRadius: 8.0, borderWidth: 1.0, borderColor: UIColor.mainDark)
self.setTitleColor(UIColor.mainDark, for: UIControlState())
self.setRoundedCorners(cornerRadius: 8.0, borderWidth: 1.0, borderColor: UIColor.stepicGreenColor())
self.setTitleColor(UIColor.stepicGreenColor(), for: UIControlState())
self.backgroundColor = UIColor.white
}

Expand Down
7 changes: 4 additions & 3 deletions Stepic/CertificateTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import UIKit

class CertificateTableViewCell: UITableViewCell {

@IBOutlet weak var courseTitle: StepikLabel!
@IBOutlet weak var certificateDescription: StepikLabel!
@IBOutlet weak var certificateResult: StepikLabel!
@IBOutlet weak var courseTitle: UILabel!
@IBOutlet weak var certificateDescription: UILabel!
@IBOutlet weak var certificateResult: UILabel!
@IBOutlet weak var shareButton: UIButton!
@IBOutlet weak var courseImage: UIImageView!

Expand All @@ -23,6 +23,7 @@ class CertificateTableViewCell: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code

shareButton.setTitle(NSLocalizedString("Share", comment: ""), for: .normal)
}

Expand Down
Loading

0 comments on commit c699923

Please sign in to comment.