Compare commits
No commits in common. "d15fa2199e6a662296c3ef0782eef54d5f0bd6d3" and "b61418e06274efcad5b7b39bf8bce919735aac3a" have entirely different histories.
d15fa2199e
...
b61418e062
|
@ -22,23 +22,6 @@ public class Card: Decodable {
|
||||||
public let width: Int?
|
public let width: Int?
|
||||||
public let height: Int?
|
public let height: Int?
|
||||||
|
|
||||||
public required init(from decoder: Decoder) throws {
|
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
|
||||||
|
|
||||||
self.url = try container.decode(URL.self, forKey: .url)
|
|
||||||
self.title = try container.decode(String.self, forKey: .title)
|
|
||||||
self.description = try container.decode(String.self, forKey: .description)
|
|
||||||
self.kind = try container.decode(Kind.self, forKey: .kind)
|
|
||||||
self.image = try? container.decode(URL.self, forKey: .image)
|
|
||||||
self.authorName = try? container.decode(String.self, forKey: .authorName)
|
|
||||||
self.authorURL = try? container.decode(URL.self, forKey: .authorURL)
|
|
||||||
self.providerName = try? container.decode(String.self, forKey: .providerName)
|
|
||||||
self.providerURL = try? container.decode(URL.self, forKey: .providerURL)
|
|
||||||
self.html = try? container.decode(String.self, forKey: .html)
|
|
||||||
self.width = try? container.decode(Int.self, forKey: .width)
|
|
||||||
self.height = try? container.decode(Int.self, forKey: .height)
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case url
|
case url
|
||||||
case title
|
case title
|
||||||
|
|
|
@ -36,7 +36,6 @@ public class Status: Decodable {
|
||||||
public let language: String?
|
public let language: String?
|
||||||
public let pinned: Bool?
|
public let pinned: Bool?
|
||||||
public let bookmarked: Bool?
|
public let bookmarked: Bool?
|
||||||
public let card: Card?
|
|
||||||
|
|
||||||
public static func getContext(_ status: Status) -> Request<ConversationContext> {
|
public static func getContext(_ status: Status) -> Request<ConversationContext> {
|
||||||
return Request<ConversationContext>(method: .get, path: "/api/v1/statuses/\(status.id)/context")
|
return Request<ConversationContext>(method: .get, path: "/api/v1/statuses/\(status.id)/context")
|
||||||
|
@ -129,7 +128,6 @@ public class Status: Decodable {
|
||||||
case language
|
case language
|
||||||
case pinned
|
case pinned
|
||||||
case bookmarked
|
case bookmarked
|
||||||
case card
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,6 +218,14 @@ class ComposeViewController: UIViewController {
|
||||||
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
|
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func viewDidLayoutSubviews() {
|
||||||
|
super.viewDidLayoutSubviews()
|
||||||
|
|
||||||
|
// if inReplyToID != nil {
|
||||||
|
// scrollView.contentOffset = CGPoint(x: 0, y: stackView.arrangedSubviews.first!.frame.height)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||||
super.traitCollectionDidChange(previousTraitCollection)
|
super.traitCollectionDidChange(previousTraitCollection)
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,6 @@ class DraftsTableViewController: UITableViewController {
|
||||||
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
|
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
|
||||||
guard editingStyle == .delete else { return }
|
guard editingStyle == .delete else { return }
|
||||||
DraftsManager.shared.remove(draft(for: indexPath))
|
DraftsManager.shared.remove(draft(for: indexPath))
|
||||||
drafts.remove(at: indexPath.row)
|
|
||||||
tableView.deleteRows(at: [indexPath], with: .automatic)
|
tableView.deleteRows(at: [indexPath], with: .automatic)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class NotificationsTableViewController: EnhancedTableViewController {
|
||||||
tableView.register(UINib(nibName: "ActionNotificationGroupTableViewCell", bundle: .main), forCellReuseIdentifier: actionGroupCell)
|
tableView.register(UINib(nibName: "ActionNotificationGroupTableViewCell", bundle: .main), forCellReuseIdentifier: actionGroupCell)
|
||||||
tableView.register(UINib(nibName: "FollowNotificationGroupTableViewCell", bundle: .main), forCellReuseIdentifier: followGroupCell)
|
tableView.register(UINib(nibName: "FollowNotificationGroupTableViewCell", bundle: .main), forCellReuseIdentifier: followGroupCell)
|
||||||
tableView.register(UINib(nibName: "FollowRequestNotificationTableViewCell", bundle: .main), forCellReuseIdentifier: followRequestCell)
|
tableView.register(UINib(nibName: "FollowRequestNotificationTableViewCell", bundle: .main), forCellReuseIdentifier: followRequestCell)
|
||||||
tableView.register(UINib(nibName: "BasicTableViewCell", bundle: .main), forCellReuseIdentifier: unknownCell)
|
tableView.register(UINib(nibName: "UnknownNotificationTableViewCell", bundle: .main), forCellReuseIdentifier: unknownCell)
|
||||||
|
|
||||||
tableView.prefetchDataSource = self
|
tableView.prefetchDataSource = self
|
||||||
|
|
||||||
|
@ -120,9 +120,7 @@ class NotificationsTableViewController: EnhancedTableViewController {
|
||||||
return cell
|
return cell
|
||||||
|
|
||||||
case .unknown:
|
case .unknown:
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: unknownCell, for: indexPath)
|
return tableView.dequeueReusableCell(withIdentifier: unknownCell, for: indexPath)
|
||||||
cell.textLabel!.text = NSLocalizedString("Unknown Notification", comment: "unknown notification fallback cell text")
|
|
||||||
return cell
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,30 @@
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
//struct SilentActionPermission: Identifiable {
|
||||||
|
// let application: String
|
||||||
|
// let permission: Preferences.Permission
|
||||||
|
//
|
||||||
|
// var id: String {
|
||||||
|
// return application
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// init(_ application: String, _ permission: Preferences.Permission) {
|
||||||
|
// self.application = application
|
||||||
|
// self.permission = permission
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
struct SilentActionPrefs : View {
|
struct SilentActionPrefs : View {
|
||||||
|
// @MappedPreference(\.silentActions, fromPref: {
|
||||||
|
// var array = [SilentActionPermission]()
|
||||||
|
// for (application, permission) in $0 {
|
||||||
|
// array.append(SilentActionPermission(application, permission))
|
||||||
|
// }
|
||||||
|
// return array
|
||||||
|
// })
|
||||||
|
// var silentActionPermissions: [SilentActionPermission]
|
||||||
|
// @Preference(\.silentActions) var silentActions: [String: Preferences.Permission]
|
||||||
@ObservedObject var preferences = Preferences.shared
|
@ObservedObject var preferences = Preferences.shared
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
@ -17,12 +40,22 @@ struct SilentActionPrefs : View {
|
||||||
.listStyle(GroupedListStyle())
|
.listStyle(GroupedListStyle())
|
||||||
// .navigationBarTitle("Silent Action Permissions")
|
// .navigationBarTitle("Silent Action Permissions")
|
||||||
// see FB6838291
|
// see FB6838291
|
||||||
|
// List(Array(silentActions.keys).identified(by: \.self)) { application in
|
||||||
|
// Text(application)
|
||||||
|
//// Toggle(isOn: Binding(getValue: { self.silentActions[application] == .accepted }, setValue: { self.silentActions[application] = $0 ? .accepted : .rejected }), label: Text(application))
|
||||||
|
// }.listStyle(.grouped)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SilentActionPermissionCell: View {
|
struct SilentActionPermissionCell: View {
|
||||||
@ObservedObject var preferences = Preferences.shared
|
@EnvironmentObject var preferences: Preferences
|
||||||
let source: String
|
let source: String
|
||||||
|
// var binding: Binding<Bool>
|
||||||
|
|
||||||
|
init(source: String) {
|
||||||
|
self.source = source
|
||||||
|
// self.binding = Binding(getValue: { self.preferences.silentActions[source] == .accepted }, setValue: { self.preferences.silentActions[source] = $0 ? .accepted : .rejected })
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Toggle(isOn: Binding(get: {
|
Toggle(isOn: Binding(get: {
|
||||||
|
|
|
@ -24,6 +24,7 @@ class UserActivityManager {
|
||||||
let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first!
|
let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first!
|
||||||
let window = scene.windows.first { $0.isKeyWindow }!
|
let window = scene.windows.first { $0.isKeyWindow }!
|
||||||
return window.rootViewController as! MainTabBarViewController
|
return window.rootViewController as! MainTabBarViewController
|
||||||
|
// return (UIApplication.shared.delegate! as! AppDelegate).window!.rootViewController as! MainTabBarViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func present(_ vc: UIViewController, animated: Bool = true) {
|
private static func present(_ vc: UIViewController, animated: Bool = true) {
|
||||||
|
|
|
@ -19,7 +19,6 @@ class AttachmentsContainerView: UIView {
|
||||||
var attachments: [Attachment]!
|
var attachments: [Attachment]!
|
||||||
|
|
||||||
let attachmentViews: NSHashTable<AttachmentView> = .weakObjects()
|
let attachmentViews: NSHashTable<AttachmentView> = .weakObjects()
|
||||||
var moreView: UIView?
|
|
||||||
|
|
||||||
var blurView: UIVisualEffectView?
|
var blurView: UIVisualEffectView?
|
||||||
var hideButtonView: UIVisualEffectView?
|
var hideButtonView: UIVisualEffectView?
|
||||||
|
@ -54,7 +53,6 @@ class AttachmentsContainerView: UIView {
|
||||||
|
|
||||||
attachmentViews.allObjects.forEach { $0.removeFromSuperview() }
|
attachmentViews.allObjects.forEach { $0.removeFromSuperview() }
|
||||||
attachmentViews.removeAllObjects()
|
attachmentViews.removeAllObjects()
|
||||||
moreView?.removeFromSuperview()
|
|
||||||
|
|
||||||
if attachments.count > 0 {
|
if attachments.count > 0 {
|
||||||
self.isHidden = false
|
self.isHidden = false
|
||||||
|
@ -130,7 +128,6 @@ class AttachmentsContainerView: UIView {
|
||||||
accessibilityElements.append(bottomRight)
|
accessibilityElements.append(bottomRight)
|
||||||
default: // more than 4
|
default: // more than 4
|
||||||
let moreView = UIView()
|
let moreView = UIView()
|
||||||
self.moreView = moreView
|
|
||||||
moreView.backgroundColor = .secondarySystemBackground
|
moreView.backgroundColor = .secondarySystemBackground
|
||||||
moreView.translatesAutoresizingMaskIntoConstraints = false
|
moreView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
moreView.isUserInteractionEnabled = true
|
moreView.isUserInteractionEnabled = true
|
||||||
|
|
|
@ -157,3 +157,28 @@ class ProfileHeaderTableViewCell: UITableViewCell {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//extension ProfileHeaderTableViewCell: MenuPreviewProvider {
|
||||||
|
// var navigationDelegate: TuskerNavigationDelegate? { return delegate }
|
||||||
|
// func getPreviewProviders(for location: CGPoint, sourceViewController: UIViewController) -> PreviewProviders? {
|
||||||
|
// let noteLabelPoint = noteLabel.convert(location, from: self)
|
||||||
|
// if noteLabel.bounds.contains(noteLabelPoint),
|
||||||
|
// let link = noteLabel.getLink(atPoint: noteLabelPoint) {
|
||||||
|
// return (
|
||||||
|
// content: { self.noteLabel.getViewController(forLink: link.url, inRange: link.range) },
|
||||||
|
// actions: {
|
||||||
|
// let text = (self.noteLabel.text! as NSString).substring(with: link.range)
|
||||||
|
// if let mention = self.noteLabel.getMention(for: link.url, text: text) {
|
||||||
|
// return self.actionsForProfile(accountID: mention.id, sourceView: self)
|
||||||
|
// } else if let hashtag = self.noteLabel.getHashtag(for: link.url, text: text) {
|
||||||
|
// return self.actionsForHashtag(hashtag, sourceView: self)
|
||||||
|
// } else {
|
||||||
|
// return self.actionsForURL(link.url, sourceView: self)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// } else {
|
||||||
|
// return nil
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class BaseStatusTableViewCell: UITableViewCell {
|
||||||
@IBOutlet weak var avatarImageView: UIImageView!
|
@IBOutlet weak var avatarImageView: UIImageView!
|
||||||
@IBOutlet weak var displayNameLabel: EmojiLabel!
|
@IBOutlet weak var displayNameLabel: EmojiLabel!
|
||||||
@IBOutlet weak var usernameLabel: UILabel!
|
@IBOutlet weak var usernameLabel: UILabel!
|
||||||
@IBOutlet weak var contentWarningLabel: EmojiLabel!
|
@IBOutlet weak var contentWarningLabel: UILabel!
|
||||||
@IBOutlet weak var collapseButton: UIButton!
|
@IBOutlet weak var collapseButton: UIButton!
|
||||||
@IBOutlet weak var contentTextView: StatusContentTextView!
|
@IBOutlet weak var contentTextView: StatusContentTextView!
|
||||||
@IBOutlet weak var attachmentsView: AttachmentsContainerView!
|
@IBOutlet weak var attachmentsView: AttachmentsContainerView!
|
||||||
|
@ -137,9 +137,6 @@ class BaseStatusTableViewCell: UITableViewCell {
|
||||||
|
|
||||||
contentWarningLabel.text = status.spoilerText
|
contentWarningLabel.text = status.spoilerText
|
||||||
contentWarningLabel.isHidden = status.spoilerText.isEmpty
|
contentWarningLabel.isHidden = status.spoilerText.isEmpty
|
||||||
if !contentWarningLabel.isHidden {
|
|
||||||
contentWarningLabel.setEmojis(status.emojis, identifier: statusID)
|
|
||||||
}
|
|
||||||
|
|
||||||
if state.unknown {
|
if state.unknown {
|
||||||
collapsible = !status.spoilerText.isEmpty
|
collapsible = !status.spoilerText.isEmpty
|
||||||
|
@ -342,7 +339,22 @@ extension BaseStatusTableViewCell: MenuPreviewProvider {
|
||||||
actions: { [] }
|
actions: { [] }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}/* else if contentLabel.frame.contains(location),
|
||||||
|
let link = contentLabel.getLink(atPoint: contentLabel.convert(location, from: self)) {
|
||||||
|
return (
|
||||||
|
content: { self.contentLabel.getViewController(forLink: link.url, inRange: link.range) },
|
||||||
|
actions: {
|
||||||
|
let text = (self.contentLabel.text! as NSString).substring(with: link.range)
|
||||||
|
if let mention = self.contentLabel.getMention(for: link.url, text: text) {
|
||||||
|
return self.actionsForProfile(accountID: mention.id, sourceView: self)
|
||||||
|
} else if let hashtag = self.contentLabel.getHashtag(for: link.url, text: text) {
|
||||||
|
return self.actionsForHashtag(hashtag, sourceView: self)
|
||||||
|
} else {
|
||||||
|
return self.actionsForURL(link.url, sourceView: self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}*/
|
||||||
return self.getStatusCellPreviewProviders(for: location, sourceViewController: sourceViewController)
|
return self.getStatusCellPreviewProviders(for: location, sourceViewController: sourceViewController)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<constraint firstItem="SWg-Ka-QyP" firstAttribute="top" secondItem="lZY-2e-17d" secondAttribute="bottom" id="lvX-1b-8cN"/>
|
<constraint firstItem="SWg-Ka-QyP" firstAttribute="top" secondItem="lZY-2e-17d" secondAttribute="bottom" id="lvX-1b-8cN"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="Content Warning" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cwQ-mR-L1b" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="Content Warning" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cwQ-mR-L1b">
|
||||||
<rect key="frame" x="0.0" y="58" width="138" height="20.5"/>
|
<rect key="frame" x="0.0" y="58" width="138" height="20.5"/>
|
||||||
<accessibility key="accessibilityConfiguration">
|
<accessibility key="accessibilityConfiguration">
|
||||||
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
<constraint firstAttribute="height" secondItem="gll-xe-FSr" secondAttribute="height" id="B7p-Pc-fZD"/>
|
<constraint firstAttribute="height" secondItem="gll-xe-FSr" secondAttribute="height" id="B7p-Pc-fZD"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</stackView>
|
</stackView>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="755" text="Content Warning" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="inI-Og-YiU" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="755" text="Content Warning" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="inI-Og-YiU">
|
||||||
<rect key="frame" x="0.0" y="24.5" width="277" height="20.5"/>
|
<rect key="frame" x="0.0" y="24.5" width="277" height="20.5"/>
|
||||||
<accessibility key="accessibilityConfiguration">
|
<accessibility key="accessibilityConfiguration">
|
||||||
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
||||||
|
|
Loading…
Reference in New Issue