Skip to content

Commit

Permalink
feat: Creates UserInterfaceConfig object and moves some data from App…
Browse files Browse the repository at this point in the history
…licationConfig and adds additional tech and custom styles objects
  • Loading branch information
ndorin committed Nov 14, 2024
1 parent 71b72ec commit 4d69993
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
74 changes: 74 additions & 0 deletions 3-series/MobileControlConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using System;
using System.Collections.Generic;

Expand All @@ -23,6 +25,9 @@ public class MobileControlConfig
[JsonProperty("applicationConfig")]
public MobileControlApplicationConfig ApplicationConfig { get; set; }

[JsonProperty("userInterfaceConfig")]
public UserInterfaceConfig UserInterfaceConfig { get; set; }

[JsonProperty("enableApiServer")]
public bool EnableApiServer { get; set; }
#endif
Expand All @@ -38,6 +43,7 @@ public MobileControlConfig()
#if SERIES4
EnableApiServer = true; // default to true
ApplicationConfig = null;
UserInterfaceConfig = null;
#endif
}
}
Expand Down Expand Up @@ -116,6 +122,74 @@ public class MobileControlApplicationConfig

[JsonProperty("enableRemoteLogging")]
public bool Logging { get; set; }

}

public class UserInterfaceConfig
{
[JsonProperty("partnerMetadata", NullValueHandling = NullValueHandling.Ignore)]
public List<MobileControlPartnerMetadata> PartnerMetadata { get; set; }

[JsonProperty("techMenuConfig")]
public TechMenuConfig TechMenuConfig { get; set; }

[JsonProperty("customStyles")]
public Dictionary<eUiModeKeys, JObject> CustomStyles { get; set; }

public UserInterfaceConfig()
{
PartnerMetadata = new List<MobileControlPartnerMetadata>();
TechMenuConfig = new TechMenuConfig();
CustomStyles = new Dictionary<eUiModeKeys, JObject>();
}
}


public class MobileControlPartnerMetadata
{
[JsonProperty("role")]
public string Role { get; set; }

[JsonProperty("description")]
public string Description { get; set; }

[JsonProperty("logoPath")]
public string LogoPath { get; set; }
}

public class TechMenuConfig
{
[JsonProperty("leftNav")]
[JsonConverter(typeof(StringEnumConverter))]
public Dictionary<eUiModeKeys, LeftNavItemConfig> LeftNav { get; set; }

public TechMenuConfig()
{
LeftNav = new Dictionary<eUiModeKeys, LeftNavItemConfig>();
}
}

public enum eUiModeKeys
{
systemStatus,
matrixRouting,
displays,
audio,
setTopBox,
environment,
roomSchedule,
roomSetup,
changePin,
about,
}

public class LeftNavItemConfig
{
[JsonProperty("label")]
public string Label { get; set; }

[JsonProperty("enabled")]
public bool? Enabled { get; set; }
}

public class McMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ private void HandleJoinRequest(HttpListenerRequest req, HttpListenerResponse res
SystemUuid = _parent.SystemUuid,
RoomUuid = _parent.SystemUuid,
Config = _parent.GetConfigWithPluginVersion(),
UserInterfaceConfig = _parent.Config.UserInterfaceConfig,
CodeExpires = new DateTime().AddYears(1),
UserCode = bridge.UserCode,
UserAppUrl = string.Format("http://{0}:{1}/mc/app",
Expand Down Expand Up @@ -1233,6 +1234,9 @@ public class JoinResponse
[JsonProperty("config")]
public object Config { get; set; }

[JsonProperty("userInterfaceConfig")]
public UserInterfaceConfig UserInterfaceConfig { get; set; }

[JsonProperty("codeExpires")]
public DateTime CodeExpires { get; set; }

Expand Down

0 comments on commit 4d69993

Please sign in to comment.