Skip to content

Commit

Permalink
Merge pull request #1130 from StepicOrg/release/1.213
Browse files Browse the repository at this point in the history
Release 1.213
  • Loading branch information
ivan-magda authored Mar 10, 2022
2 parents 02a0478 + fcc0fbd commit afafd73
Show file tree
Hide file tree
Showing 30 changed files with 852 additions and 71 deletions.
28 changes: 15 additions & 13 deletions Stepic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2692,6 +2692,7 @@
2C57B2A0240945B2008284F0 /* SubmissionsRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubmissionsRepository.swift; sourceTree = "<group>"; };
2C580B802754FE7800BAEE60 /* WishlistEntriesPersistenceService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WishlistEntriesPersistenceService.swift; sourceTree = "<group>"; };
2C5967EA23E7828800072800 /* SubmissionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubmissionTests.swift; sourceTree = "<group>"; };
2C5A92FE27D75A4C0086559D /* Model_course_update_purchase_button_behavior_v95.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model_course_update_purchase_button_behavior_v95.xcdatamodel; sourceTree = "<group>"; };
2C5AB2B122F9BC78005E7AA0 /* Model_step_options_limits.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model_step_options_limits.xcdatamodel; sourceTree = "<group>"; };
2C5B3812257280C6007BF21E /* AuthorsCourseListWidgetCoverView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthorsCourseListWidgetCoverView.swift; sourceTree = "<group>"; };
2C5BE9DB233C0A100098EB2F /* katex */ = {isa = PBXFileReference; lastKnownFileType = folder; path = katex; sourceTree = "<group>"; };
Expand Down Expand Up @@ -13068,7 +13069,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 419;
CURRENT_PROJECT_VERSION = 423;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = UJ4KC2QN7B;
INFOPLIST_FILE = "StickerPackExtension/Info-Production.plist";
Expand All @@ -13093,7 +13094,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 419;
CURRENT_PROJECT_VERSION = 423;
DEVELOPMENT_TEAM = UJ4KC2QN7B;
INFOPLIST_FILE = "StickerPackExtension/Info-Production.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
Expand Down Expand Up @@ -13235,7 +13236,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 419;
CURRENT_PROJECT_VERSION = 423;
DEVELOPMENT_TEAM = UJ4KC2QN7B;
ENABLE_BITCODE = YES;
INFOPLIST_FILE = "Stepic/Info-Production.plist";
Expand Down Expand Up @@ -13265,7 +13266,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 419;
CURRENT_PROJECT_VERSION = 423;
DEVELOPMENT_TEAM = UJ4KC2QN7B;
ENABLE_BITCODE = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
Expand Down Expand Up @@ -13356,7 +13357,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 419;
CURRENT_PROJECT_VERSION = 423;
DEVELOPMENT_TEAM = UJ4KC2QN7B;
ENABLE_BITCODE = YES;
INFOPLIST_FILE = "Stepic/Info-Develop.plist";
Expand Down Expand Up @@ -13408,7 +13409,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 419;
CURRENT_PROJECT_VERSION = 423;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = UJ4KC2QN7B;
INFOPLIST_FILE = "StickerPackExtension/Info-Develop.plist";
Expand Down Expand Up @@ -13489,7 +13490,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 419;
CURRENT_PROJECT_VERSION = 423;
DEVELOPMENT_TEAM = UJ4KC2QN7B;
ENABLE_BITCODE = YES;
INFOPLIST_FILE = "Stepic/Info-Develop.plist";
Expand Down Expand Up @@ -13537,7 +13538,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 419;
CURRENT_PROJECT_VERSION = 423;
DEVELOPMENT_TEAM = UJ4KC2QN7B;
INFOPLIST_FILE = "StickerPackExtension/Info-Develop.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
Expand Down Expand Up @@ -14057,7 +14058,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 419;
CURRENT_PROJECT_VERSION = 423;
DEVELOPMENT_TEAM = UJ4KC2QN7B;
ENABLE_BITCODE = YES;
INFOPLIST_FILE = "Stepic/Info-Release.plist";
Expand Down Expand Up @@ -14111,7 +14112,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 419;
CURRENT_PROJECT_VERSION = 423;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = UJ4KC2QN7B;
INFOPLIST_FILE = "StickerPackExtension/Info-Release.plist";
Expand Down Expand Up @@ -14193,7 +14194,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 419;
CURRENT_PROJECT_VERSION = 423;
DEVELOPMENT_TEAM = UJ4KC2QN7B;
ENABLE_BITCODE = YES;
INFOPLIST_FILE = "Stepic/Info-Release.plist";
Expand Down Expand Up @@ -14241,7 +14242,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 419;
CURRENT_PROJECT_VERSION = 423;
DEVELOPMENT_TEAM = UJ4KC2QN7B;
INFOPLIST_FILE = "StickerPackExtension/Info-Release.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
Expand Down Expand Up @@ -14714,6 +14715,7 @@
08D1EF6E1BB5618700BE84E6 /* Model.xcdatamodeld */ = {
isa = XCVersionGroup;
children = (
2C5A92FE27D75A4C0086559D /* Model_course_update_purchase_button_behavior_v95.xcdatamodel */,
2C9E699127ABFFB40090FC83 /* Model_course_acquired_skills_v94.xcdatamodel */,
2C97FFF9278CB90600EC7E74 /* Model_course_revenue_fixes_v93.xcdatamodel */,
2CED149D2756D83E00BB013D /* Model_mobile_tiers_v92.xcdatamodel */,
Expand Down Expand Up @@ -14810,7 +14812,7 @@
0802AC531C7222B200C4F3E6 /* Model_v2.xcdatamodel */,
08D1EF6F1BB5618700BE84E6 /* Model.xcdatamodel */,
);
currentVersion = 2C9E699127ABFFB40090FC83 /* Model_course_acquired_skills_v94.xcdatamodel */;
currentVersion = 2C5A92FE27D75A4C0086559D /* Model_course_update_purchase_button_behavior_v95.xcdatamodel */;
path = Model.xcdatamodeld;
sourceTree = "<group>";
versionGroupType = wrapper.xcdatamodel;
Expand Down
4 changes: 2 additions & 2 deletions Stepic/Info-Develop.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.212-develop</string>
<string>1.213-develop</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down Expand Up @@ -62,7 +62,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>419</string>
<string>423</string>
<key>FacebookAppID</key>
<string>171127739724012</string>
<key>FacebookDisplayName</key>
Expand Down
4 changes: 2 additions & 2 deletions Stepic/Info-Production.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.212</string>
<string>1.213</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down Expand Up @@ -62,7 +62,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>419</string>
<string>423</string>
<key>FacebookAppID</key>
<string>171127739724012</string>
<key>FacebookDisplayName</key>
Expand Down
4 changes: 2 additions & 2 deletions Stepic/Info-Release.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.212-release</string>
<string>1.213-release</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down Expand Up @@ -62,7 +62,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>419</string>
<string>423</string>
<key>FacebookAppID</key>
<string>171127739724012</string>
<key>FacebookDisplayName</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class PersonalDeadlinesService: PersonalDeadlinesServiceProtocol {
}

func canAddDeadlines(in course: Course) -> Bool {
course.sectionDeadlines == nil && course.scheduleType == "self_paced"
course.sectionDeadlines == nil && course.scheduleType == .selfPaced
}

func hasDeadlines(in course: Course) -> Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ extension Course {
@NSManaged var managedFeatured: NSNumber?
@NSManaged var managedPublic: NSNumber?
@NSManaged var managedIsProctored: NSNumber?
@NSManaged var managedIsEnabled: NSNumber
@NSManaged var managedIsFavorite: NSNumber?
@NSManaged var managedIsArchived: NSNumber?
@NSManaged var managedIsInWishlist: NSNumber?
Expand Down Expand Up @@ -64,6 +65,8 @@ extension Course {

@NSManaged var managedCanViewRevenue: NSNumber?
@NSManaged var managedCanCreateAnnouncements: NSNumber
@NSManaged var managedCanEditCourse: NSNumber
@NSManaged var managedCanBeBought: NSNumber

// MARK: Relationships
@NSManaged var managedAuthors: NSOrderedSet?
Expand Down Expand Up @@ -153,12 +156,12 @@ extension Course {
}
}

var scheduleType: String? {
set(value) {
self.managedScheduleType = value
}
var scheduleTypeString: String? {
get {
managedScheduleType
self.managedScheduleType
}
set {
self.managedScheduleType = newValue
}
}

Expand Down Expand Up @@ -270,6 +273,15 @@ extension Course {
}
}

var isEnabled: Bool {
get {
self.managedIsEnabled.boolValue
}
set {
self.managedIsEnabled = NSNumber(value: newValue)
}
}

var isFavorite: Bool {
get {
self.managedIsFavorite?.boolValue ?? false
Expand Down Expand Up @@ -569,6 +581,24 @@ extension Course {
}
}

var canEditCourse: Bool {
get {
self.managedCanEditCourse.boolValue
}
set {
self.managedCanEditCourse = NSNumber(value: newValue)
}
}

var canBeBought: Bool {
get {
self.managedCanBeBought.boolValue
}
set {
self.managedCanBeBought = NSNumber(value: newValue)
}
}

var progress: Progress? {
get {
managedProgress
Expand Down
29 changes: 26 additions & 3 deletions Stepic/Legacy/Model/Entities/Course/Course.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ import SwiftyJSON
final class Course: NSManagedObject, ManagedObject, IDFetchable {
typealias IdType = Int

var scheduleType: ScheduleType? {
if let scheduleTypeString = self.scheduleTypeString {
return ScheduleType(rawValue: scheduleTypeString)
}
return nil
}

var sectionDeadlines: [SectionDeadline]? {
(PersonalDeadlineLocalStorageManager().getRecord(for: self)?.data as? DeadlineStorageRecordData)?.deadlines
}
Expand Down Expand Up @@ -56,8 +63,9 @@ final class Course: NSManagedObject, ManagedObject, IDFetchable {

var canContinue: Bool {
self.totalUnits > 0
&& self.scheduleType != "ended"
&& self.scheduleType != "upcoming"
&& self.scheduleType != .upcoming
&& self.scheduleType != .ended
&& (self.isEnabled || !self.canEditCourse)
}

var canWriteReview: Bool {
Expand Down Expand Up @@ -112,6 +120,7 @@ final class Course: NSManagedObject, ManagedObject, IDFetchable {
self.isArchived = json[JSONKey.isArchived.rawValue].boolValue
self.isInWishlist = json[JSONKey.isInWishlist.rawValue].boolValue
self.isProctored = json[JSONKey.isProctored.rawValue].boolValue
self.isEnabled = json[JSONKey.isEnabled.rawValue].bool ?? true
self.readiness = json[JSONKey.readiness.rawValue].float

self.summary = json[JSONKey.summary.rawValue].stringValue
Expand All @@ -123,7 +132,7 @@ final class Course: NSManagedObject, ManagedObject, IDFetchable {
self.slug = json[JSONKey.slug.rawValue].string
self.progressID = json[JSONKey.progress.rawValue].string
self.lastStepID = json[JSONKey.lastStep.rawValue].string
self.scheduleType = json[JSONKey.scheduleType.rawValue].string
self.scheduleTypeString = json[JSONKey.scheduleType.rawValue].string
self.learnersCount = json[JSONKey.learnersCount.rawValue].int
self.totalUnits = json[JSONKey.totalUnits.rawValue].intValue
self.reviewSummaryID = json[JSONKey.reviewSummary.rawValue].int
Expand Down Expand Up @@ -163,9 +172,14 @@ final class Course: NSManagedObject, ManagedObject, IDFetchable {
self.canViewRevenue =
actionsDictionary[JSONKey.viewRevenue.rawValue]?.dictionary?[JSONKey.enabled.rawValue]?.bool ?? false
self.canCreateAnnouncements = actionsDictionary[JSONKey.createAnnouncements.rawValue]?.string != nil
self.canEditCourse = actionsDictionary[JSONKey.editCourse.rawValue]?.string != nil
self.canBeBought =
actionsDictionary[JSONKey.canBeBought.rawValue]?.dictionary?[JSONKey.enabled.rawValue]?.bool ?? false
} else {
self.canViewRevenue = false
self.canCreateAnnouncements = false
self.canEditCourse = false
self.canBeBought = false
}
}

Expand All @@ -192,6 +206,12 @@ final class Course: NSManagedObject, ManagedObject, IDFetchable {

// MARK: Inner Types

enum ScheduleType: String {
case ended
case upcoming
case selfPaced = "self_paced"
}

enum JSONKey: String {
case id
case title
Expand Down Expand Up @@ -240,13 +260,16 @@ final class Course: NSManagedObject, ManagedObject, IDFetchable {
case previewLesson = "preview_lesson"
case previewUnit = "preview_unit"
case isProctored = "is_proctored"
case isEnabled = "is_enabled"
case canBeBought = "can_be_bought"
case defaultPromoCodeName = "default_promo_code_name"
case defaultPromoCodePrice = "default_promo_code_price"
case defaultPromoCodeDiscount = "default_promo_code_discount"
case defaultPromoCodeExpireDate = "default_promo_code_expire_date"
case actions
case viewRevenue = "view_revenue"
case enabled
case editCourse = "edit_course"
case createAnnouncements = "create_announcements"
case announcements
case acquiredSkills = "acquired_skills"
Expand Down
2 changes: 1 addition & 1 deletion Stepic/Legacy/Model/Model.xcdatamodeld/.xccurrentversion
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>_XCCurrentVersionName</key>
<string>Model_course_acquired_skills_v94.xcdatamodel</string>
<string>Model_course_update_purchase_button_behavior_v95.xcdatamodel</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="19574" systemVersion="21D49" minimumToolsVersion="Xcode 7.0" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="19574" systemVersion="21D62" minimumToolsVersion="Xcode 7.0" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="Announcement" representedClassName=".Announcement" syncable="YES">
<attribute name="managedClickCount" optional="YES" attributeType="Integer 64" usesScalarValueType="NO" syncable="YES"/>
<attribute name="managedCourseId" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
Expand Down
Loading

0 comments on commit afafd73

Please sign in to comment.