wxr
2021-11-24 8655407ab6987bb7268fab55b6380051f26668fe
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
using System;
using Foundation;
 
#if __IOS__
using CoreSpotlight;
using UIKit;
using System.Linq.Expressions;
using System.Xml;
#endif
 
namespace Other.Siri
{
    public static class NSUserActivityHelper
    {
        public static class ActivityKeys
        {
            public const string MenuItems = "menuItems";
            public const string SegueId = "segueID";
        }
 
        static string SearchableItemContentType = "Soup Menu";
 
        public static string ViewMenuActivityType = "com.xamarin.SoupChef.viewMenu";
 
        public static NSUserActivity ViewMenuActivity {
            get
            {
                var userActivity = new NSUserActivity(ViewMenuActivityType)
                {
                    Title = "测试title", //NSBundleHelper.SoupKitBundle.GetLocalizedString("ORDER_LUNCH_TITLE", "View menu activity title"),
                    EligibleForSearch = true,
                    EligibleForPrediction = true
                };
 
                var attributes = new CSSearchableItemAttributeSet(NSUserActivityHelper.SearchableItemContentType)
                {
                    //ThumbnailData = UIImage.FromBundle("tomato").AsPNG(),
                    Keywords = ViewMenuSearchableKeywords,
                    DisplayName = "测试DisplayName",// NSBundleHelper.SoupKitBundle.GetLocalizedString("ORDER_LUNCH_TITLE", "View menu activity title"),
                    ContentDescription = "测试ContentDescription",//NSBundleHelper.SoupKitBundle.GetLocalizedString("VIEW_MENU_CONTENT_DESCRIPTION", "View menu content description")
                };
                userActivity.ContentAttributeSet = attributes;
 
                //var phrase = NSBundleHelper.SoupKitBundle.GetLocalizedString("ORDER_LUNCH_SUGGESTED_PHRASE", "Voice shortcut suggested phrase");
                userActivity.SuggestedInvocationPhrase = "测试phrase";
                return userActivity;
            }
        }
 
        static string[] ViewMenuSearchableKeywords = new string[] {
             "Searchable Keyword",
            "Searchable Keyword",
            "Searchable Keyword"
        };
    }
}