Skip to content

Commit

Permalink
Merge pull request #9 from StepicOrg/release/1.10
Browse files Browse the repository at this point in the history
Release/1.10
  • Loading branch information
Ostrenkiy authored Jun 17, 2016
2 parents a51f71e + 843e96b commit 90db1eb
Show file tree
Hide file tree
Showing 65 changed files with 3,032 additions and 367 deletions.
6 changes: 5 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ end

target 'Stepic' do
all_pods
target 'StepicTests' do
inherit! :search_paths
all_pods
end
end

target 'SberbankUniversity' do
all_pods
end
end
546 changes: 370 additions & 176 deletions Stepic.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>085D5CD81D007F2100092060</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>08D120731C937B2200A54ABC</key>
<dict>
<key>primary</key>
Expand Down
2 changes: 2 additions & 0 deletions Stepic/ApiDataDownloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ class ApiDataDownloader: NSObject {
}

static let devices : DevicesAPI = DevicesAPI()
static let discussionProxies : DiscussionProxiesAPI = DiscussionProxiesAPI()
static let comments : CommentsAPI = CommentsAPI()
}

enum RefreshMode {
Expand Down
22 changes: 22 additions & 0 deletions Stepic/ApiUtil.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// ApiUtil.swift
// Stepic
//
// Created by Alexander Karpov on 07.06.16.
// Copyright © 2016 Alex Karpov. All rights reserved.
//

import Foundation

class ApiUtil {
static func constructIdsString<TID>(array arr: [TID]) -> String {
var result = ""
for element in arr {
result += "ids[]=\(element)&"
}
if result != "" {
result.removeAtIndex(result.endIndex.predecessor())
}
return result
}
}
2 changes: 1 addition & 1 deletion Stepic/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
IQKeyboardManager.sharedManager().shouldResignOnTouchOutside = true
IQKeyboardManager.sharedManager().keyboardDistanceFromTextField = 24
IQKeyboardManager.sharedManager().enableAutoToolbar = false

setRootController()

if StepicApplicationsInfo.inAppUpdatesAvailable {
Expand Down
40 changes: 36 additions & 4 deletions Stepic/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -1559,18 +1559,40 @@
<action selector="playButtonPressed:" destination="3W9-IK-cIE" eventType="touchUpInside" id="kVm-QE-2Cq"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="68N-yM-TOn">
<rect key="frame" x="0.0" y="560" width="600" height="40"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gGz-5W-tsL">
<rect key="frame" x="243" y="5" width="114" height="30"/>
<state key="normal" title="Show comments"/>
<connections>
<action selector="showCommentsPressed:" destination="3W9-IK-cIE" eventType="touchUpInside" id="USr-4L-rxL"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="gGz-5W-tsL" firstAttribute="centerX" secondItem="68N-yM-TOn" secondAttribute="centerX" id="FoP-ka-iPV"/>
<constraint firstAttribute="height" constant="40" id="f61-MW-YzU"/>
<constraint firstItem="gGz-5W-tsL" firstAttribute="centerY" secondItem="68N-yM-TOn" secondAttribute="centerY" id="u4y-1j-AVL"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="mC4-nY-c6L" firstAttribute="centerX" secondItem="pKw-C7-Y9N" secondAttribute="centerX" id="6dR-Rr-VEP"/>
<constraint firstItem="pKw-C7-Y9N" firstAttribute="centerY" secondItem="eOu-jp-hBO" secondAttribute="centerY" id="GBF-9u-zUN"/>
<constraint firstAttribute="trailingMargin" secondItem="68N-yM-TOn" secondAttribute="trailing" constant="-20" id="JD8-OV-XB5"/>
<constraint firstItem="mC4-nY-c6L" firstAttribute="centerY" secondItem="pKw-C7-Y9N" secondAttribute="centerY" id="ML7-NF-DQL"/>
<constraint firstItem="SdS-Qz-hnr" firstAttribute="top" secondItem="68N-yM-TOn" secondAttribute="bottom" id="S77-te-WBv"/>
<constraint firstItem="68N-yM-TOn" firstAttribute="leading" secondItem="eOu-jp-hBO" secondAttribute="leadingMargin" constant="-20" id="ZCz-6K-0x8"/>
<constraint firstItem="pKw-C7-Y9N" firstAttribute="leading" secondItem="eOu-jp-hBO" secondAttribute="leading" id="mWm-l6-zSJ"/>
<constraint firstAttribute="trailing" secondItem="pKw-C7-Y9N" secondAttribute="trailing" id="pP8-h4-HdZ"/>
</constraints>
</view>
<connections>
<outlet property="playButton" destination="mC4-nY-c6L" id="PYp-XO-Z93"/>
<outlet property="showCommentsButton" destination="gGz-5W-tsL" id="fz5-SM-jDA"/>
<outlet property="thumbnailImageView" destination="pKw-C7-Y9N" id="2b7-YI-pg3"/>
</connections>
</viewController>
Expand Down Expand Up @@ -1651,7 +1673,7 @@
<rect key="frame" x="0.0" y="21" width="600" height="579"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pp4-VH-jhD">
<rect key="frame" x="0.0" y="0.0" width="600" height="32"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="78"/>
<subviews>
<webView contentMode="scaleToFill" suppressesIncrementalRendering="YES" translatesAutoresizingMaskIntoConstraints="NO" id="emi-b6-GHx">
<rect key="frame" x="0.0" y="0.0" width="600" height="1"/>
Expand All @@ -1666,15 +1688,24 @@
<constraint firstAttribute="height" constant="32" id="fD4-kU-l4I"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vwu-ht-kAN">
<rect key="frame" x="243" y="40" width="114" height="30"/>
<state key="normal" title="Show comments"/>
<connections>
<action selector="showCommentsPressed:" destination="OsI-th-C1R" eventType="touchUpInside" id="xf3-5v-xvi"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="cY6-uB-D81" firstAttribute="leading" secondItem="pp4-VH-jhD" secondAttribute="leading" id="3GV-fJ-hPz"/>
<constraint firstAttribute="bottom" secondItem="cY6-uB-D81" secondAttribute="bottom" id="Ah3-JP-xfs"/>
<constraint firstAttribute="bottom" secondItem="Vwu-ht-kAN" secondAttribute="bottom" constant="8" id="AAL-7Q-HCI"/>
<constraint firstItem="cY6-uB-D81" firstAttribute="top" secondItem="emi-b6-GHx" secondAttribute="bottom" constant="-1" id="DvZ-wU-sTq"/>
<constraint firstItem="Vwu-ht-kAN" firstAttribute="top" secondItem="cY6-uB-D81" secondAttribute="bottom" constant="8" id="GK9-eK-OfD"/>
<constraint firstItem="emi-b6-GHx" firstAttribute="top" secondItem="pp4-VH-jhD" secondAttribute="top" id="LIL-rg-mOB"/>
<constraint firstItem="emi-b6-GHx" firstAttribute="leading" secondItem="pp4-VH-jhD" secondAttribute="leading" id="SVq-w0-3Vg"/>
<constraint firstAttribute="trailing" secondItem="cY6-uB-D81" secondAttribute="trailing" id="UZN-cH-TvZ"/>
<constraint firstItem="Vwu-ht-kAN" firstAttribute="centerX" secondItem="pp4-VH-jhD" secondAttribute="centerX" id="mU9-JQ-44u"/>
<constraint firstAttribute="trailing" secondItem="emi-b6-GHx" secondAttribute="trailing" id="qPs-uE-8iy"/>
</constraints>
</view>
Expand All @@ -1700,13 +1731,14 @@
<outlet property="contentView" destination="pp4-VH-jhD" id="pPT-Gh-1iK"/>
<outlet property="quizPlaceholderView" destination="cY6-uB-D81" id="2LX-s0-szN"/>
<outlet property="quizPlaceholderViewHeight" destination="fD4-kU-l4I" id="Jmx-0a-DZb"/>
<outlet property="showCommentsButton" destination="Vwu-ht-kAN" id="kbo-Yt-xRn"/>
<outlet property="stepWebView" destination="emi-b6-GHx" id="YHK-7Z-rBj"/>
<outlet property="stepWebViewHeight" destination="vIx-sL-U1Q" id="UJJ-me-Eyb"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="RLq-xB-Eqy" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="5606" y="2609"/>
<point key="canvasLocation" x="5674" y="2607"/>
</scene>
<!--My courses-->
<scene sceneID="Qyk-4b-RfK">
Expand Down
43 changes: 43 additions & 0 deletions Stepic/CellOperationsUtil.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// CellOperationsUtil.swift
// Stepic
//
// Created by Alexander Karpov on 14.06.16.
// Copyright © 2016 Alex Karpov. All rights reserved.
//

import Foundation
import UIKit
import FLKAutoLayout

/*
Some custom cell operation util functions
*/
class CellOperationsUtil {

class func addRefreshView(view: UIView, backgroundColor: UIColor = UIColor.whiteColor()) -> UIView {
let v = UIView()
v.backgroundColor = backgroundColor
let ind = UIActivityIndicatorView(activityIndicatorStyle: .Gray)
v.addSubview(ind)
ind.alignCenterWithView(v)
ind.startAnimating()
view.addSubview(v)
v.alignToView(view)
return v
}

//Returns the removeSelection block
class func animateViewSelection(view: UIView) -> (Void->Void) {
let selectedColor = UIColor(red: 217/255.0, green: 217/255.0, blue: 217/255.0, alpha: 1).CGColor
UIView.animateWithDuration(0.5, animations: {
view.layer.backgroundColor = selectedColor
})

return {
UIView.animateWithDuration(0.5, animations: {
view.layer.backgroundColor = UIColor.whiteColor().CGColor
})
}
}
}
4 changes: 3 additions & 1 deletion Stepic/CellWebViewHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class CellWebViewHelper {
let scriptsString = "\(Scripts.localTexScript)"
let html = HTMLBuilder.sharedBuilder.buildHTMLStringWith(head: scriptsString, body: text, addStyle: true, textColorHex: textColorHex)
webView.loadHTMLString(html, baseURL: NSURL(fileURLWithPath: NSBundle.mainBundle().bundlePath))

return {
[weak self] in
if let cw = self?.webView {
Expand All @@ -46,5 +45,8 @@ class CellWebViewHelper {
}
}

deinit {
print("deinit helper")
}

}
60 changes: 60 additions & 0 deletions Stepic/ChoiceQuizLabelTableViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// ChoiceQuizLabelTableViewCell.swift
// Stepic
//
// Created by Alexander Karpov on 20.01.16.
// Copyright © 2016 Alex Karpov. All rights reserved.
//

import UIKit
import BEMCheckBox
import FLKAutoLayout

class ChoiceQuizLabelTableViewCell: ChoiceQuizTableViewCell {

var choiceLabel: UILabel! = UILabel()

override var reuseIdentifier: String? {
return "ChoiceQuizLabelTableViewCell"
}

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
// let x = NSBundle.mainBundle().loadNibNamed("ChoiceQuizTableViewCell", owner: self, options: nil)[0]
// print(x)
initialize()
}

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initialize()
}

func initialize() {
choiceLabel.numberOfLines = 0
choiceLabel.font = UIFont(name: "ArialMT", size: 16)
choiceLabel.lineBreakMode = NSLineBreakMode.ByTruncatingTail
choiceLabel.baselineAdjustment = UIBaselineAdjustment.AlignBaselines
choiceLabel.textAlignment = NSTextAlignment.Natural
// textContainerView.addSubview(choiceLabel)
// choiceLabel.alignToView(textContainerView)
// print(choiceLabel.text)
}

override func awakeFromNib() {
super.awakeFromNib()
initialize()
}

override func setHTMLText(text: String) -> (Void -> Int) {
choiceLabel.setTextWithHTMLString(text)
return {
return max(27, Int(UILabel.heightForLabelWithText(text, lines: 0, fontName: "ArialMT", fontSize: 16, width: UIScreen.mainScreen().bounds.width - 60))) + 17
}
}

override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
}

Loading

0 comments on commit 90db1eb

Please sign in to comment.