Skip to content

Commit

Permalink
Merge pull request #282 from StepicOrg/release/1.57
Browse files Browse the repository at this point in the history
Release 1.57
  • Loading branch information
Ostrenkiy authored Apr 24, 2018
2 parents 248d848 + d4ade01 commit 5a239a7
Show file tree
Hide file tree
Showing 161 changed files with 2,382 additions and 1,498 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ Preview.html
Carthage/Build

.DS_Store

# AppCode
.idea/
24 changes: 16 additions & 8 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def all_pods
pod 'SVProgressHUD'
pod 'FLKAutoLayout', '1.0.1'
pod 'TSMessages', :git => 'https://github.com/KrauseFx/TSMessages.git'
pod 'YandexMobileMetrica/Dynamic'
pod 'YandexMobileMetrica/Dynamic', '~> 3.0.0'

pod 'FirebaseCore'
pod 'FirebaseAppIndexing'
Expand All @@ -35,7 +35,10 @@ def all_pods
pod 'Mixpanel-swift', '2.3.0'

pod 'BEMCheckBox'
pod 'IQKeyboardManagerSwift'

# actual version - 6.x, we should test it before update
pod 'IQKeyboardManagerSwift', '~> 5.0'

pod 'Kanna', '~> 4.0.0'
pod 'CRToast', :git => 'https://github.com/cruffenach/CRToast.git', :branch => 'master'
pod 'TUSafariActivity', '~> 1.0'
Expand Down Expand Up @@ -65,8 +68,11 @@ def testing_pods
pod 'Nimble'
end

def main_pods
pod 'Appsee'
end

def adaptive_pods
pod 'Koloda', '4.3.1'
pod 'SDWebImage/GIF'
pod 'NotificationBannerSwift', '1.5.2'
end
Expand All @@ -77,6 +83,7 @@ target 'Stepic' do
target 'StepicTests' do
inherit! :search_paths
all_pods
main_pods
testing_pods
end
end
Expand All @@ -91,11 +98,6 @@ target 'StepikTV' do
end
end

target 'SberbankUniversity' do
platform :ios, '9.0'
all_pods
end

target 'Adaptive 1838' do
platform :ios, '9.0'
all_pods
Expand Down Expand Up @@ -126,6 +128,12 @@ target 'Adaptive 3124' do
adaptive_pods
end

target 'Adaptive 8290' do
platform :ios, '9.0'
all_pods
adaptive_pods
end

