39 lines
990 B
Swift
39 lines
990 B
Swift
|
//
|
||
|
// 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
|
||
|
}
|
||
|
}
|
||
|
}
|