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

OBAListView iOS 14 list #391

Merged
merged 20 commits into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4dc79fc
Update StopViewModel hash function to include id
ualch9 Jun 12, 2021
daa854b
Use UICollectionLayoutListConfiguration for OBAListView section layouts
ualch9 Jun 12, 2021
ba9bcf4
Fixes `inserted identifiers already present` warning for transit alerts
ualch9 Jun 13, 2021
48502c5
Cache data snapshot in OBAListView as source-of-truth
ualch9 Jun 13, 2021
99a7865
Add stop to StopViewModel’s identity
ualch9 Jun 13, 2021
e64fb8d
Adopt UIListContentConfiguration for default list views
ualch9 Jun 13, 2021
0b7adf1
Tweak OBAListViewItem
ualch9 Jun 14, 2021
1c8995d
Use firstItemInSection section style in OBAListView
ualch9 Jun 14, 2021
3d2c0de
Remove supplementary view registration from OBAListView
ualch9 Jun 15, 2021
d95cedc
Use native swipe actions, remove SwipeCellKit
ualch9 Jun 15, 2021
63bf249
Remove lots of obsolete OBAListView code
ualch9 Jun 17, 2021
2c8597c
Removes contentConfiguration property from OBAListViewItem
ualch9 Jun 17, 2021
79f9417
Adds list separator configuration on a per-item basis
ualch9 Jun 20, 2021
c32e531
Add list configuration on a per-section basis
ualch9 Jun 21, 2021
3938797
Update Eureka forms to use insetGrouped tableview style
ualch9 Jun 21, 2021
cd626f8
Make transit alert detail view dismiss-swipeable
ualch9 Jun 21, 2021
189be8e
Merge branch 'master' into list_prep
ualch9 Jun 23, 2021
eb9917a
Add version check for iOS 14.5 API
ualch9 Jun 23, 2021
2d605ee
Only compile iOS 14.5 availability check on Xcode 12.5
ualch9 Jun 23, 2021
986f9d7
Removes detailButton accessory from OBAListRowConfiguration
ualch9 Jun 24, 2021
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
18 changes: 13 additions & 5 deletions OBAKit/Alerts/TransitAlertViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct TransitAlertDataListViewModel: OBAListViewItem {
var subtitle: String { return String(body.prefix(256)) }
var onSelectAction: OBAListViewAction<TransitAlertDataListViewModel>?

var contentConfiguration: OBAContentConfiguration {
var configuration: OBAListViewItemConfiguration {
var config = OBAListRowConfiguration(
text: .string(title),
secondaryText: .string(subtitle),
Expand All @@ -40,12 +40,18 @@ struct TransitAlertDataListViewModel: OBAListViewItem {

config.textConfig.accessibilityNumberOfLines = 5
config.secondaryTextConfig.accessibilityNumberOfLines = 8
return config

return .custom(config)
}

init(_ transitAlert: TransitAlertViewModel, isUnread: Bool = false, forLocale locale: Locale, onSelectAction: OBAListViewAction<TransitAlertDataListViewModel>? = nil) {
init<TA: TransitAlertViewModel>(
_ transitAlert: TA,
isUnread: Bool = false,
forLocale locale: Locale,
onSelectAction: OBAListViewAction<TransitAlertDataListViewModel>? = nil)
where TA: Hashable {
self.transitAlert = transitAlert
self.id = transitAlert.id
self.id = "\(transitAlert.hashValue)"
self.title = transitAlert.title(forLocale: locale) ?? ""
self.body = transitAlert.body(forLocale: locale) ?? ""
self.localizedURL = transitAlert.url(forLocale: locale)
Expand All @@ -58,12 +64,14 @@ struct TransitAlertDataListViewModel: OBAListViewItem {
hasher.combine(title)
hasher.combine(body)
hasher.combine(localizedURL)
hasher.combine(isUnread)
}

static func == (lhs: TransitAlertDataListViewModel, rhs: TransitAlertDataListViewModel) -> Bool {
return lhs.id == rhs.id &&
lhs.title == rhs.title &&
lhs.body == rhs.body &&
lhs.localizedURL == rhs.localizedURL
lhs.localizedURL == rhs.localizedURL &&
lhs.isUnread == rhs.isUnread
}
}
4 changes: 3 additions & 1 deletion OBAKit/Bookmarks/BookmarksViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ public class BookmarksViewController: UIViewController,
let groupID: String = group?.id.uuidString ?? "unknown_group"
let groupName = group?.name ?? OBALoc("bookmarks_controller.ungrouped_bookmarks_section.title", value: "Bookmarks", comment: "The title for the bookmarks controller section that shows bookmarks that aren't in a group.")

return OBAListViewSection(id: groupID, title: groupName, contents: arrivalData)
var section = OBAListViewSection(id: groupID, title: groupName, contents: arrivalData)
section.configuration = .appearance(.plain)
return section
}

public func emptyData(for listView: OBAListView) -> OBAListView.EmptyData? {
Expand Down
4 changes: 2 additions & 2 deletions OBAKit/Bookmarks/BookmarksViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ struct BookmarkArrivalViewModel: OBAListViewItem {
return TripBookmarkTableCell.self
}

var contentConfiguration: OBAContentConfiguration {
return BookmarkArrivalContentConfiguration(viewModel: self)
var configuration: OBAListViewItemConfiguration {
return .custom(BookmarkArrivalContentConfiguration(viewModel: self))
}

var onSelectAction: OBAListViewAction<BookmarkArrivalViewModel>?
Expand Down
2 changes: 0 additions & 2 deletions OBAKit/Bookmarks/TripBookmarkCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ final class TripBookmarkTableCell: OBAListViewCell {
override init(frame: CGRect) {
super.init(frame: frame)

fixiOS13AutoLayoutBug()
ualch9 marked this conversation as resolved.
Show resolved Hide resolved

contentView.backgroundColor = ThemeColors.shared.systemBackground

contentView.addSubview(stackView)
Expand Down
8 changes: 4 additions & 4 deletions OBAKit/Controls/ListView/Helpers/OBAListViewDebug.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct DEBUG_Person: OBAListViewItem {

var onSelectAction: OBAListViewAction<DEBUG_Person>?

var contentConfiguration: OBAContentConfiguration {
return OBAListRowConfiguration(image: UIImage(systemName: "person.fill"), text: .string(name), secondaryText: .string(address), appearance: .subtitle, accessoryType: .disclosureIndicator)
var configuration: OBAListViewItemConfiguration {
return .custom(OBAListRowConfiguration(image: UIImage(systemName: "person.fill"), text: .string(name), secondaryText: .string(address), appearance: .subtitle, accessoryType: .disclosureIndicator))
}

func hash(into hasher: inout Hasher) {
Expand Down Expand Up @@ -64,8 +64,8 @@ struct DEBUG_CustomContent: OBAListViewItem {
return [action]
}

var contentConfiguration: OBAContentConfiguration {
return DEBUG_CustomContentConfiguration(text: text)
var configuration: OBAListViewItemConfiguration {
return .custom(DEBUG_CustomContentConfiguration(text: text))
}

func hash(into hasher: inout Hasher) {
Expand Down
Loading