wxr
2021-11-18 0de3ac9b3e2afea565dd9d028a89986a2e0a377d
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
using System;
 
using CoreGraphics;
using Intents;
using IntentsUI;
using UIKit;
 
namespace SiriIntentsUI
{
    // 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 <myApp>"
    public partial class IntentViewController : UIViewController, IINUIHostedViewControlling
    {
        protected IntentViewController(IntPtr handle) : base(handle)
        {
            // Note: this .ctor should not contain any initialization logic.
        }
 
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
 
            // Do any required interface initialization here.
        }
 
        public override void DidReceiveMemoryWarning()
        {
            // Releases the view if it doesn't have a superview.
            base.DidReceiveMemoryWarning();
 
            // Release any cached data, images, etc that aren't in use.
        }
 
        public void Configure(INInteraction interaction, INUIHostedViewContext context, Action<CGSize> completion)
        {
            // Do configuration here, including preparing views and calculating a desired size for presentation.
 
            if (completion != null)
                completion(DesiredSize());
        }
 
        CGSize DesiredSize()
        {
            return ExtensionContext.GetHostedViewMaximumAllowedSize();
        }
    }
}