target 'Adaptive 1838 Screenshots' do
pod 'SimulatorStatusMagic', :configurations => ['Debug']
end
Expand Down
Binary file removed Sb/GoogleService-Info.plist
Binary file not shown.
Binary file removed Sb/SbAppDelegate.swift
Binary file not shown.
Binary file removed Sb/SbAuth.storyboard
Binary file not shown.
Binary file removed Sb/SbControllerHelperLaunchExtension.swift
Binary file not shown.
Binary file removed Sb/SbEntranceViewController.swift
Binary file not shown.
Binary file removed Sb/SbEntranceViewController.xib
Binary file not shown.
Binary file removed Sb/SbLaunchScreen.xib
Binary file not shown.
Binary file removed Sb/SbSocialNetworks.swift
Binary file not shown.
Binary file removed Sb/SbStepicApplicationsInfo.swift
Binary file not shown.
Binary file removed Sb/SberbankUniversity-Info.plist
Binary file not shown.
Binary file removed Sb/SberbankUniversity.entitlements
Binary file not shown.
Binary file removed Sb/SberbankUniversity.xcassets/Contents.json
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2,583 changes: 1,444 additions & 1,139 deletions Stepic.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions Stepic.xcodeproj/xcshareddata/xcschemes/Adaptive 8290.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2CA8D1392088D9C000E105E9"
BuildableName = "Adaptive 8290.app"
BlueprintName = "Adaptive 8290"
ReferencedContainer = "container:Stepic.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2CA8D1392088D9C000E105E9"
BuildableName = "Adaptive 8290.app"
BlueprintName = "Adaptive 8290"
ReferencedContainer = "container:Stepic.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2CA8D1392088D9C000E105E9"
BuildableName = "Adaptive 8290.app"
BlueprintName = "Adaptive 8290"
ReferencedContainer = "container:Stepic.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2CA8D1392088D9C000E105E9"
BuildableName = "Adaptive 8290.app"
BlueprintName = "Adaptive 8290"
ReferencedContainer = "container:Stepic.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
8 changes: 8 additions & 0 deletions Stepic.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 1 addition & 3 deletions Stepic/APIEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ class APIEndpoint {
var retrieve: RetrieveRequestMaker

init() {
let configuration = URLSessionConfiguration.default
configuration.timeoutIntervalForRequest = 15
manager = Alamofire.SessionManager(configuration: configuration)
manager = Alamofire.SessionManager(configuration: StepikURLSessionConfiguration.default)
let retrier = ApiRequestRetrier()
manager.retrier = retrier
manager.adapter = retrier
Expand Down
13 changes: 13 additions & 0 deletions Stepic/AlamofireDefaultSessionManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// AlamofireDefaultSessionManager.swift
// Stepic
//
// Created by Vladislav Kiryukhin on 16.04.2018.
// Copyright © 2018 Alex Karpov. All rights reserved.
//

import Alamofire

class AlamofireDefaultSessionManager: Alamofire.SessionManager {
static let shared = Alamofire.SessionManager(configuration: StepikURLSessionConfiguration.default)
}
5 changes: 4 additions & 1 deletion Stepic/AnalyticsHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ class AnalyticsHelper: NSObject {

func setupAnalytics() {
Fabric.with([Crashlytics.self])

FirebaseApp.configure()

Mixpanel.initialize(token: Tokens.shared.mixpanelToken)

YMMYandexMetrica.activate(withApiKey: Tokens.shared.appMetricaToken)
if let config = YMMYandexMetricaConfiguration(apiKey: Tokens.shared.appMetricaToken) {
YMMYandexMetrica.activate(with: config)
}
}
}
1 change: 1 addition & 0 deletions Stepic/ApiRequestRetrier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class ApiRequestRetrier: RequestRetrier, RequestAdapter {

func adapt(_ urlRequest: URLRequest) throws -> URLRequest {
var urlRequest = urlRequest

for (headerField, value) in AuthInfo.shared.initialHTTPHeaders {
urlRequest.setValue(value, forHTTPHeaderField: headerField)
}
Expand Down
2 changes: 1 addition & 1 deletion Stepic/AttemptsAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AttemptsAPI: APIEndpoint {
print("no user id!")
}

return Alamofire.request("\(StepicApplicationsInfo.apiURL)/attempts", method: .get, parameters: params, encoding: URLEncoding.default, headers: headers).responseSwiftyJSON({
return manager.request("\(StepicApplicationsInfo.apiURL)/attempts", method: .get, parameters: params, encoding: URLEncoding.default, headers: headers).responseSwiftyJSON({
response in

var error = response.result.error
Expand Down
2 changes: 1 addition & 1 deletion Stepic/AvatarImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AvatarImageView: UIImageView {
if url.pathExtension != "svg" {
self.sd_setImage(with: url, placeholderImage: self.image)
} else {
Alamofire.request(url).responseData(completionHandler: { response in
AlamofireDefaultSessionManager.shared.request(url).responseData(completionHandler: { response in
if response.result.error != nil {
return
}
Expand Down
42 changes: 36 additions & 6 deletions Stepic/BaseCardsStepsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ class BaseCardsStepsViewController: CardsStepsViewController {
var course: Course!
var didJustSubscribe: Bool = false

override var state: CardsStepsViewState {
set {
super.state = newValue
if newValue != .normal {
bringElementsToFront()
} else {
sendElementsToBack()
}
}
get {
return super.state
}
}

override func viewDidLoad() {
super.viewDidLoad()

Expand All @@ -38,12 +52,7 @@ class BaseCardsStepsViewController: CardsStepsViewController {
view.insertSubview(padView, at: 0)
}

trophyButton.layer.zPosition = kolodaView.layer.zPosition - 1
backButton.layer.zPosition = kolodaView.layer.zPosition - 1
statusBarPad?.layer.zPosition = kolodaView.layer.zPosition - 1
progressBar.layer.zPosition = kolodaView.layer.zPosition - 1
labelsStackView.layer.zPosition = kolodaView.layer.zPosition - 1
shadowView.layer.zPosition = kolodaView.layer.zPosition - 1
sendElementsToBack()

progressBar.progress = 0

Expand Down Expand Up @@ -170,4 +179,25 @@ class BaseCardsStepsViewController: CardsStepsViewController {
shouldToggleNavigationBar = true
super.presentDiscussions(stepId: stepId, discussionProxyId: discussionProxyId)
}

private func changeZPositionForElements(change: CGFloat, relativeTo layer: CALayer) {
trophyButton.layer.zPosition = layer.zPosition + change
backButton.layer.zPosition = layer.zPosition + change
statusBarPad?.layer.zPosition = layer.zPosition + change
progressBar.layer.zPosition = layer.zPosition + change
labelsStackView.layer.zPosition = layer.zPosition + change
shadowView.layer.zPosition = layer.zPosition + change
}

private func bringElementsToFront() {
backButton.superview?.bringSubview(toFront: backButton)
trophyButton.superview?.bringSubview(toFront: trophyButton)

changeZPositionForElements(change: 1.0, relativeTo: placeholderContainer.placeholderView.layer)
}

private func sendElementsToBack() {
changeZPositionForElements(change: -1.0, relativeTo: kolodaView.layer)
}

}
29 changes: 25 additions & 4 deletions Stepic/CardStepPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CardStepPresenter {
return step.lesson
}

var quizViewController: ChoiceQuizViewController?
var quizViewController: QuizViewController?

init(view: CardStepView, step: Step) {
self.step = step
Expand All @@ -49,7 +49,22 @@ class CardStepPresenter {
view?.updateProblem(with: step.block.text ?? "")

// Set up quiz view controller
quizViewController = ChoiceQuizViewController(nibName: "QuizViewController", bundle: nil)
switch step.block.name {
case "choice":
quizViewController = ChoiceQuizViewController(nibName: "QuizViewController", bundle: nil)
case "string":
let vc = StringQuizViewController(nibName: "QuizViewController", bundle: nil)
vc.useSmallPadding = true
vc.textView.placeholder = NSLocalizedString("StringInputTextFieldPlaceholder", comment: "")
quizViewController = vc
case "number":
let vc = NumberQuizViewController(nibName: "QuizViewController", bundle: nil)
vc.useSmallPadding = true
vc.textField.placeholder = NSLocalizedString("NumberInputTextFieldPlaceholder", comment: "")
quizViewController = vc
default: break
}

guard let quizViewController = quizViewController else {
print("card step: quiz vc init failed")
delegate?.contentLoadingDidFail()
Expand All @@ -69,9 +84,15 @@ class CardStepPresenter {
}

func submit() {
// TODO: this check only for choices
var isSelected = false
quizViewController?.choices.forEach { isSelected = isSelected || $0 }

switch step.block.name {
case "choice":
(quizViewController as? ChoiceQuizViewController)?.choices.forEach { isSelected = isSelected || $0 }
case "string", "number":
isSelected = true
default: break
}

if isSelected {
quizViewController?.submitPressed()
Expand Down
2 changes: 1 addition & 1 deletion Stepic/CardStepViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class CardStepViewController: UIViewController, CardStepView {
}
}

private func refreshWebView() {
func refreshWebView() {
resetWebViewHeight(5.0)

func reloadContent() -> Promise<Void> {
Expand Down
2 changes: 1 addition & 1 deletion Stepic/CardsStepsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CardsStepsViewController: UIViewController, CardsStepsView, ControllerWith
override func viewDidLoad() {
super.viewDidLoad()

registerPlaceholder(placeholder: StepikPlaceholder(.noConnection, action: { [weak self] in
registerPlaceholder(placeholder: StepikPlaceholder(.noConnectionQuiz, action: { [weak self] in
self?.presenter?.tryAgain()
}), for: .connectionError)

Expand Down
Loading

0 comments on commit 5a239a7

Please sign in to comment.