Compare commits
No commits in common. "421881d461a0b52467eedb6beb47962f6886e2e5" and "e7e141bd1e24f11b207faa840c8b5fc51eec4257" have entirely different histories.
421881d461
...
e7e141bd1e
|
@ -288,9 +288,7 @@ 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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,6 +245,34 @@ 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,6 +12,8 @@ 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,19 +314,4 @@ 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