JLChen
2021-11-17 1c6fec7f66cb4864eb4cc17ac8c529dc05e6995d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//
// HDLRunSceneIntent.h
//
// This file was automatically generated and should not be edited.
//
 
#if __has_include(<Intents/Intents.h>)
 
#import <Intents/Intents.h>
 
NS_ASSUME_NONNULL_BEGIN
 
API_AVAILABLE(ios(12.0), macos(10.16), watchos(5.0)) API_UNAVAILABLE(tvos)
@interface HDLRunSceneIntent : INIntent
 
@property (readwrite, copy, nullable, nonatomic) NSString *sceneName;
@property (readwrite, copy, nullable, nonatomic) NSString *sceneId;
 
@end
 
@class HDLRunSceneIntentResponse;
 
/*!
 @abstract Protocol to declare support for handling a HDLRunSceneIntent. By implementing this protocol, a class can provide logic for resolving, confirming and handling the intent.
 @discussion The minimum requirement for an implementing class is that it should be able to handle the intent. The confirmation method is optional. The handling method is always called last, after confirming the intent.
 */
API_AVAILABLE(ios(12.0), macos(10.16), watchos(5.0)) API_UNAVAILABLE(tvos)
@protocol HDLRunSceneIntentHandling <NSObject>
 
@required
 
/*!
 @abstract Handling method - Execute the task represented by the HDLRunSceneIntent that's passed in
 @discussion Called to actually execute the intent. The app must return a response for this intent.
 
 @param  intent The input intent
 @param  completion The response handling block takes a HDLRunSceneIntentResponse containing the details of the result of having executed the intent
 
 @see  HDLRunSceneIntentResponse
 */
- (void)handleRunScene:(HDLRunSceneIntent *)intent completion:(void (^)(HDLRunSceneIntentResponse *response))completion NS_SWIFT_NAME(handle(intent:completion:));
 
@optional
 
/*!
 @abstract Confirmation method - Validate that this intent is ready for the next step (i.e. handling)
 @discussion Called prior to asking the app to handle the intent. The app should return a response object that contains additional information about the intent, which may be relevant for the system to show the user prior to handling. If unimplemented, the system will assume the intent is valid, and will assume there is no additional information relevant to this intent.
 
 @param  intent The input intent
 @param  completion The response block contains a HDLRunSceneIntentResponse containing additional details about the intent that may be relevant for the system to show the user prior to handling.
 
 @see HDLRunSceneIntentResponse
 */
- (void)confirmRunScene:(HDLRunSceneIntent *)intent completion:(void (^)(HDLRunSceneIntentResponse *response))completion NS_SWIFT_NAME(confirm(intent:completion:));
 
@end
 
/*!
 @abstract Constants indicating the state of the response.
 */
typedef NS_ENUM(NSInteger, HDLRunSceneIntentResponseCode) {
    HDLRunSceneIntentResponseCodeUnspecified = 0,
    HDLRunSceneIntentResponseCodeReady,
    HDLRunSceneIntentResponseCodeContinueInApp,
    HDLRunSceneIntentResponseCodeInProgress,
    HDLRunSceneIntentResponseCodeSuccess,
    HDLRunSceneIntentResponseCodeFailure,
    HDLRunSceneIntentResponseCodeFailureRequiringAppLaunch,
    HDLRunSceneIntentResponseCodeError = 100
} API_AVAILABLE(ios(12.0), macos(10.16), watchos(5.0)) API_UNAVAILABLE(tvos);
 
API_AVAILABLE(ios(12.0), macos(10.16), watchos(5.0)) API_UNAVAILABLE(tvos)
@interface HDLRunSceneIntentResponse : INIntentResponse
 
- (instancetype)init NS_UNAVAILABLE;
 
/*!
 @abstract Initializes the response object with the specified code and user activity object.
 @discussion The app extension has the option of capturing its private state as an NSUserActivity and returning it as the 'currentActivity'. If the app is launched, an NSUserActivity will be passed in with the private state. The NSUserActivity may also be used to query the app's UI extension (if provided) for a view controller representing the current intent handling state. In the case of app launch, the NSUserActivity will have its activityType set to the name of the intent. This intent object will also be available in the NSUserActivity.interaction property.
 
 @param  code The response code indicating your success or failure in confirming or handling the intent.
 @param  userActivity The user activity object to use when launching your app. Provide an object if you want to add information that is specific to your app. If you specify nil, the system automatically creates a user activity object for you, sets its type to the class name of the intent being handled, and fills it with an INInteraction object containing the intent and your response.
 */
- (instancetype)initWithCode:(HDLRunSceneIntentResponseCode)code userActivity:(nullable NSUserActivity *)userActivity NS_DESIGNATED_INITIALIZER;
 
/*!
 @abstract Initializes and returns the response object with the success code.
 */
+ (instancetype)successIntentResponseWithSceneName:(NSString *)sceneName NS_SWIFT_NAME(success(sceneName:));
/*!
 @abstract Initializes and returns the response object with the failure code.
 */
+ (instancetype)failureIntentResponseWithErrorMessage:(NSString *)errorMessage NS_SWIFT_NAME(failure(errorMessage:));
 
@property (readwrite, copy, nullable, nonatomic) NSString *errorMessage;
@property (readwrite, copy, nullable, nonatomic) NSString *successMessage;
@property (readwrite, copy, nullable, nonatomic) NSString *sceneName;
 
/*!
 @abstract The response code indicating your success or failure in confirming or handling the intent.
 */
@property (readonly, NS_NONATOMIC_IOSONLY) HDLRunSceneIntentResponseCode code;
 
@end
 
NS_ASSUME_NONNULL_END
 
#endif