Compare commits

...

12 Commits

Author SHA1 Message Date
Shadowfacts bf6dfab121 Fix not checking if section exists before getting item identifiers
Closes #398
2023-05-27 15:33:33 -07:00
Shadowfacts f5f1be9f7d Fix crash due to force-unwrapping uninitialized search controller
Closes #395
2023-05-27 15:31:02 -07:00
Shadowfacts c0148bb770 Fix Delete attachment context menu action not working
Closes #394
2023-05-27 15:28:39 -07:00
Shadowfacts d938c555b7 Fix Recognize Text action accessing view context MO off of main thread
Closes #393
2023-05-27 15:26:13 -07:00
Shadowfacts 52efc8b752 Fix crash if contextMenuConfiguration called on status cell that doesn't have a delegate
Closes #392
2023-05-27 15:23:49 -07:00
Shadowfacts 822e3f91c4 Fix crash if language code is less than 3 chars
Closes #391
2023-05-27 15:23:11 -07:00
Shadowfacts d0a1aec1c0 Fix crash when action notification cell doesn't have any statuses
Closes #390
2023-05-27 15:21:34 -07:00
Shadowfacts e8305184af Fix tip jar button width changing while purchasing
Closes #389
2023-05-27 15:20:42 -07:00
Shadowfacts e9727ac2c5 Fix reblogs count button not being leading-aligned
Closes #388
2023-05-27 15:18:03 -07:00
Shadowfacts d9a6bb0fd2 Fix ambiguous constraints in poll view 2023-05-27 15:11:53 -07:00
Shadowfacts 13a807ba4f Fix poll options view blocking context menu gesture
Closes #387
2023-05-27 15:00:10 -07:00
Shadowfacts 32c5eee0b5 Fix conversation main status cell flashing wrong background color
Closes #386
2023-05-27 14:52:59 -07:00
11 changed files with 39 additions and 13 deletions

View File

