Compare commits

..

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

7 changed files with 32 additions and 76 deletions

View File

@ -29,7 +29,6 @@ public final class ComposeController: ViewController {
@Published public var currentAccount: (any AccountProtocol)?
@Published public var showToolbar = true
@Published public var deleteDraftOnDisappear = true
@Published var autocompleteController: AutocompleteController!
@Published var toolbarController: ToolbarController!
@ -71,15 +70,6 @@ public final class ComposeController: ViewController {
draft.poll == nil || draft.poll!.pollOptions.allSatisfy { !$0.text.isEmpty }
}
public var navigationTitle: String {
if let id = draft.inReplyToID,
let status = fetchStatus(id) {
return "Reply to @\(status.account.acct)"
} else {
return "New Post"
}
}
public init(
draft: Draft,
config: ComposeUIConfig,
@ -215,7 +205,7 @@ public final class ComposeController: ViewController {
}
func onDisappear() {
if deleteDraftOnDisappear && (!draft.hasContent || didPostSuccessfully) {
if !draft.hasContent || didPostSuccessfully {
DraftsPersistentContainer.shared.viewContext.delete(draft)
}
DraftsPersistentContainer.shared.save()
@ -290,7 +280,16 @@ public final class ComposeController: ViewController {
Text(error.localizedDescription)
})
.onDisappear(perform: controller.onDisappear)
.navigationTitle(controller.navigationTitle)
.navigationTitle(navTitle)
}
private var navTitle: String {
if let id = draft.inReplyToID,
let status = controller.fetchStatus(id) {
return "Reply to @\(status.account.acct)"
} else {
return "New Post"
}
}
private var mainList: some View {

View File

@ -16,6 +16,16 @@ public class Poll: NSManagedObject {
@NSManaged public var draft: Draft
@NSManaged public var options: NSMutableOrderedSet
init(context: NSManagedObjectContext) {
super.init(entity: context.persistentStoreCoordinator!.managedObjectModel.entitiesByName["Poll"]!, insertInto: context)
self.multiple = false
self.duration = 24 * 60 * 60 // 1 day
self.options = [
PollOption(context: context),
PollOption(context: context),
]
}
public var pollOptions: [PollOption] {
get {
options.array as! [PollOption]
@ -25,18 +35,6 @@ public class Poll: NSManagedObject {
}
}
public override func awakeFromInsert() {
super.awakeFromInsert()
self.multiple = false
self.duration = 24 * 60 * 60 // 1 day
if let managedObjectContext {
self.options = [
PollOption(context: managedObjectContext),
PollOption(context: managedObjectContext),
]
}
}
}
extension Poll {

View File

@ -2477,7 +2477,7 @@
INFOPLIST_FILE = ShareExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = ShareExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Shadowfacts. All rights reserved.";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -2506,7 +2506,7 @@
INFOPLIST_FILE = ShareExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = ShareExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Shadowfacts. All rights reserved.";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -2535,7 +2535,7 @@
INFOPLIST_FILE = ShareExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = ShareExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Shadowfacts. All rights reserved.";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",

View File

@ -28,6 +28,7 @@ class ComposeHostingController: UIHostingController<ComposeHostingController.Vie
let controller: ComposeController
let mastodonController: MastodonController
private var assetPickerCompletion: (@MainActor ([PHPickerResult]) -> Void)?
private var drawingCompletion: ((PKDrawing) -> Void)?
@ -55,9 +56,6 @@ class ComposeHostingController: UIHostingController<ComposeHostingController.Vie
pasteConfiguration = UIPasteConfiguration(forAccepting: DraftAttachment.self)
NotificationCenter.default.addObserver(self, selector: #selector(updateConfig), name: .preferencesChanged, object: nil)
// set an initial title immediately, in case we're starting ducked
self.navigationItem.title = self.controller.navigationTitle
}
required init?(coder aDecoder: NSCoder) {
@ -139,8 +137,6 @@ class ComposeHostingController: UIHostingController<ComposeHostingController.Vie
// MARK: Duckable
func duckableViewControllerWillAnimateDuck(withDuration duration: CGFloat, afterDelay delay: CGFloat) {
controller.deleteDraftOnDisappear = false
withAnimation(.linear(duration: duration).delay(delay)) {
controller.showToolbar = false
}

View File

@ -24,15 +24,6 @@ class MainSplitViewController: UISplitViewController {
viewController(for: .secondary) as? SplitNavigationController
}
private var sidebarVisibile: Bool {
get {
(UserDefaults.standard.object(forKey: "MainSplitViewControllerSidebarVisible") as? Bool) ?? true
}
set {
UserDefaults.standard.set(newValue, forKey: "MainSplitViewControllerSidebarVisible")
}
}
init(mastodonController: MastodonController) {
self.mastodonController = mastodonController
@ -54,11 +45,6 @@ class MainSplitViewController: UISplitViewController {
sidebar.sidebarDelegate = self
setViewController(sidebar, for: .primary)
primaryBackgroundStyle = .sidebar
if sidebarVisibile {
show(.primary)
} else {
hide(.primary)
}
let splitNav = SplitNavigationController()
setViewController(splitNav, for: .secondary)
@ -369,18 +355,6 @@ extension MainSplitViewController: UISplitViewControllerDelegate {
return
}
}
func splitViewController(_ svc: UISplitViewController, willHide column: UISplitViewController.Column) {
if column == .primary {
sidebarVisibile = false
}
}
func splitViewController(_ svc: UISplitViewController, willShow column: UISplitViewController.Column) {
if column == .primary {
sidebarVisibile = true
}
}
}
extension MainSplitViewController: MainSidebarViewControllerDelegate {

View File

@ -266,11 +266,6 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie
collectionView.contentInset = .zero
}
private func reloadInitial() async {
state = .unloaded
await load()
}
private func tryLoadPinned() async {
do {
try await loadPinned()
@ -358,15 +353,10 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie
return
}
Task {
if newer == nil {
// no statuses were loaded initially, so reload the initial batch
await reloadInitial()
} else {
// TODO: coalesce these data source updates
// TODO: refresh profile
await controller.loadNewer()
await tryLoadPinned()
}
#if !targetEnvironment(macCatalyst)
collectionView.refreshControl?.endRefreshing()
#endif

View File

@ -201,7 +201,6 @@ private class ProfileFieldValueView: UIView {
if field.verifiedAt != nil {
var config = UIButton.Configuration.plain()
config.preferredSymbolConfigurationForImage = UIImage.SymbolConfiguration(scale: .medium)
config.image = UIImage(systemName: "checkmark")
config.baseForegroundColor = .systemGreen
let icon = UIButton(configuration: config)
@ -212,10 +211,10 @@ private class ProfileFieldValueView: UIView {
icon.isPointerInteractionEnabled = true
icon.accessibilityLabel = "Verified link"
addSubview(icon)
textViewTrailingConstraint = textView.trailingAnchor.constraint(equalTo: icon.leadingAnchor)
textViewTrailingConstraint = textView.trailingAnchor.constraint(equalTo: icon.leadingAnchor, constant: -4)
NSLayoutConstraint.activate([
icon.lastBaselineAnchor.constraint(equalTo: textView.lastBaselineAnchor),
icon.trailingAnchor.constraint(lessThanOrEqualTo: trailingAnchor),
icon.centerYAnchor.constraint(equalTo: centerYAnchor),
icon.trailingAnchor.constraint(equalTo: trailingAnchor),
])
} else {
textViewTrailingConstraint = textView.trailingAnchor.constraint(equalTo: trailingAnchor)