Remove TVHome, TVApps, MediaHub from the Recent list.
authorcskim <charles0.kim@samsung.com>
Sat, 15 Apr 2017 06:22:15 +0000 (15:22 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:52 +0000 (18:34 +0900)
Change-Id: I8c4f4ebb93722175ae1d21668411b53fa2029a3b

12 files changed:
LibTVRefCommonPortable/LibTVRefCommonPortable.csproj
LibTVRefCommonPortable/Models/AppShortcutController.cs
LibTVRefCommonPortable/Models/ManagedApps.cs [new file with mode: 0644]
LibTVRefCommonPortable/Models/RecentShortcutController.cs
LibTVRefCommonPortable/Utils/AppShortcutStorage.cs
LibTVRefCommonPortable/Utils/IApplicationManagerAPIs.cs
LibTVRefCommonPortable/Utils/IFileSystemAPIs.cs
LibTVRefCommonTizen/Ports/ApplicationManagerPort.cs
LibTVRefCommonTizen/Ports/FileSystemPort.cs
TVApps/TVApps.TizenTV/TVApps.TizenTV.cs
TVHome/TVHome.TizenTV/TVHome.TizenTV.cs
TVHome/TVHome/ViewModels/MainPageViewModel.cs

index ff74f8d60c7a8e87d968abaed04c81663cfd5da8..ce6975db66717208cb1067a3560dfd780137aec4 100755 (executable)
@@ -48,6 +48,7 @@
     <Compile Include="DataModels\StateDescription.cs" />
     <Compile Include="DataModels\WatcherType.cs" />
     <Compile Include="Models\AppShortcutController.cs" />
+    <Compile Include="Models\ManagedApps.cs" />
     <Compile Include="Models\RecentShortcutController.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Utils\AppControlUtils.cs" />
index 63971938fbb6f7faddcd2fc898c610cfe60e54aa..24f88c256c80bb0bacb2e15fd35da7e3ac49bb5e 100755 (executable)
@@ -33,40 +33,11 @@ namespace LibTVRefCommonPortable.Models
     /// </summary>
     public class AppShortcutController
     {
-        /// <summary>
-        /// The app ID of TV reference home application
-        /// </summary>
-        // TODO : change application later
-        public static string TVHomeAppID = "org.tizen.xahome";
-
-        /// <summary>
-        /// The app ID of TV reference apps-tray application
-        /// </summary>
-        public static string TVAppsAppID = "org.tizen.xaapps";
-
-        /// <summary>
-        /// The app ID of TV reference apps-tray application
-        /// </summary>
-        public static string MediaHubAppID = "org.tizen.xamediahub";
-
         /// <summary>
         /// A default app icon for no icon applications.
         /// </summary>
         private static String DefaultAppIcon = "AppIcon.png";
 
-
-        private bool IsNonPinnableApps(string appID)
-        {
-            if (appID.CompareTo(TVHomeAppID) == 0 ||
-                  appID.CompareTo(TVAppsAppID) == 0 ||
-                  appID.CompareTo(MediaHubAppID) == 0)
-            {
-                return true;
-            }
-
-            return false;
-        }
-
         /// <summary>
         /// A method provides installed app list.
         /// The returned app list has only Tizen UI apps not the system app or no display apps.
@@ -80,6 +51,11 @@ namespace LibTVRefCommonPortable.Models
 
             foreach (KeyValuePair<string, string[]> item in installedAppList)
             {
+                if (ManagedApps.IsNonPinnableApps(item.Key))
+                {
+                    continue;
+                }
+
                 var defaultStateDescription = new StateDescription()
                 {
                     Label = item.Value[0],
@@ -122,7 +98,7 @@ namespace LibTVRefCommonPortable.Models
                 IconPath = "ic_tizen_home_list_allapps_normal.png",
                 Action = new AppControlAction
                 {
-                    AppID = TVAppsAppID,
+                    AppID = ManagedApps.TVAppsAppID,
                 }
             };
 
@@ -139,7 +115,7 @@ namespace LibTVRefCommonPortable.Models
                 IconPath = "ic_tizen_home_list_mediahub_normal.png",
                 Action = new AppControlAction
                 {
-                    AppID = MediaHubAppID,
+                    AppID = ManagedApps.MediaHubAppID,
                 }
             };
 
@@ -195,7 +171,7 @@ namespace LibTVRefCommonPortable.Models
 
             foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info)
             {
-                if (IsNonPinnableApps(appShortcutInfo.AppID))
+                if (ManagedApps.IsNonPinnableApps(appShortcutInfo.AppID))
                 {
                     continue;
                 }
@@ -279,7 +255,7 @@ namespace LibTVRefCommonPortable.Models
 
             foreach (AppShortcutInfo appShortcutInfo in pinned_apps_info)
             {
-                if (IsNonPinnableApps(appShortcutInfo.AppID))
+                if (ManagedApps.IsNonPinnableApps(appShortcutInfo.AppID))
                 {
                     continue;
                 }
diff --git a/LibTVRefCommonPortable/Models/ManagedApps.cs b/LibTVRefCommonPortable/Models/ManagedApps.cs
new file mode 100644 (file)
index 0000000..ac1892e
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LibTVRefCommonPortable.Models
+{
+    /// <summary>
+    /// A class has some apps have to managed in the TVHome, TVApps by platform policy reason.
+    /// </summary>
+    public class ManagedApps
+    {
+        /// <summary>
+        /// The app ID of TV reference home application
+        /// </summary>
+        // TODO : change application later
+        public static string TVHomeAppID
+        {
+            get
+            {
+                return "org.tizen.xahome";
+            }
+        }
+
+        /// <summary>
+        /// The app ID of TV reference apps-tray application
+        /// </summary>
+        public static string TVAppsAppID
+        {
+            get
+            {
+                return "org.tizen.xaapps";
+            }
+        }
+
+        /// <summary>
+        /// The app ID of TV reference apps-tray application
+        /// </summary>
+        public static string MediaHubAppID
+        {
+            get
+            {
+                return "org.tizen.xamediahub";
+            }
+        }
+
+        /// <summary>
+        /// The Settings App ID
+        /// </summary>
+        public static string SettingsAppID
+        {
+            get
+            {
+                return "org.tizen.settings";
+            }
+        }
+
+        public static bool IsNonPinnableApps(string appID)
+        {
+            if (appID.CompareTo(TVHomeAppID) == 0 ||
+                  appID.CompareTo(TVAppsAppID) == 0 ||
+                  appID.CompareTo(MediaHubAppID) == 0)
+            {
+                return true;
+            }
+
+            return false;
+        }
+
+        public static bool IsHiddenRecentApp(string appID)
+        {
+            if (appID.CompareTo(TVHomeAppID) == 0 ||
+                  appID.CompareTo(TVAppsAppID) == 0 ||
+                  appID.CompareTo(MediaHubAppID) == 0)
+            {
+                return true;
+            }
+
+            return false;
+        }
+    }
+}
index a3a7ca09f4cedd81b79b9cbe373dd718ac98680d..bf546cfb6d1fe5786ac2cd218a7625d41361e51e 100755 (executable)
@@ -75,22 +75,44 @@ namespace LibTVRefCommonPortable.Models
             var recentApps = ApplicationManagerUtils.GetRecentApplications();
             foreach (var item in recentApps)
             {
+                if (ManagedApps.IsHiddenRecentApp(item.AppID))
+                {
+                    continue;
+                }
+
                 var defaultStateDescription = new StateDescription()
                 {
-                    Label = item.applabel,
-                    IconPath = item.iconPath,
+                    Label = item.Applabel,
+                    IconPath = item.IconPath,
                     Action = new AppControlAction()
                     {
-                        AppID = item.appID,
+                        AppID = item.AppID,
                     }
                 };
                 var recentShortcutInfo = new RecentShortcutInfo();
-                // TODO : Revert this after getting a API from app framework team.
-                //recentShortcutInfo.ScreenshotPath = "screenshot_" + item.Value[0] + ".png";
-                recentShortcutInfo.ScreenshotPath = "screenshot.png";
+
+                if (item.ScreenShot == null)
+                {
+                    recentShortcutInfo.ScreenshotPath = "screenshot.png";
+
+                    IFileSystemAPIs fsApi = DependencyService.Get<IFileSystemAPIs>();
+                    if (fsApi != null)
+                    {
+                        string testScreenShot = fsApi.PlatformShareStorage + item.AppID + ".png";
+                        if (fsApi.IsFileExist(testScreenShot))
+                        {
+                            recentShortcutInfo.ScreenshotPath = testScreenShot;
+                        }
+                    }
+                }
+                else
+                {
+                    recentShortcutInfo.ScreenshotPath = item.ScreenShot;
+                }
+
                 recentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);
                 recentShortcutInfo.CurrentStateDescription = defaultStateDescription;
-                recentShortcutInfo.AppID = item.appID;
+                recentShortcutInfo.AppID = item.AppID;
                 recentShortcutInfoList.Add(recentShortcutInfo);
             }
 
index c5bea6c2cc126ee908b320c9106b3b95abf81263..83817d7a1a5d54f95fc97943fffc21b6128ee6cd 100644 (file)
@@ -34,9 +34,7 @@ namespace LibTVRefCommonPortable.Utils
         /// <summary>
         /// A storage path.
         /// </summary>
-        // TODO : Make this working properly, a accessing below directory is not permitted.
-        // private String storagePath = "/home/owner/apps_rw/xahome/res/pinned_apps_info.xml";
-        private static String storagePath = "/opt/usr/home/owner/share/pinned_apps_info.xml";
+        private static String StoragePath;
 
         /// <summary>
         /// A file system watcher which checks if the targeted storage is changed.
@@ -61,6 +59,10 @@ namespace LibTVRefCommonPortable.Utils
         /// </summary>
         private AppShortcutStorage()
         {
+            // TODO : Make this working properly, a accessing below directory is not permitted.
+            //return DependencyService.Get<IFileSystemAPIs>()?.AppDataStorage + "pinned_apps_info.xml";
+            StoragePath = DependencyService.Get<IFileSystemAPIs>()?.PlatformShareStorage + "pinned_apps_info.xml";
+
             fileSystemWatcher.Run();
         }
 
@@ -72,9 +74,9 @@ namespace LibTVRefCommonPortable.Utils
         {
             IFileSystemAPIs fileSystem = DependencyService.Get<IFileSystemAPIs>();
 
-            if (fileSystem.IsFileExist(storagePath) == false)
+            if (fileSystem.IsFileExist(StoragePath) == false)
             {
-                DebuggingUtils.Err("Set Default Pinned Apps" + storagePath);
+                DebuggingUtils.Err("Set Default Pinned Apps" + StoragePath);
                 List<AppShortcutInfo> result = new List<AppShortcutInfo>();
                 Write(result);
                 return result;
@@ -82,21 +84,21 @@ namespace LibTVRefCommonPortable.Utils
 
             for (int i = 0; i < 5; i++)
             {
-                if (fileSystem.IsFileReady(storagePath))
+                if (fileSystem.IsFileReady(StoragePath))
                 {
                     break;
                 }
                 else if (i >= 4)
                 {
-                    DebuggingUtils.Err("Can't open storage" + storagePath);
+                    DebuggingUtils.Err("Can't open storage" + StoragePath);
                     return new List<AppShortcutInfo>();
                 }
 
                 await Task.Delay(100);
-                DebuggingUtils.Dbg("[" + i + "/5] Waiting for Writing" + storagePath);
+                DebuggingUtils.Dbg("[" + i + "/5] Waiting for Writing" + StoragePath);
             }
 
-            using (Stream fileStream = fileSystem.OpenFile(storagePath, UtilFileMode.Open))
+            using (Stream fileStream = fileSystem.OpenFile(StoragePath, UtilFileMode.Open))
             {
                 Debug.Assert(fileStream != null);
 
@@ -117,7 +119,7 @@ namespace LibTVRefCommonPortable.Utils
         {
             IFileSystemAPIs fileSystem = DependencyService.Get<IFileSystemAPIs>();
 
-            using (Stream fileStream = fileSystem.OpenFile(storagePath, UtilFileMode.Create))
+            using (Stream fileStream = fileSystem.OpenFile(StoragePath, UtilFileMode.Create))
             {
                 Debug.Assert(fileStream != null);
 
index 97bb8a1c00e45b36395a06dc57255b1fc4b8654b..b5a7693d9ca5f21a8fb3a48a7a77cd1112732c3d 100755 (executable)
@@ -28,37 +28,42 @@ namespace LibTVRefCommonPortable.Utils
         /// <summary>
         /// A Recent instance ID
         /// </summary>
-        public String instanceID;
+        public String InstanceID;
 
         /// <summary>
         /// A Recent instance label
         /// </summary>
-        public String instanceLabel;
+        public String InstanceLabel;
 
         /// <summary>
         /// A app ID
         /// </summary>
-        public String appID;
+        public String AppID;
 
         /// <summary>
         /// A app label
         /// </summary>
-        public String applabel;
+        public String Applabel;
 
         /// <summary>
         /// A app icon path
         /// </summary>
-        public String iconPath;
+        public String IconPath;
 
         /// <summary>
         /// A last launched data
         /// </summary>
-        public DateTime launchedTime;
+        public DateTime LaunchedTime;
 
         /// <summary>
         /// A URI of accessible content if the Recent is a content.
         /// </summary>
-        public String uri;
+        public String Uri;
+
+        /// <summary>
+        /// A File Path of screenshot of the recent app or recent content.
+        /// </summary>
+        public String ScreenShot;
     }
 
     /// <summary>
index 745f6a7886c075dea8bf21fcb63a4a08ff7851cf..d142b868a453f488cce5faed06e5d9b8192783a5 100644 (file)
@@ -41,6 +41,16 @@ namespace LibTVRefCommonPortable.Utils
     /// </summary>
     public interface IFileSystemAPIs
     {
+        string AppDataStorage
+        {
+            get;
+        }
+
+        string PlatformShareStorage
+        {
+            get;
+        }
+
         /// <summary>
         /// A method opens a file on the given mode.
         /// </summary>
index 1b79e72db17b9365c79ae7e52603c62846faaba7..9d99edf4f1c98c7357940165e3bea8dde545d265 100755 (executable)
@@ -105,13 +105,13 @@ namespace LibTVRefCommonTizen.Ports
 
                     resultList.Add(new RecentApp()
                     {
-                        instanceID = app.InstanceId,
-                        instanceLabel = app.InstanceName,
-                        appID = app.ApplicationId,
-                        applabel = (app.Label == null || app.Label.Length < 1) ? "No Name" : app.Label,
-                        iconPath = app.IconPath,
-                        launchedTime = app.LaunchTime,
-                        uri = app.Uri,
+                        InstanceID = app.InstanceId,
+                        InstanceLabel = app.InstanceName,
+                        AppID = app.ApplicationId,
+                        Applabel = (app.Label == null || app.Label.Length < 1) ? "No Name" : app.Label,
+                        IconPath = app.IconPath,
+                        LaunchedTime = app.LaunchTime,
+                        Uri = app.Uri,
                     });
                 }
             }
index 5d41d14ef0539eaf4ccf3bcfc260ecbcdfb5d23c..a5ede173b89c4fab51b77e0ffc4649a419c615cd 100644 (file)
@@ -25,6 +25,38 @@ namespace LibTVRefCommonTizen.Ports
     /// </summary>
     public class FileSystemPort : IFileSystemAPIs
     {
+        /// <summary>
+        /// A directory path which should be used for app data storing.
+        /// </summary>
+        public static string AppDataStroagePath { private get; set; }
+
+        /// <summary>
+        /// A property of AppDataStroagePath to be exported to PCL.
+        /// </summary>
+        public string AppDataStorage
+        {
+            get
+            {
+                return AppDataStroagePath ?? "";
+            }
+        }
+
+        /// <summary>
+        /// A directory path which should be used for sharing between apps.
+        /// </summary>
+        public static string PlatformShareStroagePath { private get; set; }
+
+        /// <summary>
+        /// A property of PlatformShareStroagePath to be exported to PCL.
+        /// </summary>
+        public string PlatformShareStorage
+        {
+            get
+            {
+                return PlatformShareStroagePath ?? "";
+            }
+        }
+
         /// <summary>
         /// Opens the given file
         /// </summary>
index ad110347d49b5e4778abc2445b5aed1a9c336c53..6c4c6629a5ece97ce6e7c23dcffcdcb562ab33e2 100755 (executable)
@@ -36,37 +36,25 @@ namespace TVApps.TizenTV
         /// </summary>
         private IPlatformNotification notification;
 
-        /// <summary>
-        /// Gets and Sets application resource path
-        /// </summary>
-        public static string AppResourcePath
-        {
-            get;
-            private set;
-        }
-
-        /// <summary>
-        /// Gets and Sets application data path
-        /// </summary>
-        public static string AppDataPath
-        {
-            get;
-            private set;
-        }
-
         /// <summary>
         /// A method will be called when application is created
         /// </summary>
         protected override void OnCreate()
         {
             base.OnCreate();
-            var app = new App(MainWindow.ScreenSize.Width, MainWindow.ScreenSize.Height, MainWindow.ScreenDpi.X, ElmSharp.Elementary.GetScale());
-            notification = app;
 
-            AppResourcePath = DirectoryInfo.Resource;
-            AppDataPath = DirectoryInfo.Data;
+            FileSystemPort.AppDataStroagePath = DirectoryInfo.Data;
+            FileSystemPort.PlatformShareStroagePath = "/opt/usr/home/owner/share/";
+
+            var app = new App(MainWindow.ScreenSize.Width,
+                MainWindow.ScreenSize.Height,
+                MainWindow.ScreenDpi.X,
+                ElmSharp.Elementary.GetScale());
+            notification = app;
 
+            DbgPort.D("-----------------------------------");
             DbgPort.D("Apps application is being loaded...");
+            DbgPort.D("-----------------------------------");
             LoadApplication(app);
 
             PackageManagerPort.RegisterCallbacks(notification);
index ac184eee0d38e1bd2f6b8e5251d4105e6a64f9a2..5f42d570e7655aa2011d57e402758bbb72f99636 100755 (executable)
@@ -35,35 +35,22 @@ namespace TVHome.TizenTV
         /// </summary>
         WindowPort windowPort;
 
-        /// <summary>
-        /// Gets or set the application resource path
-        /// </summary>
-        public static string AppResourcePath
-        {
-            get;
-            private set;
-        }
-
-        /// <summary>
-        /// Gets or set the application data path
-        /// </summary>
-        public static string AppDataPath
-        {
-            get;
-            private set;
-        }
-
         /// <summary>
         /// A method will be called when application is created
         /// </summary>
         protected override void OnCreate()
         {
             base.OnCreate();
-            var app = new App(MainWindow.ScreenSize.Width, MainWindow.ScreenSize.Height, MainWindow.ScreenDpi.X, ElmSharp.Elementary.GetScale());
-            notification = app;
 
-            AppResourcePath = DirectoryInfo.Resource;
-            AppDataPath = DirectoryInfo.Data;
+            FileSystemPort.AppDataStroagePath = DirectoryInfo.Data;
+            FileSystemPort.PlatformShareStroagePath = "/opt/usr/home/owner/share/";
+
+            var app = new App(MainWindow.ScreenSize.Width,
+                MainWindow.ScreenSize.Height,
+                MainWindow.ScreenDpi.X,
+                ElmSharp.Elementary.GetScale());
+
+            notification = app;
 
             DbgPort.D("-----------------------------------");
             DbgPort.D("Home application is being loaded...");
index bd94e935cb0a88614395d2967c62fb7c23fb7e0e..b7ee6e37317f3f215a71ebc2cc0b2758c41476f7 100755 (executable)
@@ -21,6 +21,7 @@ using System.Linq;
 using LibTVRefCommonPortable.DataModels;
 using LibTVRefCommonPortable.Utils;
 using Xamarin.Forms;
+using LibTVRefCommonPortable.Models;
 
 namespace TVHome.ViewModels
 {
@@ -276,9 +277,7 @@ namespace TVHome.ViewModels
         private void MakeMainMenuItems()
         {
             string[] AppName = { "Recent", "Apps", "Settings" };
-            // TODO : Revert this before release
-            //string[] AppControlID = { "org.tizen.settings", "org.tizen.apps", "org.tizen.settings" };
-            string[] AppControlID = { "org.tizen.xaapps", "org.tizen.xaapps", "org.tizen.settings" };
+            string[] AppControlID = { ManagedApps.TVAppsAppID, ManagedApps.TVAppsAppID, ManagedApps.SettingsAppID };
             string[] AppIconPath =
                 {
                 "ic_tizen_home_menu_{0}_normal.png",