Gemini/Gemini-iOS/ActivityItemSource.swift

35 lines
927 B
Swift
Raw Normal View History

//
// ActivityItemSource.swift
// Gemini-iOS
//
// Created by Shadowfacts on 6/15/21.
//
import UIKit
import GeminiFormat
import LinkPresentation
class ActivityItemSource: NSObject, UIActivityItemSource {
let document: Document
init(document: Document) {
self.document = document
}
func activityViewControllerPlaceholderItem(_ activityViewController: UIActivityViewController) -> Any {
return document.url
}
func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivity.ActivityType?) -> Any? {
return document.url
}
func activityViewControllerLinkMetadata(_ activityViewController: UIActivityViewController) -> LPLinkMetadata? {
let metadata = LPLinkMetadata()
metadata.url = document.url
metadata.title = document.title
return metadata
}
}