Compare commits
No commits in common. "86862825f67affd865aa90d994aa998a9537cfb5" and "e57ef210fd1df4073fb0ec3d3fcbb128dcb4dd78" have entirely different histories.
86862825f6
...
e57ef210fd
|
@ -20,11 +20,7 @@ public final class ComposeController: ViewController {
|
||||||
public typealias ReplyContentView = (any StatusProtocol, @escaping (CGFloat) -> Void) -> AnyView
|
public typealias ReplyContentView = (any StatusProtocol, @escaping (CGFloat) -> Void) -> AnyView
|
||||||
public typealias EmojiImageView = (Emoji) -> AnyView
|
public typealias EmojiImageView = (Emoji) -> AnyView
|
||||||
|
|
||||||
@Published public private(set) var draft: Draft {
|
@Published public private(set) var draft: Draft
|
||||||
didSet {
|
|
||||||
assert(draft.managedObjectContext == DraftsPersistentContainer.shared.viewContext)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Published public var config: ComposeUIConfig
|
@Published public var config: ComposeUIConfig
|
||||||
@Published public var mastodonController: ComposeMastodonContext
|
@Published public var mastodonController: ComposeMastodonContext
|
||||||
let fetchAvatar: AvatarImageView.FetchAvatar
|
let fetchAvatar: AvatarImageView.FetchAvatar
|
||||||
|
@ -110,7 +106,6 @@ public final class ComposeController: ViewController {
|
||||||
emojiImageView: @escaping EmojiImageView
|
emojiImageView: @escaping EmojiImageView
|
||||||
) {
|
) {
|
||||||
self.draft = draft
|
self.draft = draft
|
||||||
assert(draft.managedObjectContext == DraftsPersistentContainer.shared.viewContext)
|
|
||||||
self.config = config
|
self.config = config
|
||||||
self.mastodonController = mastodonController
|
self.mastodonController = mastodonController
|
||||||
self.fetchAvatar = fetchAvatar
|
self.fetchAvatar = fetchAvatar
|
||||||
|
|
|
@ -35,7 +35,7 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate
|
||||||
window = UIWindow(windowScene: windowScene)
|
window = UIWindow(windowScene: windowScene)
|
||||||
|
|
||||||
showAppOrOnboardingUI(session: session)
|
showAppOrOnboardingUI(session: session)
|
||||||
if !connectionOptions.urlContexts.isEmpty {
|
if connectionOptions.urlContexts.count > 0 {
|
||||||
self.scene(scene, openURLContexts: connectionOptions.urlContexts)
|
self.scene(scene, openURLContexts: connectionOptions.urlContexts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,21 +50,14 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
||||||
guard let url = URLContexts.first?.url,
|
if URLContexts.count > 1 {
|
||||||
var components = URLComponents(url: url, resolvingAgainstBaseURL: false),
|
fatalError("Cannot open more than 1 URL")
|
||||||
let rootViewController else {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if components.host == "compose" {
|
let url = URLContexts.first!.url
|
||||||
if let mastodonController = window!.windowScene!.session.mastodonController {
|
|
||||||
let draft = mastodonController.createDraft()
|
if var components = URLComponents(url: url, resolvingAgainstBaseURL: false),
|
||||||
let text = components.queryItems?.first(where: { $0.name == "text" })?.value
|
let rootViewController = rootViewController {
|
||||||
draft.text = text ?? ""
|
|
||||||
rootViewController.compose(editing: draft, animated: true, isDucked: false)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Assume anything else is a search query
|
|
||||||
components.scheme = "https"
|
components.scheme = "https"
|
||||||
let query = components.string!
|
let query = components.string!
|
||||||
rootViewController.performSearch(query: query)
|
rootViewController.performSearch(query: query)
|
||||||
|
|
|
@ -211,10 +211,9 @@ extension TimelineLikeCollectionViewController {
|
||||||
extension TimelineLikeCollectionViewController {
|
extension TimelineLikeCollectionViewController {
|
||||||
// apply(_:animatingDifferences:) is marked as nonisolated, so just awaiting it doesn't dispatch to the main thread, unlike other async @MainActor methods
|
// apply(_:animatingDifferences:) is marked as nonisolated, so just awaiting it doesn't dispatch to the main thread, unlike other async @MainActor methods
|
||||||
// but we always want to update the data source on the main thread for consistency, so this method does that
|
// but we always want to update the data source on the main thread for consistency, so this method does that
|
||||||
|
@MainActor
|
||||||
func apply(_ snapshot: NSDiffableDataSourceSnapshot<Section, Item>, animatingDifferences: Bool) async {
|
func apply(_ snapshot: NSDiffableDataSourceSnapshot<Section, Item>, animatingDifferences: Bool) async {
|
||||||
await MainActor.run {
|
await self.dataSource.apply(snapshot, animatingDifferences: animatingDifferences)
|
||||||
dataSource?.apply(snapshot, animatingDifferences: animatingDifferences)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
|
|
Loading…
Reference in New Issue