Remove default pinned app.
[profile/tv/apps/dotnet/home.git] / LibTVRefCommonPortable / Utils / AppControlUtils.cs
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.1 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://floralicense.org/license/
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System.Collections.Generic;
18 using Xamarin.Forms;
19
20 namespace LibTVRefCommonPortable.Utils
21 {
22     /// <summary>
23     /// A class provides App Control utility APIs.
24     /// </summary>
25     public sealed class AppControlUtils
26     {
27         /// <summary>
28         /// A method makes the package ID's app to be launched.
29         /// </summary>
30         /// <param name="pkgID">A package ID of the targeted application.</param>
31         public static void SendLaunchRequest(string pkgID)
32         {
33             if (DependencyService.Get<IAppControl>() == null)
34             {
35                 return;
36             }
37
38             DependencyService.Get<IAppControl>().SendLaunchRequest(pkgID);
39         }
40
41         /// <summary>
42         /// A method makes the package ID's app to be launched.
43         /// </summary>
44         /// <param name="pkgID">A package ID of the targeted application.</param>
45         /// <param name="extraData">A extra data for App Control invoking.</param>
46         public static void SendLaunchRequest(string pkgID, IDictionary<string, string> extraData)
47         {
48             if (DependencyService.Get<IAppControl>() == null)
49             {
50                 return;
51             }
52
53             DependencyService.Get<IAppControl>().SendLaunchRequest(pkgID, extraData);
54         }
55
56         /// <summary>
57         /// A method sends a add pin request App Control to TVApps app.
58         /// </summary>
59         public static void SendAddAppRequestToApps()
60         {
61             if (DependencyService.Get<IAppControl>() == null)
62             {
63                 return;
64             }
65
66             DependencyService.Get<IAppControl>().SendAddAppRequestToApps();
67         }
68
69         /// <summary>
70         /// A method sends a pin added notification App control to TVHome app.
71         /// </summary>
72         /// <param name="addedAddID">A app ID of newly added.</param>
73         public static void SendAppAddedNotificationToHome(string addedAddID)
74         {
75             if (DependencyService.Get<IAppControl>() == null)
76             {
77                 return;
78             }
79
80             DependencyService.Get<IAppControl>().SendAppAddedNotificationToHome(addedAddID);
81         }
82
83         /// <summary>
84         /// A method terminates caller application.
85         /// </summary>
86         public static void SelfTerminate()
87         {
88             if (DependencyService.Get<IAppLifeControl>() == null)
89             {
90                 return;
91             }
92
93             DependencyService.Get<IAppLifeControl>().SelfTerminate();
94         }
95     }
96 }