Skip to content
Open
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions iOS/break/break-watchOS Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1401</string>
<string>1402</string>
<key>CLKComplicationPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).ComplicationController</string>
<key>CLKComplicationPrincipalClass - 2</key>
Expand All @@ -39,7 +39,7 @@
<key>NSExtensionAttributes</key>
<dict>
<key>WKAppBundleIdentifier</key>
<string>com.saagarjha.break.watchkitapp</string>
<string>org.vihan.break.watchkitapp</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.watchkit</string>
Expand Down
4 changes: 2 additions & 2 deletions iOS/break/break-watchOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1401</string>
<string>1402</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>WKCompanionAppBundleIdentifier</key>
<string>com.saagarjha.break</string>
<string>org.vihan.break</string>
<key>WKWatchKitApp</key>
<true/>
</dict>
Expand Down
34 changes: 19 additions & 15 deletions iOS/break/break.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
49DF2B2E1CF3BDF900DC1EB7 /* CourseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49DF2B2D1CF3BDF900DC1EB7 /* CourseViewController.swift */; };
49E1BD091CF006EE002E819D /* SchoolLoopCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49E1BD081CF006EE002E819D /* SchoolLoopCategory.swift */; };
49F128C41F5F365F0000E19A /* RatingsReviewsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49F128C31F5F365F0000E19A /* RatingsReviewsTableViewController.swift */; };
D84C2DBB21B788F3005F4442 /* LoopMail.css in Resources */ = {isa = PBXBuildFile; fileRef = D84C2DBA21B788F3005F4442 /* LoopMail.css */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -257,6 +258,7 @@
49DF2B2D1CF3BDF900DC1EB7 /* CourseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CourseViewController.swift; sourceTree = "<group>"; };
49E1BD081CF006EE002E819D /* SchoolLoopCategory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchoolLoopCategory.swift; sourceTree = "<group>"; };
49F128C31F5F365F0000E19A /* RatingsReviewsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RatingsReviewsTableViewController.swift; sourceTree = "<group>"; };
D84C2DBA21B788F3005F4442 /* LoopMail.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = LoopMail.css; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -502,6 +504,7 @@
498665721C8D24E9004BA249 /* Info.plist */,
498665731C8D24E9004BA249 /* LaunchScreen.storyboard */,
498665671C8D24E9004BA249 /* Main.storyboard */,
D84C2DBA21B788F3005F4442 /* LoopMail.css */,
);
path = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -610,17 +613,17 @@
TargetAttributes = {
4906AB781CCDBFB800610448 = {
CreatedOnToolsVersion = 7.3;
DevelopmentTeam = X4A9GH5NN2;
DevelopmentTeam = AP83862692;
LastSwiftMigration = 0900;
};
4906AB841CCDBFBA00610448 = {
CreatedOnToolsVersion = 7.3;
DevelopmentTeam = X4A9GH5NN2;
DevelopmentTeam = AP83862692;
LastSwiftMigration = 0900;
};
493E17751C63E95000AFC7A6 = {
CreatedOnToolsVersion = 7.2.1;
DevelopmentTeam = X4A9GH5NN2;
DevelopmentTeam = AP83862692;
LastSwiftMigration = 0900;
SystemCapabilities = {
com.apple.BackgroundModes = {
Expand Down Expand Up @@ -689,6 +692,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D84C2DBB21B788F3005F4442 /* LoopMail.css in Resources */,
493DDDEC1EA71AEA006104D4 /* AppIcon.xcassets in Resources */,
4986659E1C8D24E9004BA249 /* Main.storyboard in Resources */,
498665A71C8D24E9004BA249 /* LaunchScreen.storyboard in Resources */,
Expand Down Expand Up @@ -879,10 +883,10 @@
CLANG_ANALYZER_NONNULL = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = X4A9GH5NN2;
DEVELOPMENT_TEAM = AP83862692;
IBSC_MODULE = break_watchOS_Extension;
INFOPLIST_FILE = "break-watchOS/Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = com.saagarjha.break.watchkitapp;
PRODUCT_BUNDLE_IDENTIFIER = org.vihan.break.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
SKIP_INSTALL = YES;
Expand All @@ -899,10 +903,10 @@
CLANG_ANALYZER_NONNULL = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = X4A9GH5NN2;
DEVELOPMENT_TEAM = AP83862692;
IBSC_MODULE = break_watchOS_Extension;
INFOPLIST_FILE = "break-watchOS/Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = com.saagarjha.break.watchkitapp;
PRODUCT_BUNDLE_IDENTIFIER = org.vihan.break.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
SKIP_INSTALL = YES;
Expand All @@ -918,10 +922,10 @@
CLANG_ANALYZER_NONNULL = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = X4A9GH5NN2;
DEVELOPMENT_TEAM = AP83862692;
INFOPLIST_FILE = "break-watchOS Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.saagarjha.break.watchkitapp.watchkitextension;
PRODUCT_BUNDLE_IDENTIFIER = org.vihan.break.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
SKIP_INSTALL = YES;
Expand All @@ -938,10 +942,10 @@
CLANG_ANALYZER_NONNULL = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = X4A9GH5NN2;
DEVELOPMENT_TEAM = AP83862692;
INFOPLIST_FILE = "break-watchOS Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.saagarjha.break.watchkitapp.watchkitextension;
PRODUCT_BUNDLE_IDENTIFIER = org.vihan.break.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -1064,11 +1068,11 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_ENTITLEMENTS = break/break.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = X4A9GH5NN2;
DEVELOPMENT_TEAM = AP83862692;
INFOPLIST_FILE = "$(SRCROOT)/break/Resources/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.saagarjha.break;
PRODUCT_BUNDLE_IDENTIFIER = org.vihan.break;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
Expand All @@ -1083,11 +1087,11 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_ENTITLEMENTS = break/break.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = X4A9GH5NN2;
DEVELOPMENT_TEAM = AP83862692;
INFOPLIST_FILE = "$(SRCROOT)/break/Resources/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.saagarjha.break;
PRODUCT_BUNDLE_IDENTIFIER = org.vihan.break;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
Expand Down
2 changes: 1 addition & 1 deletion iOS/break/break/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1401</string>
<string>1402</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSFaceIDUsageDescription</key>
Expand Down
31 changes: 31 additions & 0 deletions iOS/break/break/Resources/LoopMail.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
html, body {
font-size: 16px;
margin: 0.5rem;
}

h1.subject {
font-weight: bold;
font-size: 1.4rem;
margin-bottom: 0.2rem;
}

.sender {
color: #AAA;
font-weight: 300;
}

.user {
display: inline-block;
font-size: 1rem;
padding: 2px 16px;
border-radius: 16px;
background: rgba(26, 188, 156, 0.25);
color: rgba(26, 188, 156, 1.0);
}

hr.divider {
border: none;
border: 0.5px solid rgba(0, 0, 0, 0.1
);
margin: 1rem 0 2rem 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
16 changes: 16 additions & 0 deletions iOS/break/break/break/Locker/LockerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "/"

Expand Down Expand Up @@ -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..<min(lockerItems.endIndex, startIndex + rowSize)).map { index in
(lockerItems[index].name as NSString).boundingRect(with: CGSize(width: LockerViewController.cellWidth, height: .infinity), options: .usesLineFragmentOrigin, attributes: [.font: UIFont.preferredFont(forTextStyle: .headline)], context: nil).height
}.max() ?? 0
return CGSize(width: LockerViewController.cellWidth, height: LockerViewController.otherCellHeight + maxTextHeight)
}

func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
Expand Down
17 changes: 14 additions & 3 deletions iOS/break/break/break/LoopMail/LoopMailMessageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,25 @@ class LoopMailMessageViewController: WebViewToSafariViewControllerShimViewContro
return
}
`self`.loopMail = loopMail
`self`.message = "\(breakConstants.webViewDefaultStyle)<h4><span style=\"font-weight:normal\">From: \(loopMail.sender.name)</span></h4><h3>\(loopMail.subject)</h3><hr>\(loopMail.message)"
`self`.message = """
<html>
<head>
\(breakConstants.webViewDefaultStyle)
<link rel="stylesheet" href="LoopMail.css"/>
</head>
<body>
<h1 class="subject">\(loopMail.subject)</h1>
<span class="sender">From:&nbsp;&nbsp;<span class="user">\(loopMail.sender.name)</span></span>
<hr class="divider">
<div class="body">\(loopMail.message)</div>
"""
if !loopMail.links.isEmpty {
`self`.message += "<hr><h3><span style=\"font-weight:normal\">Links:</span></h3>"
`self`.message += "<hr class=\"divider\"><h3><span style=\"font-weight:normal\">Links:</span></h3>"
}
for link in loopMail.links {
`self`.message += "<a href=\(link.URL)>\(link.title)</a><br>"
}
`self`.webView.loadHTMLString(`self`.message, baseURL: nil)
`self`.webView.loadHTMLString(`self`.message, baseURL: Bundle.main.resourceURL)
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions iOS/break/break/break/LoopMail/LoopMailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class LoopMailViewController: UITableViewController, Refreshable, UISearchResult

static let dateFormatter: DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.doesRelativeDateFormatting = true
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to hold off on this change for now. It's not that I wouldn't like this being added, but I want to check where else I can add this and have it be a separate commit.

dateFormatter.dateStyle = .long
dateFormatter.timeStyle = .short
return dateFormatter
Expand Down Expand Up @@ -100,6 +101,10 @@ class LoopMailViewController: UITableViewController, Refreshable, UISearchResult
tableView.deselectRow(at: indexPath, animated: true)
}

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should already be set in the storyboard, AFAIK, since the table cells already rely on AutoLayout. Did something not work for you?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my testing it looks like both the Table and the Table Cells need auto-layout/auto-sizing, this seemed to be enabled for the table but the table cells seemed to use a fixed custom height in the storyboard

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand you here. The layout of the table itself should be managed by UITableViewController; I'm not doing anything special here and it should expand to fill the screen. I have marked the table view with an automatic row height in the storyboard file:

screen shot 2018-12-07 at 04 55 03

This works for me. Is this not what you are seeing?

return UITableViewAutomaticDimension
}

override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let replyAction = UITableViewRowAction(style: .default, title: "Reply") { [weak self] _, indexPath in
guard let `self` = self else {
Expand Down
Loading