@ -49,7 +49,9 @@ class AttachmentRowController: ViewController {
private func removeAttachment() {
withAnimation {
parent.draft.attachments.remove(attachment)
var newAttachments = parent.draft.draftAttachments
newAttachments.removeAll(where: { $0.id == attachment.id })
parent.draft.attachments = NSMutableOrderedSet(array: newAttachments)
}
}
@ -70,8 +72,8 @@ class AttachmentRowController: ViewController {
private func recognizeText() {
descriptionMode = .recognizingText
DispatchQueue.global(qos: .userInitiated).async {
self.attachment.getData(features: self.parent.mastodonController.instanceFeatures, skipAllConversion: true) { result in
DispatchQueue.main.async {
let data: Data
switch result {
case .success((let d, _)):

View File

@ -22,10 +22,11 @@ struct LanguagePicker: View {
}
static func codeFromInputMode(_ mode: UITextInputMode) -> Locale.LanguageCode? {
guard let bcp47Lang = mode.primaryLanguage else {
guard let bcp47Lang = mode.primaryLanguage,
!bcp47Lang.isEmpty else {
return nil
}
var maybeIso639Code = bcp47Lang[..<bcp47Lang.index(bcp47Lang.startIndex, offsetBy: 3)]
var maybeIso639Code = bcp47Lang[..<bcp47Lang.index(bcp47Lang.startIndex, offsetBy: min(3, bcp47Lang.count))]
if maybeIso639Code.last == "-" {
maybeIso639Code = maybeIso639Code[..<maybeIso639Code.index(before: maybeIso639Code.endIndex)]
}

View File

@ -247,7 +247,7 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
explore.loadViewIfNeeded()
let search = secondaryNavController.viewControllers.first as! InlineTrendsViewController
if search.searchController.isActive {
if search.searchController?.isActive == true {
// Copy the search query from the search VC to the Explore VC's search controller.
let query = search.searchController.searchBar.text ?? ""
explore.searchController.searchBar.text = query

View File

@ -240,7 +240,9 @@ class ActionNotificationGroupCollectionViewCell: UICollectionViewListCell {
override var accessibilityLabel: String? {
get {
let first = group.notifications.first!
guard let first = group.notifications.first else {
return nil
}
var str = ""
switch group.kind {
case .favourite:

View File

@ -263,6 +263,9 @@ class NotificationsCollectionViewController: UIViewController, TimelineLikeColle
return
}
var snapshot = dataSource.snapshot()
guard snapshot.sectionIdentifiers.contains(.notifications) else {
return
}
let items = snapshot.itemIdentifiers(inSection: .notifications)
let toDelete = statusIDs.flatMap { id in
items.lazy.filter { $0.group?.notifications.first?.status?.id == id }

View File

@ -77,8 +77,12 @@ struct TipJarView: View {
}
}
.onPreferenceChange(ButtonWidthKey.self) { newValue in
if let buttonWidth {
self.buttonWidth = max(buttonWidth, newValue)
} else {
self.buttonWidth = newValue
}
}
if let total = getTotalTips(), total > 0 {
Text("You've tipped a total of \(Text(total, format: products[0].0.priceFormatStyle)) 😍")

View File

@ -105,7 +105,11 @@ class PollOptionsView: UIControl {
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
// don't let subviews receive touch events
if isEnabled {
return self
} else {
return nil
}
}
// MARK: - UIControl

View File

@ -32,10 +32,12 @@ class PollVoteButton: UIView {
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitleColor(.secondaryLabel, for: .disabled)
button.contentHorizontalAlignment = .trailing
embedSubview(button)
#if targetEnvironment(macCatalyst)
label.textColor = .secondaryLabel
label.translatesAutoresizingMaskIntoConstraints = false
label.textAlignment = .right
embedSubview(label)
#endif

View File

@ -67,6 +67,7 @@ class StatusPollView: UIView, StatusContentPollView {
voteButton.translatesAutoresizingMaskIntoConstraints = false
voteButton.addTarget(self, action: #selector(votePressed))
voteButton.setFont(infoLabel.font)
voteButton.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
addSubview(voteButton)
NSLayoutConstraint.activate([
@ -77,7 +78,7 @@ class StatusPollView: UIView, StatusContentPollView {
infoLabel.leadingAnchor.constraint(equalTo: leadingAnchor),
infoLabel.topAnchor.constraint(equalTo: optionsView.bottomAnchor),
infoLabel.bottomAnchor.constraint(equalTo: bottomAnchor),
infoLabel.trailingAnchor.constraint(lessThanOrEqualTo: voteButton.leadingAnchor, constant: -8),
infoLabel.trailingAnchor.constraint(equalTo: voteButton.leadingAnchor, constant: -8),
voteButton.widthAnchor.constraint(greaterThanOrEqualToConstant: 44),
voteButton.trailingAnchor.constraint(equalTo: trailingAnchor),
@ -141,7 +142,7 @@ class StatusPollView: UIView, StatusContentPollView {
}
func estimateHeight(effectiveWidth: CGFloat) -> CGFloat {
guard let poll else { return 0 }
guard poll != nil else { return 0 }
return optionsView.estimateHeight(effectiveWidth: effectiveWidth) + infoLabel.sizeThatFits(UIView.layoutFittingExpandedSize).height
}

View File

@ -146,6 +146,7 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status
]).configure {
$0.axis = .horizontal
$0.spacing = 8
$0.distribution = .fillProportionally
}
private let timestampAndClientLabel = UILabel().configure {
@ -326,7 +327,12 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status
}
override func updateConfiguration(using state: UICellConfigurationState) {
backgroundConfiguration = .appListPlainCell(for: state)
var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
// conv main status isn't selectable
if !state.isFocused {
config.backgroundColor = .appBackground
}
backgroundConfiguration = config
}
// MARK: Configure UI

View File

@ -784,7 +784,8 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
}
func contextMenuConfiguration() -> UIContextMenuConfiguration? {
guard let status = mastodonController.persistentContainer.status(for: statusID) else {
guard let mastodonController,
let status = mastodonController.persistentContainer.status(for: statusID) else {
return nil
}
return UIContextMenuConfiguration {