Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 15 support #1013

Merged
merged 14 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "OS_ACTIVITY_MODE"
value = "disable"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "DYLD_PRINT_STATISTICS"
value = "1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="LHK-cu-T61">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="LHK-cu-T61">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -33,18 +33,17 @@
<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="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="xIF-ha-DwF" customClass="StepikTableView" customModule="Stepic">
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="xIF-ha-DwF" customClass="StepikTableView" customModule="Stepic">
<rect key="frame" x="0.0" y="44" width="375" height="623"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<viewLayoutGuide key="safeArea" id="l0a-iu-usF"/>
<constraints>
<constraint firstItem="xIF-ha-DwF" firstAttribute="leading" secondItem="l0a-iu-usF" secondAttribute="leading" id="0S2-ng-dfm"/>
<constraint firstItem="xIF-ha-DwF" firstAttribute="bottom" secondItem="l0a-iu-usF" secondAttribute="bottom" id="DLv-4k-smx"/>
<constraint firstItem="xIF-ha-DwF" firstAttribute="top" secondItem="l0a-iu-usF" secondAttribute="top" id="FN8-QO-b8I"/>
<constraint firstItem="xIF-ha-DwF" firstAttribute="trailing" secondItem="l0a-iu-usF" secondAttribute="trailing" id="dYg-xz-Aqc"/>
</constraints>
<viewLayoutGuide key="safeArea" id="l0a-iu-usF"/>
</view>
<navigationItem key="navigationItem" title="Certificates" id="jf7-xo-enf"/>
<connections>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ final class CertificatesViewController: UIViewController, ControllerWithStepikPl
tableView.delegate = self
tableView.dataSource = self

if #available(iOS 15.0, *) {
tableView.sectionHeaderTopPadding = 0
}

let isMe = AuthInfo.shared.userId != nil && self.userID == AuthInfo.shared.userId
if isMe {
self.tableView.emptySetPlaceholder = StepikPlaceholder(.emptyCertificatesMe) { [weak self] in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ final class CatalogBlockContentValueTransformer: NSSecureUnarchiveFromDataTransf
static let name = NSValueTransformerName(rawValue: String(describing: CatalogBlockContentValueTransformer.self))

override static var allowedTopLevelClasses: [AnyClass] {
[NSArray.self, CatalogBlockContentItem.self, NSDate.self]
[NSArray.self, CatalogBlockContentItem.self, NSDate.self, NSNumber.self, NSString.self]
}

static func register() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ final class DatasetValueTransformer: NSSecureUnarchiveFromDataTransformer {
static let name = NSValueTransformerName(rawValue: String(describing: DatasetValueTransformer.self))

override static var allowedTopLevelClasses: [AnyClass] {
[Dataset.self, FillBlanksComponent.self, NSArray.self]
[Dataset.self, FillBlanksComponent.self, NSArray.self, NSString.self]
}

static func register() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ final class ReplyValueTransformer: NSSecureUnarchiveFromDataTransformer {
static let name = NSValueTransformerName(rawValue: String(describing: ReplyValueTransformer.self))

override static var allowedTopLevelClasses: [AnyClass] {
[Reply.self, NSArray.self, TableReplyChoice.self, TableReplyChoice.Column.self]
[Reply.self, NSArray.self, TableReplyChoice.self, TableReplyChoice.Column.self, NSNumber.self, NSString.self]
}

static func register() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ final class SubmissionFeedbackValueTransformer: NSSecureUnarchiveFromDataTransfo
static let name = NSValueTransformerName(rawValue: String(describing: SubmissionFeedbackValueTransformer.self))

override static var allowedTopLevelClasses: [AnyClass] {
[SubmissionFeedback.self, NSArray.self]
[SubmissionFeedback.self, NSArray.self, NSString.self]
}

static func register() {
Expand Down
8 changes: 8 additions & 0 deletions Stepic/Sources/Controllers/StyledTabBarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ final class StyledTabBarViewController: UITabBarController {
self.tabBar.unselectedItemTintColor = Appearance.unselectedItemTintColor
self.tabBar.isTranslucent = false

if #available(iOS 15.0, *) {
let appearance = UITabBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = Appearance.barTintColor
self.tabBar.standardAppearance = appearance
self.tabBar.scrollEdgeAppearance = self.tabBar.standardAppearance
}

let tabBarViewControllers = self.items.map { tabBarItem -> UIViewController in
let viewController = tabBarItem.controller
viewController.tabBarItem = tabBarItem.makeTabBarItem()
Expand Down
16 changes: 13 additions & 3 deletions Stepic/Sources/Modules/CourseList/Views/CourseListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ extension CourseListView {
}
}

// MARK: - CourseListView: UIView -

class CourseListView: UIView {
let appearance: Appearance
let colorMode: CourseListColorMode
Expand Down Expand Up @@ -138,7 +140,7 @@ class CourseListView: UIView {
return (columnsCount, columnWidth)
}

// MARK: - ColorMode
// MARK: ColorMode

private func getBackgroundColor(for colorMode: CourseListColorMode) -> UIColor {
switch colorMode {
Expand All @@ -151,7 +153,7 @@ class CourseListView: UIView {
}
}

// MARK: - Loading state
// MARK: Loading state

func showLoading() {
self.collectionView.skeleton.viewBuilder = {
Expand Down Expand Up @@ -233,7 +235,7 @@ extension CourseListView: ProgrammaticallyInitializableViewProtocol {
}
}

// Subclasses for two orientations
// MARK: - VerticalCourseListView: CourseListView, UICollectionViewDelegate, UICollectionViewDataSource -

final class VerticalCourseListView: CourseListView, UICollectionViewDelegate, UICollectionViewDataSource {
private var gridSize: CourseListGridSize {
Expand Down Expand Up @@ -445,6 +447,8 @@ final class VerticalCourseListView: CourseListView, UICollectionViewDelegate, UI
}
}

// MARK: - HorizontalCourseListView: CourseListView, UICollectionViewDelegate, UICollectionViewDataSource -

final class HorizontalCourseListView: CourseListView, UICollectionViewDelegate, UICollectionViewDataSource {
private var gridSize: CourseListGridSize {
didSet {
Expand Down Expand Up @@ -514,6 +518,8 @@ final class HorizontalCourseListView: CourseListView, UICollectionViewDelegate,
self.collectionView.delegate = self
self.collectionView.dataSource = self

self.collectionView.contentInsetAdjustmentBehavior = .never
self.collectionView.showsVerticalScrollIndicator = false
// Make scroll faster
self.collectionView.decelerationRate = .fast
}
Expand Down Expand Up @@ -643,6 +649,8 @@ final class HorizontalCourseListView: CourseListView, UICollectionViewDelegate,

// Wrapper for reusable views

// MARK: - CollectionViewReusableView: UICollectionReusableView, Reusable -

final class CollectionViewReusableView: UICollectionReusableView, Reusable {
private var subview: UIView?

Expand All @@ -662,6 +670,8 @@ final class CollectionViewReusableView: UICollectionReusableView, Reusable {
}
}

// MARK: - CourseListCollectionViewCell subclasses -

// Cause we can't init cell with custom initializer let's use custom classes

private class LightCourseListCollectionViewCell: CourseListCollectionViewCell {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ final class UserCoursesReviewsView: UIView {
tableView.separatorStyle = .none
tableView.keyboardDismissMode = .interactive

if #available(iOS 15.0, *) {
tableView.sectionHeaderTopPadding = 0
}

tableView.refreshControl = self.refreshControl
self.refreshControl.addTarget(self, action: #selector(self.refreshControlDidChangeValue), for: .valueChanged)

Expand Down