From e723cd8e3b689a9ca1a7eae654515da85866fa82 Mon Sep 17 00:00:00 2001 From: Saagar Jha Date: Thu, 27 Sep 2018 23:31:23 -0700 Subject: [PATCH 1/2] Update for iOS 12 --- .travis.yml | 2 +- iOS/break/break-watchOS Extension/Info.plist | 2 +- iOS/break/break-watchOS/Info.plist | 2 +- iOS/break/break/Resources/Info.plist | 2 +- .../Locker/LockerItemCollectionViewCell.swift | 8 -- .../break/Locker/LockerViewController.swift | 16 ++++ iOS/break/break/break/Main.storyboard | 82 +++++++++---------- 7 files changed, 59 insertions(+), 55 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1bd1500..d0b101e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: objective-c -osx_image: xcode9.4 +osx_image: xcode10 script: xcodebuild -project iOS/break/break.xcodeproj -scheme break CODE_SIGNING_ALLOWED=NO diff --git a/iOS/break/break-watchOS Extension/Info.plist b/iOS/break/break-watchOS Extension/Info.plist index ad6b893..f3b4cc6 100644 --- a/iOS/break/break-watchOS Extension/Info.plist +++ b/iOS/break/break-watchOS Extension/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 1401 + 1402 CLKComplicationPrincipalClass $(PRODUCT_MODULE_NAME).ComplicationController CLKComplicationPrincipalClass - 2 diff --git a/iOS/break/break-watchOS/Info.plist b/iOS/break/break-watchOS/Info.plist index fe24be2..284a384 100644 --- a/iOS/break/break-watchOS/Info.plist +++ b/iOS/break/break-watchOS/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 1401 + 1402 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/iOS/break/break/Resources/Info.plist b/iOS/break/break/Resources/Info.plist index 48e7e9c..a078eb3 100644 --- a/iOS/break/break/Resources/Info.plist +++ b/iOS/break/break/Resources/Info.plist @@ -19,7 +19,7 @@ CFBundleSignature ???? CFBundleVersion - 1401 + 1402 LSRequiresIPhoneOS NSFaceIDUsageDescription diff --git a/iOS/break/break/break/Locker/LockerItemCollectionViewCell.swift b/iOS/break/break/break/Locker/LockerItemCollectionViewCell.swift index 2aa5e4d..5d56d6a 100644 --- a/iOS/break/break/break/Locker/LockerItemCollectionViewCell.swift +++ b/iOS/break/break/break/Locker/LockerItemCollectionViewCell.swift @@ -11,12 +11,4 @@ import UIKit class LockerItemCollectionViewCell: UICollectionViewCell { @IBOutlet weak var typeImageView: UIImageView! @IBOutlet weak var nameLabel: UILabel! - @IBOutlet weak var typeImageViewWidthConstraint: NSLayoutConstraint! { - didSet { - // Not sure why this is necessary, but adding it makes AutoLayout - // stop complaining - contentView.translatesAutoresizingMaskIntoConstraints = false - nameLabel.preferredMaxLayoutWidth = typeImageViewWidthConstraint.constant - } - } } diff --git a/iOS/break/break/break/Locker/LockerViewController.swift b/iOS/break/break/break/Locker/LockerViewController.swift index d3996da..1a2afcc 100644 --- a/iOS/break/break/break/Locker/LockerViewController.swift +++ b/iOS/break/break/break/Locker/LockerViewController.swift @@ -15,6 +15,7 @@ class LockerViewController: UIViewController, UICollectionViewDataSource, UIColl static let cellIdentifier = "lockerItem" static let cellWidth: CGFloat = 144 + static let otherCellHeight: CGFloat = 128 + 8 var path = "/" @@ -137,6 +138,21 @@ class LockerViewController: UIViewController, UICollectionViewDataSource, UIColl return UIEdgeInsets(inset: inset) } } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + let width: CGFloat + if #available(iOS 11.0, *) { + width = lockerCollectionView.frame.width - lockerCollectionView.safeAreaInsets.right - lockerCollectionView.safeAreaInsets.left + } else { + width = lockerCollectionView.frame.width + } + let rowSize = Int(width / LockerViewController.cellWidth) + let startIndex = indexPath.row / rowSize + let maxTextHeight = (startIndex.. Int { return 1 diff --git a/iOS/break/break/break/Main.storyboard b/iOS/break/break/break/Main.storyboard index 68b5ee6..d92a93a 100644 --- a/iOS/break/break/break/Main.storyboard +++ b/iOS/break/break/break/Main.storyboard @@ -1,14 +1,11 @@ - + - - - - + @@ -31,22 +28,22 @@ - + - + - + - + @@ -77,7 +74,7 @@