Skip to content
This repository was archived by the owner on Nov 26, 2019. It is now read-only.
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ xcuserdata/
*.moved-aside
*.xccheckout
*.xcscmblueprint
.DS_Store
/Icons

## Obj-C/Swift specific
*.hmap
Expand Down Expand Up @@ -65,4 +67,4 @@ Carthage/Build
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output
fastlane/test_output
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 18 additions & 9 deletions TransitPal/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Artboard-20pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Artboard-20pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Artboard-29pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Artboard-29pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Artboard-40pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Artboard-40pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Artboard-60pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Artboard-60pt@3x.png",
"scale" : "3x"
},
{
Expand Down Expand Up @@ -86,8 +94,9 @@
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Artboard-1024pt.png",
"scale" : "1x"
}
],
Expand Down
Empty file modified TransitPal/Resources/Assets.xcassets/Contents.json
100644 → 100755
Empty file.
20 changes: 10 additions & 10 deletions TransitPal/Views/TransitEventDetailView.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ import SwiftUI
struct TransitEventDetailView : View {
var event: TransitEvent = TransitEvent()

static var formatter: DateFormatter {
let formatter = DateFormatter()
formatter.dateStyle = .short
formatter.timeStyle = .short
return formatter
}

var body: some View {
let isTrip = (event as? TransitTrip) != nil

Expand All @@ -33,12 +26,12 @@ struct TransitEventDetailView : View {
HStack {
Text("Tagged on").bold()
Spacer()
Text(Self.formatter.string(from: (event as! TransitTrip).Timestamp))
Text(prettyDate(from: (event as! TransitTrip).Timestamp))
}
HStack {
Text("Tagged off").bold()
Spacer()
Text(Self.formatter.string(from: (event as! TransitTrip).ExitTimestamp!))
Text(prettyDate(from: (event as! TransitTrip).ExitTimestamp))
}
HStack {
Text("From").bold()
Expand All @@ -64,7 +57,7 @@ struct TransitEventDetailView : View {
HStack {
Text("Date/Time").bold()
Spacer()
Text(Self.formatter.string(from: (event as! TransitRefill).Timestamp))
Text(prettyDate(from: (event as! TransitRefill).Timestamp))
}
HStack {
Text("Amount").bold()
Expand All @@ -85,6 +78,13 @@ struct TransitEventDetailView : View {
}.padding()
}
}

func prettyDate(from date: Date?) -> String {
let formatter = DateFormatter()
formatter.dateStyle = .short
formatter.timeStyle = .short
return formatter.string(for: date) ?? "N/A"
}
}

#if DEBUG
Expand Down
10 changes: 7 additions & 3 deletions TransitPal/Views/TransitEventRow.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ struct TransitEventRow : View {

if let trip = event as? TransitTrip {
amount = trip.prettyFare
description = "\(trip.From.bestName(false)) → \(trip.To.bestName(false))"
if trip.To.hasName {
description = "\(trip.From.bestName(false)) → \(trip.To.bestName(false))"
} else {
description = "\(trip.From.bestName(false))"
}
icon = trip.Mode.icon
if let exitTime = trip.ExitTimestamp {
timestamp = "\(timestamp) → \(dateFormatter.string(from: exitTime))"
Expand All @@ -43,8 +47,8 @@ struct TransitEventRow : View {
return HStack {
Image(uiImage: image)
VStack(alignment: .leading) {
Text(event.Agency.name.english).font(.headline).lineLimit(1)
Text(description).font(.callout).lineLimit(1)
Text(event.Agency.name.englishShort).font(.headline).lineLimit(1)
Text(description).font(.callout).lineLimit(nil)
}
Spacer()
VStack(alignment: .trailing) {
Expand Down
5 changes: 4 additions & 1 deletion TransitPal/Views/TransitTripMapView.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ struct TransitTripMapView: UIViewRepresentable {
}

func updateUIView(_ view: MKMapView, context: Context) {
let annotations = [self.from.annotation, self.to.annotation]
var annotations = [self.from.annotation]
if self.to.hasName {
annotations.append(self.to.annotation)
}
view.addAnnotations(annotations)
view.showAnnotations(annotations, animated: false)
}
Expand Down