Gemini/Gemini-iOS/SetHomepageActivity.swift

39 lines
990 B
Swift
Raw Normal View History

2021-06-16 03:21:22 +00:00
//
// SetHomepageActivity.swift
// Gemini-iOS
//
// Created by Shadowfacts on 6/15/21.
//
import UIKit
class SetHomepageActivity: UIActivity {
override class var activityCategory: UIActivity.Category {
return .action
}
override var activityTitle: String? {
return "Set as Homepage"
}
override var activityImage: UIImage? {
// large size more closely matches system activity images
return UIImage(systemName: "house", withConfiguration: UIImage.SymbolConfiguration(scale: .large))
}
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
for case let url as URL in activityItems {
return Preferences.shared.homepage != url
}
return false
}
override func prepare(withActivityItems activityItems: [Any]) {
for case let url as URL in activityItems {
Preferences.shared.homepage = url
break
}
}
}