From ad48b1ebac07d5b74cf254ffc8c8295a452aca3f Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Wed, 8 Aug 2018 10:34:40 -0600 Subject: [PATCH] Added starter method for directory root:good; adding json props and converters to directory classes --- .../Messengers/VideoCodecBaseMessenger.cs | 38 ++++++++++++++++++- .../CotijaEssentialsHuddleSpaceRoomBridge.cs | 3 +- PepperDashEssentials/AppServer/Volumes.cs | 5 +++ .../VC/EssentialsVideoCodecUiDriver.cs | 29 +++++++------- 4 files changed, 57 insertions(+), 18 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs index 7c0fc0c6..9e5f09e7 100644 --- a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs @@ -90,6 +90,7 @@ namespace PepperDash.Essentials.AppServer.Messengers if (call != null) Codec.AcceptCall(call); })); + appServerController.AddAction(MessagePath + "/directoryRoot", new Action(GetDirectoryRoot)); appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn)); appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff)); appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle)); @@ -114,6 +115,37 @@ namespace PepperDash.Essentials.AppServer.Messengers return Codec.ActiveCalls.FirstOrDefault(c => c.Id == id); } + /// + /// + /// + void GetDirectoryRoot() + { + var dirCodec = Codec as IHasDirectory; + if (dirCodec == null) + { + // do something else? + return; + } + if (!dirCodec.PhonebookSyncState.InitialSyncComplete) + { + PostStatusMessage(new + { + initialSyncComplete = false + }); + return; + } + + var dir = dirCodec.DirectoryRoot; + PostStatusMessage(new + { + directory = new + { + folderId = dir.ResultsFolderId, + directory = dir.DirectoryResults + } + }); + } + /// /// Handler for codec changes /// @@ -122,6 +154,9 @@ namespace PepperDash.Essentials.AppServer.Messengers SendVtcFullMessageObject(); } + /// + /// + /// void SendIsReady() { PostStatusMessage(new @@ -159,7 +194,8 @@ namespace PepperDash.Essentials.AppServer.Messengers sipPhoneNumber = info.SipPhoneNumber, sipURI = info.SipUri }, - showSelfViewByDefault = Codec.ShowSelfViewByDefault + showSelfViewByDefault = Codec.ShowSelfViewByDefault, + hasDirectory = Codec is IHasDirectory }); } diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs index 20e16891..503c3b1c 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs @@ -62,7 +62,8 @@ namespace PepperDash.Essentials var routeRoom = Room as IRunRouteAction; if(routeRoom != null) - Parent.AddAction(string.Format(@"/room/{0}/source", Room.Key), new Action(c => routeRoom.RunRouteAction(c.SourceListItem))); + Parent.AddAction(string.Format(@"/room/{0}/source", Room.Key), new Action(c => + routeRoom.RunRouteAction(c.SourceListItem))); var defaultRoom = Room as IRunDefaultPresentRoute; if(defaultRoom != null) diff --git a/PepperDashEssentials/AppServer/Volumes.cs b/PepperDashEssentials/AppServer/Volumes.cs index f266b486..38de8ef2 100644 --- a/PepperDashEssentials/AppServer/Volumes.cs +++ b/PepperDashEssentials/AppServer/Volumes.cs @@ -15,6 +15,11 @@ namespace PepperDash.Essentials.Room.Cotija [JsonProperty("auxFaders")] public List AuxFaders { get; set; } + + public Volumes() + { + AuxFaders = new List(); + } } public class Volume diff --git a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs index 0e125429..be65410e 100644 --- a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs @@ -537,25 +537,22 @@ namespace PepperDash.Essentials.UIDrivers.VC var codec = Codec as IHasDirectory; if (codec != null) { - if (codec != null) + DirectoryList = new SmartObjectDynamicList(TriList.SmartObjects[UISmartObjectJoin.VCDirectoryList], + true, 1300); + codec.DirectoryResultReturned += new EventHandler(dir_DirectoryResultReturned); + + if (codec.PhonebookSyncState.InitialSyncComplete) + SetCurrentDirectoryToRoot(); + else { - DirectoryList = new SmartObjectDynamicList(TriList.SmartObjects[UISmartObjectJoin.VCDirectoryList], - true, 1300); - codec.DirectoryResultReturned += new EventHandler(dir_DirectoryResultReturned); - - if (codec.PhonebookSyncState.InitialSyncComplete) - SetCurrentDirectoryToRoot(); - else - { - codec.PhonebookSyncState.InitialSyncCompleted += new EventHandler(PhonebookSyncState_InitialSyncCompleted); - } + codec.PhonebookSyncState.InitialSyncCompleted += new EventHandler(PhonebookSyncState_InitialSyncCompleted); + } - // If there is something here now, show it otherwise wait for the event - if (CurrentDirectoryResult != null && codec.DirectoryRoot.DirectoryResults.Count > 0) - { - RefreshDirectory(); - } + // If there is something here now, show it otherwise wait for the event + if (CurrentDirectoryResult != null && codec.DirectoryRoot.DirectoryResults.Count > 0) + { + RefreshDirectory(); } } }