Skip to content

Commit

Permalink
Merge pull request #37 from StepicOrg/release/1.32
Browse files Browse the repository at this point in the history
Release/1.32
  • Loading branch information
Ostrenkiy authored Apr 19, 2017
2 parents d9e8075 + 5c7eab9 commit 9ffbf7c
Show file tree
Hide file tree
Showing 245 changed files with 4,259 additions and 1,263 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Sb/** filter=git-crypt diff=git-crypt
cert/** filter=git-crypt diff=git-crypt
fastlane/** filter=git-crypt diff=git-crypt
StepicTests/TestInfo.plist filter=git-crypt diff=git-crypt
.gitattributes !filter !diff
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ DerivedData
Pods/
artefacts/
fastlane/screenshots/
fastlane/report.xml
*.lock
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

.DS_Store
17 changes: 17 additions & 0 deletions DefaultsContainer.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// DefaultsContainer.swift
// Stepic
//
// Created by Alexander Karpov on 07.04.17.
// Copyright © 2017 Alex Karpov. All rights reserved.
//

import Foundation

/*
Used to store application data, generated by an app
*/
class DefaultsContainer {
private init() {}
static let launch = LaunchDefaultsContainer()
}
2 changes: 1 addition & 1 deletion JSQWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class WebViewController: UIViewController {
/// :nodoc:
required init?(coder aDecoder: NSCoder) {
self.configuration = WKWebViewConfiguration()
self.urlRequest = URLRequest(url: NSURL(string: "") as! URL)
self.urlRequest = URLRequest(url: NSURL(string: "")! as URL)
self.activities = nil
super.init(coder: aDecoder)
}
Expand Down
30 changes: 30 additions & 0 deletions LaunchDefaultsContainer.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// LaunchDefaultsContainer.swift
// Stepic
//
// Created by Alexander Karpov on 07.04.17.
// Copyright © 2017 Alex Karpov. All rights reserved.
//

import Foundation

class LaunchDefaultsContainer {
fileprivate let defaults = UserDefaults.standard

fileprivate let didLaunchKey = "didLaunchKey"

var didLaunch : Bool {
get {
if let did = defaults.value(forKey: didLaunchKey) as? Bool {
return did
} else {
return false
}
}

set(value) {
defaults.set(value, forKey: didLaunchKey)
defaults.synchronize()
}
}
}
8 changes: 8 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,21 @@ def all_pods
pod 'FBSDKLoginKit'

pod 'SVGKit', :git => 'https://github.com/SVGKit/SVGKit.git', :branch => '2.x'

pod 'Presentr'
end

def testing_pods
pod 'Quick'
pod 'Nimble'
end

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

Expand Down
Binary file modified Sb/SbEntranceViewController.swift
Binary file not shown.
Binary file modified Sb/SberbankUniversity-Info.plist
Binary file not shown.
531 changes: 351 additions & 180 deletions Stepic.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>StepicTests.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>31</integer>
</dict>
<key>StepicWatch (Complication).xcscheme</key>
<dict>
<key>orderHint</key>
Expand Down
9 changes: 6 additions & 3 deletions Stepic/APIEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import Alamofire
import SwiftyJSON
import CoreData

enum RetrieveError : Error {
case connectionError, badStatus
}

class APIEndpoint {

func constructIdsString<TID>(array arr: [TID]) -> String {
Expand Down Expand Up @@ -53,16 +57,15 @@ class APIEndpoint {
print(json)
}

print(json)

if let e = error as? NSError {
if let e = error as NSError? {
print("RETRIEVE \(requestString)?\(ids): error \(e.domain) \(e.code): \(e.localizedDescription)")
failure(.connectionError)
return
}

if response?.statusCode != 200 {
print("RETRIEVE \(requestString)?\(ids)): bad response status code \(response?.statusCode)")
print("RETRIEVE \(requestString)?\(ids)): bad response status code \(String(describing: response?.statusCode))")
failure(.badStatus)
return
}
Expand Down
1 change: 1 addition & 0 deletions Stepic/Alerts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ import Foundation
*/
class Alerts {
static let streaks = StreaksStepikAlertManager()
static let rate = RateAppAlertManager()
}
49 changes: 47 additions & 2 deletions Stepic/AnalyticsEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,26 @@ struct AnalyticsEvents {

struct SignIn {
static let onLaunchScreen = "clicked_SignIn_on_launch_screen"
static let onSignInScreen = "clicked_SignIn_on_sign_in_screen"
static let onSignInScreen = "click_sign_in_with_interaction_type"
static let nextButton = "click_sign_in_next_sign_in_screen"
struct Fields {
static let tap = "tap_on_fields_login"
static let typing = "typing_text_fields_login"
}
struct Social {
static let clicked = "social_login"
static let codeReceived = "Api:auth with social account"
}
}

struct SignUp {
static let onLaunchScreen = "clicked_SignUp_on_launch_screen"
static let onSignUpScreen = "clicked_SignUp_on_sign_up_screen"
static let onSignUpScreen = "click_registration_with_interaction_type"
static let nextButton = "click_registration_send_ime"
struct Fields {
static let tap = "tap_on_fields_registration"
static let typing = "typing_text_fields_registration"
}
}

struct Login {
Expand Down Expand Up @@ -96,6 +108,7 @@ struct AnalyticsEvents {
static let myCoursesClicked = "main_choice_my_courses"
static let findCoursesClicked = "main_choice_find_courses"
static let downloadsClicked = "main_choice_downloads"
static let certificatesClicked = "main_choice_certificates"
}

struct Token {
Expand All @@ -114,10 +127,21 @@ struct AnalyticsEvents {
}
}
static let notificationOpened = "streak_notification_opened"

struct LocalNotification {
static let shown = "streak_local_notification_shown"
static let clicked = "streak_local_notification_clicked"
}
struct ImproveAlert {
static let notificationOffered = "streak_improve_alert_notifications_offered"
static let timeSelected = "streak_improve_alert_time_selected"
static let timeCancelled = "streak_improve_alert_time_cancelled"
}
}

struct App {
static let opened = "app_opened"
static let firstLaunch = "first_launch_after_install"
}

struct Errors {
Expand All @@ -128,4 +152,25 @@ struct AnalyticsEvents {
static let sectionsOpened = "continue_section_opened"
static let stepOpened = "continue_step_opened"
}

struct Rate {
static let rated = "app_rate"
struct Positive {
static let later = "app_rate_positive_later"
static let appstore = "app_rate_positive_appstore"
}
struct Negative {
static let later = "app_rate_negative_later"
static let email = "app_rate_negative_email"
struct Email {
static let cancelled = "app_rate_negative_email_cancelled"
static let success = "app_rate_negative_email_success"
}
}
}

struct Certificates {
static let opened = "certificates_opened_certificate"
static let shared = "certificates_pressed_share_certificate"
}
}
13 changes: 9 additions & 4 deletions Stepic/AnalyticsReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ import Mixpanel
import YandexMobileMetrica

class AnalyticsReporter {
static func reportEvent(_ event: String, parameters: [String: NSObject]?) {
reportFirebaseEvent(event, parameters: parameters)
reportAppMetricaEvent(event, parameters: parameters)
reportMixpanelEvent(event, parameters: parameters)
static func reportEvent(_ event: String, parameters: [String: Any]? = nil) {

guard let params = parameters as? [String: NSObject] else {
return
}

reportFirebaseEvent(event, parameters: params)
reportAppMetricaEvent(event, parameters: params)
reportMixpanelEvent(event, parameters: params)
}

private static func reportFirebaseEvent(_ event: String, parameters: [String: NSObject]?) {
Expand Down
Loading

0 comments on commit 9ffbf7c

Please sign in to comment.