Compare commits
12 Commits
06f761bf56
...
bf6dfab121
Author | SHA1 | Date |
---|---|---|
Shadowfacts | bf6dfab121 | |
Shadowfacts | f5f1be9f7d | |
Shadowfacts | c0148bb770 | |
Shadowfacts | d938c555b7 | |
Shadowfacts | 52efc8b752 | |
Shadowfacts | 822e3f91c4 | |
Shadowfacts | d0a1aec1c0 | |
Shadowfacts | e8305184af | |
Shadowfacts | e9727ac2c5 | |
Shadowfacts | d9a6bb0fd2 | |
Shadowfacts | 13a807ba4f | |
Shadowfacts | 32c5eee0b5 |
|
@ -49,7 +49,9 @@ class AttachmentRowController: ViewController {
|
||||||
|
|
||||||
private func removeAttachment() {
|
private func removeAttachment() {
|
||||||
withAnimation {
|
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() {
|
private func recognizeText() {
|
||||||
descriptionMode = .recognizingText
|
descriptionMode = .recognizingText
|
||||||
|
|
||||||
DispatchQueue.global(qos: .userInitiated).async {
|
self.attachment.getData(features: self.parent.mastodonController.instanceFeatures, skipAllConversion: true) { result in
|
||||||
self.attachment.getData(features: self.parent.mastodonController.instanceFeatures, skipAllConversion: true) { result in
|
DispatchQueue.main.async {
|
||||||
let data: Data
|
let data: Data
|
||||||
switch result {
|
switch result {
|
||||||
case .success((let d, _)):
|
case .success((let d, _)):
|
||||||
|
|
|
@ -22,10 +22,11 @@ struct LanguagePicker: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
static func codeFromInputMode(_ mode: UITextInputMode) -> Locale.LanguageCode? {
|
static func codeFromInputMode(_ mode: UITextInputMode) -> Locale.LanguageCode? {
|
||||||
guard let bcp47Lang = mode.primaryLanguage else {
|
guard let bcp47Lang = mode.primaryLanguage,
|
||||||
|
!bcp47Lang.isEmpty else {
|
||||||
return nil
|
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 == "-" {
|
if maybeIso639Code.last == "-" {
|
||||||
maybeIso639Code = maybeIso639Code[..<maybeIso639Code.index(before: maybeIso639Code.endIndex)]
|
maybeIso639Code = maybeIso639Code[..<maybeIso639Code.index(before: maybeIso639Code.endIndex)]
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,7 +247,7 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
|
||||||
explore.loadViewIfNeeded()
|
explore.loadViewIfNeeded()
|
||||||
|
|
||||||
let search = secondaryNavController.viewControllers.first as! InlineTrendsViewController
|
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.
|
// Copy the search query from the search VC to the Explore VC's search controller.
|
||||||
let query = search.searchController.searchBar.text ?? ""
|
let query = search.searchController.searchBar.text ?? ""
|
||||||
explore.searchController.searchBar.text = query
|
explore.searchController.searchBar.text = query
|
||||||
|
|
|
@ -240,7 +240,9 @@ class ActionNotificationGroupCollectionViewCell: UICollectionViewListCell {
|
||||||
|
|
||||||
override var accessibilityLabel: String? {
|
override var accessibilityLabel: String? {
|
||||||
get {
|
get {
|
||||||
let first = group.notifications.first!
|
guard let first = group.notifications.first else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
var str = ""
|
var str = ""
|
||||||
switch group.kind {
|
switch group.kind {
|
||||||
case .favourite:
|
case .favourite:
|
||||||
|
|
|
@ -263,6 +263,9 @@ class NotificationsCollectionViewController: UIViewController, TimelineLikeColle
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var snapshot = dataSource.snapshot()
|
var snapshot = dataSource.snapshot()
|
||||||
|
guard snapshot.sectionIdentifiers.contains(.notifications) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
let items = snapshot.itemIdentifiers(inSection: .notifications)
|
let items = snapshot.itemIdentifiers(inSection: .notifications)
|
||||||
let toDelete = statusIDs.flatMap { id in
|
let toDelete = statusIDs.flatMap { id in
|
||||||
items.lazy.filter { $0.group?.notifications.first?.status?.id == id }
|
items.lazy.filter { $0.group?.notifications.first?.status?.id == id }
|
||||||
|
|
|
@ -77,7 +77,11 @@ struct TipJarView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onPreferenceChange(ButtonWidthKey.self) { newValue in
|
.onPreferenceChange(ButtonWidthKey.self) { newValue in
|
||||||
self.buttonWidth = newValue
|
if let buttonWidth {
|
||||||
|
self.buttonWidth = max(buttonWidth, newValue)
|
||||||
|
} else {
|
||||||
|
self.buttonWidth = newValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let total = getTotalTips(), total > 0 {
|
if let total = getTotalTips(), total > 0 {
|
||||||
|
|
|
@ -105,7 +105,11 @@ class PollOptionsView: UIControl {
|
||||||
|
|
||||||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||||
// don't let subviews receive touch events
|
// don't let subviews receive touch events
|
||||||
return self
|
if isEnabled {
|
||||||
|
return self
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - UIControl
|
// MARK: - UIControl
|
||||||
|
|
|
@ -32,10 +32,12 @@ class PollVoteButton: UIView {
|
||||||
|
|
||||||
button.translatesAutoresizingMaskIntoConstraints = false
|
button.translatesAutoresizingMaskIntoConstraints = false
|
||||||
button.setTitleColor(.secondaryLabel, for: .disabled)
|
button.setTitleColor(.secondaryLabel, for: .disabled)
|
||||||
|
button.contentHorizontalAlignment = .trailing
|
||||||
embedSubview(button)
|
embedSubview(button)
|
||||||
#if targetEnvironment(macCatalyst)
|
#if targetEnvironment(macCatalyst)
|
||||||
label.textColor = .secondaryLabel
|
label.textColor = .secondaryLabel
|
||||||
label.translatesAutoresizingMaskIntoConstraints = false
|
label.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
label.textAlignment = .right
|
||||||
embedSubview(label)
|
embedSubview(label)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ class StatusPollView: UIView, StatusContentPollView {
|
||||||
voteButton.translatesAutoresizingMaskIntoConstraints = false
|
voteButton.translatesAutoresizingMaskIntoConstraints = false
|
||||||
voteButton.addTarget(self, action: #selector(votePressed))
|
voteButton.addTarget(self, action: #selector(votePressed))
|
||||||
voteButton.setFont(infoLabel.font)
|
voteButton.setFont(infoLabel.font)
|
||||||
|
voteButton.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
||||||
addSubview(voteButton)
|
addSubview(voteButton)
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
@ -77,7 +78,7 @@ class StatusPollView: UIView, StatusContentPollView {
|
||||||
infoLabel.leadingAnchor.constraint(equalTo: leadingAnchor),
|
infoLabel.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||||
infoLabel.topAnchor.constraint(equalTo: optionsView.bottomAnchor),
|
infoLabel.topAnchor.constraint(equalTo: optionsView.bottomAnchor),
|
||||||
infoLabel.bottomAnchor.constraint(equalTo: 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.widthAnchor.constraint(greaterThanOrEqualToConstant: 44),
|
||||||
voteButton.trailingAnchor.constraint(equalTo: trailingAnchor),
|
voteButton.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||||
|
@ -141,7 +142,7 @@ class StatusPollView: UIView, StatusContentPollView {
|
||||||
}
|
}
|
||||||
|
|
||||||
func estimateHeight(effectiveWidth: CGFloat) -> CGFloat {
|
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
|
return optionsView.estimateHeight(effectiveWidth: effectiveWidth) + infoLabel.sizeThatFits(UIView.layoutFittingExpandedSize).height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,7 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status
|
||||||
]).configure {
|
]).configure {
|
||||||
$0.axis = .horizontal
|
$0.axis = .horizontal
|
||||||
$0.spacing = 8
|
$0.spacing = 8
|
||||||
|
$0.distribution = .fillProportionally
|
||||||
}
|
}
|
||||||
|
|
||||||
private let timestampAndClientLabel = UILabel().configure {
|
private let timestampAndClientLabel = UILabel().configure {
|
||||||
|
@ -326,7 +327,12 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status
|
||||||
}
|
}
|
||||||
|
|
||||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
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
|
// MARK: Configure UI
|
||||||
|
|
|
@ -784,7 +784,8 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
}
|
}
|
||||||
|
|
||||||
func contextMenuConfiguration() -> UIContextMenuConfiguration? {
|
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 nil
|
||||||
}
|
}
|
||||||
return UIContextMenuConfiguration {
|
return UIContextMenuConfiguration {
|
||||||
|
|
Loading…
Reference in New Issue