[AltWidget] Allows choosing featured app

This commit is contained in:
Riley Testut
2020-09-15 15:19:12 -07:00
parent 5abf7a5a11
commit 8045a23531
5 changed files with 53 additions and 2 deletions

View File

@@ -33,7 +33,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
@available(iOS 14, *)
private lazy var intentHandler = IntentHandler()
@available(iOS 14, *)
private lazy var viewAppIntentHandler = ViewAppIntentHandler()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
@@ -95,8 +99,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, handlerFor intent: INIntent) -> Any?
{
guard intent is RefreshAllIntent else { return nil }
return self.intentHandler
guard #available(iOS 14, *) else { return nil }
switch intent
{
case is RefreshAllIntent: return self.intentHandler
case is ViewAppIntent: return self.viewAppIntentHandler
default: return nil
}
}
}

View File

@@ -69,6 +69,7 @@
<key>INIntentsSupported</key>
<array>
<string>RefreshAllIntent</string>
<string>ViewAppIntent</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
@@ -92,6 +93,7 @@
<key>NSUserActivityTypes</key>
<array>
<string>RefreshAllIntent</string>
<string>ViewAppIntent</string>
</array>
<key>UIApplicationSceneManifest</key>
<dict>

View File

@@ -10,6 +10,7 @@ import Foundation
import AltStoreCore
@available(iOS 14, *)
class IntentHandler: NSObject, RefreshAllIntentHandling
{
private let queue = DispatchQueue(label: "io.altstore.IntentHandler")
@@ -75,6 +76,7 @@ class IntentHandler: NSObject, RefreshAllIntentHandling
}
}
@available(iOS 14, *)
private extension IntentHandler
{
func finish(_ intent: RefreshAllIntent, response: RefreshAllIntentResponse)