Compare commits

..

No commits in common. "2febb37a8ed7867f178ee7b47d2922838b4079d1" and "6c5909c80019ba4cc2b9e1216bd1d64910296541" have entirely different histories.

6 changed files with 6 additions and 35 deletions

View File

@ -244,13 +244,6 @@ public final class ComposeController: ViewController {
} }
var body: some View { var body: some View {
NavigationView {
navRoot
}
.navigationViewStyle(.stack)
}
private var navRoot: some View {
ZStack(alignment: .top) { ZStack(alignment: .top) {
// just using .background doesn't work; for some reason it gets inset immediately after the software keyboard is dismissed // just using .background doesn't work; for some reason it gets inset immediately after the software keyboard is dismissed
config.backgroundColor config.backgroundColor
@ -298,7 +291,6 @@ public final class ComposeController: ViewController {
}) })
.onDisappear(perform: controller.onDisappear) .onDisappear(perform: controller.onDisappear)
.navigationTitle(controller.navigationTitle) .navigationTitle(controller.navigationTitle)
.navigationBarTitleDisplayMode(.inline)
} }
private var mainList: some View { private var mainList: some View {

View File

@ -58,13 +58,6 @@ public final class DraftAttachment: NSManagedObject, Identifiable {
case file(URL, UTType) case file(URL, UTType)
} }
public override func prepareForDeletion() {
super.prepareForDeletion()
if let fileURL {
try? FileManager.default.removeItem(at: fileURL)
}
}
} }
extension DraftAttachment { extension DraftAttachment {

View File

@ -10,8 +10,6 @@ import UIKit
public protocol DuckableViewController: UIViewController { public protocol DuckableViewController: UIViewController {
var duckableDelegate: DuckableViewControllerDelegate? { get set } var duckableDelegate: DuckableViewControllerDelegate? { get set }
func duckableViewControllerShouldDuck() -> Bool
func duckableViewControllerMayAttemptToDuck() func duckableViewControllerMayAttemptToDuck()
func duckableViewControllerWillAnimateDuck(withDuration duration: CGFloat, afterDelay delay: CGFloat) func duckableViewControllerWillAnimateDuck(withDuration duration: CGFloat, afterDelay delay: CGFloat)
@ -20,7 +18,6 @@ public protocol DuckableViewController: UIViewController {
} }
extension DuckableViewController { extension DuckableViewController {
public func duckableViewControllerShouldDuck() -> Bool { true }
public func duckableViewControllerMayAttemptToDuck() {} public func duckableViewControllerMayAttemptToDuck() {}
public func duckableViewControllerWillAnimateDuck(withDuration duration: CGFloat, afterDelay delay: CGFloat) {} public func duckableViewControllerWillAnimateDuck(withDuration duration: CGFloat, afterDelay delay: CGFloat) {}
public func duckableViewControllerDidFinishAnimatingDuck() {} public func duckableViewControllerDidFinishAnimatingDuck() {}

View File

@ -63,9 +63,6 @@ class DuckAnimationController: NSObject, UIViewControllerAnimatedTransitioning {
let fadeAnimator = UIViewPropertyAnimator(duration: 0.1, curve: .linear) { let fadeAnimator = UIViewPropertyAnimator(duration: 0.1, curve: .linear) {
presented.view.layer.opacity = 0 presented.view.layer.opacity = 0
} }
fadeAnimator.addCompletion { _ in
presented.view.layer.opacity = 1
}
fadeAnimator.startAnimation(afterDelay: 0.3) fadeAnimator.startAnimation(afterDelay: 0.3)
} else { } else {
@ -83,7 +80,6 @@ class DuckAnimationController: NSObject, UIViewControllerAnimatedTransitioning {
presented.view.layer.opacity = 0 presented.view.layer.opacity = 0
} }
fadeAnimator.addCompletion { _ in fadeAnimator.addCompletion { _ in
presented.view.layer.opacity = 1
duckable.duckableViewControllerDidFinishAnimatingDuck() duckable.duckableViewControllerDidFinishAnimatingDuck()
transitionContext.completeTransition(true) transitionContext.completeTransition(true)
} }

View File

@ -88,9 +88,10 @@ public class DuckableContainerViewController: UIViewController, DuckableViewCont
private func doPresentDuckable(_ viewController: DuckableViewController, animated: Bool, completion: (() -> Void)?) { private func doPresentDuckable(_ viewController: DuckableViewController, animated: Bool, completion: (() -> Void)?) {
viewController.duckableDelegate = self viewController.duckableDelegate = self
viewController.modalPresentationStyle = .custom let nav = UINavigationController(rootViewController: viewController)
viewController.transitioningDelegate = self nav.modalPresentationStyle = .custom
present(viewController, animated: animated) { nav.transitioningDelegate = self
present(nav, animated: animated) {
self.configureChildForDuckedPlaceholder() self.configureChildForDuckedPlaceholder()
completion?() completion?()
} }
@ -135,10 +136,6 @@ public class DuckableContainerViewController: UIViewController, DuckableViewCont
guard case .presentingDucked(let viewController, isFirstPresentation: _) = state else { guard case .presentingDucked(let viewController, isFirstPresentation: _) = state else {
return return
} }
guard viewController.duckableViewControllerShouldDuck() else {
viewController.sheetPresentationController!.selectedDetentIdentifier = .large
return
}
let placeholder = createPlaceholderForDuckedViewController(viewController) let placeholder = createPlaceholderForDuckedViewController(viewController)
state = .ducked(viewController, placeholder: placeholder) state = .ducked(viewController, placeholder: placeholder)
configureChildForDuckedPlaceholder() configureChildForDuckedPlaceholder()
@ -239,3 +236,4 @@ extension DuckableContainerViewController: UISheetPresentationControllerDelegate
} }
} }
} }

View File

@ -48,12 +48,7 @@ public final class Status: StatusProtocol, Decodable, Sendable {
let container = try decoder.container(keyedBy: CodingKeys.self) let container = try decoder.container(keyedBy: CodingKeys.self)
self.id = try container.decode(String.self, forKey: .id) self.id = try container.decode(String.self, forKey: .id)
self.uri = try container.decode(String.self, forKey: .uri) self.uri = try container.decode(String.self, forKey: .uri)
do {
self.url = try container.decodeIfPresent(WebURL.self, forKey: .url) self.url = try container.decodeIfPresent(WebURL.self, forKey: .url)
} catch {
let s = (try? container.decode(String.self, forKey: .url)) ?? "<failed to decode string>"
throw DecodingError.dataCorruptedError(forKey: .url, in: container, debugDescription: "Could not decode URL '\(s)', reason: \(String(describing: error))")
}
self.account = try container.decode(Account.self, forKey: .account) self.account = try container.decode(Account.self, forKey: .account)
self.inReplyToID = try container.decodeIfPresent(String.self, forKey: .inReplyToID) self.inReplyToID = try container.decodeIfPresent(String.self, forKey: .inReplyToID)
self.inReplyToAccountID = try container.decodeIfPresent(String.self, forKey: .inReplyToAccountID) self.inReplyToAccountID = try container.decodeIfPresent(String.self, forKey: .inReplyToAccountID)