mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 13:15:03 +00:00
fix(essentials): updates to IHasDirectory and ZoomRoom
Prevents serialization of CurrentDirectoryResults object. Modified OnDirectoryResultsReturne helper method for ZoomRoom to fix stripping of contacts
This commit is contained in:
@@ -65,8 +65,9 @@ namespace PepperDash.Essentials.Devices.Common.Codec
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the contents of the directory
|
/// Represents the contents of the directory
|
||||||
|
/// We don't want to serialize this for messages to MobileControl. MC can combine Contacts and Folders to get the same data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("directoryResults")]
|
[JsonIgnore]
|
||||||
public List<DirectoryItem> CurrentDirectoryResults { get; private set; }
|
public List<DirectoryItem> CurrentDirectoryResults { get; private set; }
|
||||||
|
|
||||||
[JsonProperty("contacts")]
|
[JsonProperty("contacts")]
|
||||||
|
|||||||
@@ -400,10 +400,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
|||||||
{
|
{
|
||||||
_currentDirectoryResult = value;
|
_currentDirectoryResult = value;
|
||||||
|
|
||||||
Debug.Console(2, this, "CurrentDirectoryResult Updated. ResultsFolderId: {0}",
|
Debug.Console(2, this, "CurrentDirectoryResult Updated. ResultsFolderId: {0} Contact Count: {1}",
|
||||||
_currentDirectoryResult.ResultsFolderId);
|
_currentDirectoryResult.ResultsFolderId, _currentDirectoryResult.CurrentDirectoryResults.Count);
|
||||||
|
|
||||||
CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate();
|
|
||||||
|
|
||||||
OnDirectoryResultReturned(_currentDirectoryResult);
|
OnDirectoryResultReturned(_currentDirectoryResult);
|
||||||
}
|
}
|
||||||
@@ -1305,6 +1303,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
|||||||
// This result will always be the complete contents of the directory and never
|
// This result will always be the complete contents of the directory and never
|
||||||
// A subset of the results via a search
|
// A subset of the results via a search
|
||||||
|
|
||||||
|
// Clear out any existing data
|
||||||
|
Status.Phonebook = new zStatus.Phonebook();
|
||||||
|
|
||||||
JsonConvert.PopulateObject(responseObj.ToString(), Status.Phonebook);
|
JsonConvert.PopulateObject(responseObj.ToString(), Status.Phonebook);
|
||||||
|
|
||||||
var directoryResults =
|
var directoryResults =
|
||||||
@@ -1318,10 +1319,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
|||||||
PhonebookSyncState.SetNumberOfContacts(Status.Phonebook.Contacts.Count);
|
PhonebookSyncState.SetNumberOfContacts(Status.Phonebook.Contacts.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (directoryResults.ResultsFolderId != "root")
|
directoryResults.ResultsFolderId = "root";
|
||||||
{
|
|
||||||
directoryResults.ResultsFolderId = "root";
|
|
||||||
}
|
|
||||||
|
|
||||||
DirectoryRoot = directoryResults;
|
DirectoryRoot = directoryResults;
|
||||||
|
|
||||||
@@ -2696,27 +2694,27 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Debug.Console(2, this, "OnDirectoryResultReturned");
|
Debug.Console(2, this, "OnDirectoryResultReturned. Result has {0} contacts", result.Contacts.Count);
|
||||||
|
|
||||||
var directoryResult = new CodecDirectory();
|
var directoryResult = result;
|
||||||
|
|
||||||
// If result is Root, create a copy and filter out contacts whose parent folder is not root
|
// If result is Root, create a copy and filter out contacts whose parent folder is not root
|
||||||
if (!CurrentDirectoryResultIsNotDirectoryRoot.BoolValue)
|
//if (!CurrentDirectoryResultIsNotDirectoryRoot.BoolValue)
|
||||||
{
|
//{
|
||||||
Debug.Console(2, this, "Filtering DirectoryRoot to remove contacts for display");
|
// Debug.Console(2, this, "Filtering DirectoryRoot to remove contacts for display");
|
||||||
|
|
||||||
directoryResult.ResultsFolderId = result.ResultsFolderId;
|
// directoryResult.ResultsFolderId = result.ResultsFolderId;
|
||||||
directoryResult.AddFoldersToDirectory(result.Folders);
|
// directoryResult.AddFoldersToDirectory(result.Folders);
|
||||||
directoryResult.AddContactsToDirectory(
|
// directoryResult.AddContactsToDirectory(
|
||||||
result.Contacts.Where((c) => c.ParentFolderId == result.ResultsFolderId).ToList());
|
// result.Contacts.Where((c) => c.ParentFolderId == result.ResultsFolderId).ToList());
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
directoryResult = result;
|
// directoryResult = result;
|
||||||
}
|
//}
|
||||||
|
|
||||||
Debug.Console(2, this, "Updating directoryResult. IsOnRoot: {0}",
|
Debug.Console(2, this, "Updating directoryResult. IsOnRoot: {0} Contact Count: {1}",
|
||||||
!CurrentDirectoryResultIsNotDirectoryRoot.BoolValue);
|
!CurrentDirectoryResultIsNotDirectoryRoot.BoolValue, directoryResult.Contacts.Count);
|
||||||
|
|
||||||
// This will return the latest results to all UIs. Multiple indendent UI Directory browsing will require a different methodology
|
// This will return the latest results to all UIs. Multiple indendent UI Directory browsing will require a different methodology
|
||||||
var handler = DirectoryResultReturned;
|
var handler = DirectoryResultReturned;
|
||||||
@@ -2728,6 +2726,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
|||||||
DirectoryIsOnRoot = !CurrentDirectoryResultIsNotDirectoryRoot.BoolValue
|
DirectoryIsOnRoot = !CurrentDirectoryResultIsNotDirectoryRoot.BoolValue
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user