Compare commits

...

3 Commits

Author SHA1 Message Date
Shadowfacts 0b6c16b0a6 Fix newly created statuses/accounts not having lastFetchedAt set
awakeFromFetch is only called on existing objects
2022-05-06 10:24:50 -04:00
Shadowfacts 5f566724bb Fix compose CW field overflowing 2022-05-03 20:14:55 -04:00
Shadowfacts 4a89ae3cfe Don't cache state of follow menu action
Fixes #151
2022-05-02 17:59:03 -04:00
4 changed files with 16 additions and 1 deletions

View File

@ -61,6 +61,7 @@ extension AccountMO {
convenience init(apiAccount account: Pachyderm.Account, container: MastodonCachePersistentStore, context: NSManagedObjectContext) {
self.init(context: context)
self.updateFrom(apiAccount: account, container: container)
self.lastFetchedAt = Date()
}
func updateFrom(apiAccount account: Pachyderm.Account, container: MastodonCachePersistentStore) {

View File

@ -91,6 +91,7 @@ extension StatusMO {
convenience init(apiStatus status: Pachyderm.Status, container: MastodonCachePersistentStore, context: NSManagedObjectContext) {
self.init(context: context)
self.updateFrom(apiStatus: status, container: container)
self.lastFetchedAt = Date()
}
func updateFrom(apiStatus status: Pachyderm.Status, container: MastodonCachePersistentStore) {

View File

@ -52,6 +52,9 @@ struct ComposeEmojiTextField: UIViewRepresentable {
view.backgroundColor = backgroundColor
// otherwise when the text gets too wide it starts expanding the ComposeView
view.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
context.coordinator.textField = view
context.coordinator.uiState = uiState
context.coordinator.text = $text

View File

@ -59,7 +59,7 @@ extension MenuActionProvider {
draft.visibility = .direct
self.navigationDelegate?.compose(editing: draft)
}),
UIDeferredMenuElement({ (elementHandler) in
UIDeferredMenuElement.uncachedIfPossible({ (elementHandler) in
Task { @MainActor in
if let action = await self.followAction(for: accountID, mastodonController: mastodonController) {
elementHandler([action])
@ -339,3 +339,13 @@ extension SFSafariViewController: CustomPreviewPresenting {
presenter.present(self, animated: true)
}
}
private extension UIDeferredMenuElement {
static func uncachedIfPossible(_ elementProvider: @escaping (@escaping ([UIMenuElement]) -> Void) -> Void) -> UIDeferredMenuElement {
if #available(iOS 15.0, *) {
return UIDeferredMenuElement.uncached(elementProvider)
} else {
return UIDeferredMenuElement(elementProvider)
}
}
}