Compare commits
3 Commits
e7e141bd1e
...
421881d461
Author | SHA1 | Date |
---|---|---|
Shadowfacts | 421881d461 | |
Shadowfacts | c78f152670 | |
Shadowfacts | dabcae0905 |
|
@ -288,9 +288,11 @@ extension ComposeHostingController: AssetPickerViewControllerDelegate {
|
||||||
let attachments = attachments.map {
|
let attachments = attachments.map {
|
||||||
CompositionAttachment(data: $0)
|
CompositionAttachment(data: $0)
|
||||||
}
|
}
|
||||||
|
withAnimation {
|
||||||
draft.attachments.append(contentsOf: attachments)
|
draft.attachments.append(contentsOf: attachments)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension ComposeHostingController: DraftsTableViewControllerDelegate {
|
extension ComposeHostingController: DraftsTableViewControllerDelegate {
|
||||||
func draftSelectionCanceled() {
|
func draftSelectionCanceled() {
|
||||||
|
|
|
@ -245,34 +245,6 @@ extension ProfileViewController: ProfileHeaderViewDelegate {
|
||||||
view.pagesSegmentedControl.isUserInteractionEnabled = true
|
view.pagesSegmentedControl.isUserInteractionEnabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func profileHeader(_ view: ProfileHeaderView, showMoreOptionsFor accountID: String, sourceView: UIView) {
|
|
||||||
let account = mastodonController.persistentContainer.account(for: accountID)!
|
|
||||||
|
|
||||||
func showActivityController(activities: [UIActivity]) {
|
|
||||||
let activityController = UIActivityViewController(activityItems: [account.url, AccountActivityItemSource(account)], applicationActivities: activities)
|
|
||||||
activityController.completionWithItemsHandler = OpenInSafariActivity.completionHandler(navigator: self, url: account.url)
|
|
||||||
activityController.popoverPresentationController?.sourceView = sourceView
|
|
||||||
self.present(activityController, animated: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
if account.id == mastodonController.account.id {
|
|
||||||
showActivityController(activities: [OpenInSafariActivity()])
|
|
||||||
} else {
|
|
||||||
let request = Client.getRelationships(accounts: [account.id])
|
|
||||||
mastodonController.run(request) { (response) in
|
|
||||||
var customActivities: [UIActivity] = [OpenInSafariActivity()]
|
|
||||||
if case let .success(results, _) = response, let relationship = results.first {
|
|
||||||
let toggleFollowActivity = relationship.following ? UnfollowAccountActivity() : FollowAccountActivity()
|
|
||||||
customActivities.insert(toggleFollowActivity, at: 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
showActivityController(activities: customActivities)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProfileViewController: TabBarScrollableViewController {
|
extension ProfileViewController: TabBarScrollableViewController {
|
||||||
|
|
|
@ -12,8 +12,6 @@ import Combine
|
||||||
|
|
||||||
protocol ProfileHeaderViewDelegate: TuskerNavigationDelegate {
|
protocol ProfileHeaderViewDelegate: TuskerNavigationDelegate {
|
||||||
func profileHeader(_ headerView: ProfileHeaderView, selectedPostsIndexChangedTo newIndex: Int)
|
func profileHeader(_ headerView: ProfileHeaderView, selectedPostsIndexChangedTo newIndex: Int)
|
||||||
|
|
||||||
func profileHeader(_ headerView: ProfileHeaderView, showMoreOptionsFor accountID: String, sourceView: UIView)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProfileHeaderView: UIView {
|
class ProfileHeaderView: UIView {
|
||||||
|
|
|
@ -314,4 +314,19 @@ extension TimelineStatusTableViewCell: UIContextMenuInteractionDelegate {
|
||||||
return UIMenu(title: "", image: nil, identifier: nil, options: [], children: self.actionsForProfile(accountID: self.accountID, sourceView: self.avatarImageView))
|
return UIMenu(title: "", image: nil, identifier: nil, options: [], children: self.actionsForProfile(accountID: self.accountID, sourceView: self.avatarImageView))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) {
|
||||||
|
if let viewController = animator.previewViewController,
|
||||||
|
let delegate = navigationDelegate {
|
||||||
|
animator.preferredCommitStyle = .pop
|
||||||
|
animator.addCompletion {
|
||||||
|
if let customPresenting = viewController as? CustomPreviewPresenting {
|
||||||
|
customPresenting.presentFromPreview(presenter: delegate)
|
||||||
|
} else {
|
||||||
|
delegate.show(viewController)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue