// // IntentViewController.m // HDLSceneSiriUI // // Created by ι™ˆε˜‰δΉ on 2021/11/25. // #import "IntentViewController.h" #import "HDLRunSceneIntent.h" // As an example, this extension's Info.plist has been configured to handle interactions for INSendMessageIntent. // You will want to replace this or add other intents as appropriate. // The intents whose interactions you wish to handle must be declared in the extension's Info.plist. // You can test this example integration by saying things to Siri like: // "Send a message using " @interface IntentViewController () @end @implementation IntentViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. } #pragma mark - INUIHostedViewControlling // Prepare your view controller for the interaction to handle. - (void)configureViewForParameters:(NSSet *)parameters ofInteraction:(INInteraction *)interaction interactiveBehavior:(INUIInteractiveBehavior)interactiveBehavior context:(INUIHostedViewContext)context completion:(void (^)(BOOL success, NSSet *configuredParameters, CGSize desiredSize))completion { // Do configuration here, including preparing views and calculating a desired size for presentation. if (@available(iOS 12.0, *)) { HDLRunSceneIntentResponse *rsp = (HDLRunSceneIntentResponse *) interaction.intentResponse; // HDLRunSceneIntent *intent = (HDLRunSceneIntent *)interaction.intent; NSLog(@"HDL code:%ld s:%@ e:%@",(long)rsp.code,rsp.successMessage,rsp.errorMessage); // self.messageLabel.hidden = NO; if (rsp.code == HDLRunSceneIntentResponseCodeSuccess) { self.messageLabel.text = [NSString stringWithFormat: @"%@",rsp.successMessage]; }else if (rsp.code == HDLRunSceneIntentResponseCodeFailure || rsp.code == HDLRunSceneIntentResponseCodeError) { self.messageLabel.text = [NSString stringWithFormat: @"%@",rsp.errorMessage]; }else{ self.messageLabel.text = [NSString stringWithFormat: @"%@",rsp.successMessage]; } } else { // Fallback on earlier versions } CGSize size = CGSizeMake([self desiredSize].width, 80); if (completion) { completion(YES, parameters, size); } } - (CGSize)desiredSize { return [self extensionContext].hostedViewMaximumAllowedSize; } @end