parent
78d1fc0b73
commit
88d85ed49c
@ -0,0 +1,8 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
||||||
|
<plist version="1.0"> |
||||||
|
<dict> |
||||||
|
<key>PreviewsEnabled</key> |
||||||
|
<false/> |
||||||
|
</dict> |
||||||
|
</plist> |
||||||
@ -0,0 +1,56 @@ |
|||||||
|
// |
||||||
|
// Shortcut.swift |
||||||
|
// LeCountdown |
||||||
|
// |
||||||
|
// Created by Laurent Morvillier on 22/02/2023. |
||||||
|
// |
||||||
|
|
||||||
|
import Foundation |
||||||
|
import UIKit |
||||||
|
import CoreServices |
||||||
|
import CoreSpotlight |
||||||
|
import UniformTypeIdentifiers |
||||||
|
|
||||||
|
enum Shortcut: String { |
||||||
|
|
||||||
|
case newCountdown = "app.kikai.NewCountdown" |
||||||
|
|
||||||
|
var userActivity: NSUserActivity { |
||||||
|
let activity = NSUserActivity(activityType: self.rawValue) |
||||||
|
activity.persistentIdentifier = NSUserActivityPersistentIdentifier(self.rawValue) |
||||||
|
|
||||||
|
activity.title = self.title |
||||||
|
activity.suggestedInvocationPhrase = self.suggestedInvocationPhrase |
||||||
|
activity.isEligibleForSearch = true |
||||||
|
activity.isEligibleForPrediction = true |
||||||
|
|
||||||
|
let attributes = CSSearchableItemAttributeSet(contentType: UTType.item) |
||||||
|
attributes.contentDescription = self.contentDescription |
||||||
|
attributes.thumbnailData = self.image?.jpegData(compressionQuality: 1.0) |
||||||
|
activity.contentAttributeSet = attributes |
||||||
|
return activity |
||||||
|
} |
||||||
|
|
||||||
|
var title: String { |
||||||
|
switch self { |
||||||
|
case .newCountdown: return NSLocalizedString("New countdown", comment: "") |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
var suggestedInvocationPhrase: String { |
||||||
|
switch self { |
||||||
|
case .newCountdown: return NSLocalizedString("Create countdown", comment: "") |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
var contentDescription: String { |
||||||
|
switch self { |
||||||
|
case .newCountdown: return NSLocalizedString("Create a new countdown", comment: "") |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
var image: UIImage? { |
||||||
|
return UIImage(named: "pic1") |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
// |
||||||
|
// UIDevice+Extensions.swift |
||||||
|
// LeCountdown |
||||||
|
// |
||||||
|
// Created by Laurent Morvillier on 22/02/2023. |
||||||
|
// |
||||||
|
|
||||||
|
import Foundation |
||||||
|
import UIKit |
||||||
|
|
||||||
|
extension UIDevice { |
||||||
|
|
||||||
|
@objc static var isPadIdiom: Bool { |
||||||
|
return UIDevice.current.userInterfaceIdiom == .pad |
||||||
|
} |
||||||
|
|
||||||
|
@objc static var isPhoneIdiom: Bool { |
||||||
|
return UIDevice.current.userInterfaceIdiom == .phone |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue