|
10 | 10 |
|
11 | 11 | namespace Desktop.Shared.Services; |
12 | 12 |
|
| 13 | +public interface IBrandingProvider |
| 14 | +{ |
| 15 | + BrandingInfo CurrentBranding { get; } |
| 16 | + Task Initialize(); |
| 17 | + void SetBrandingInfo(BrandingInfo brandingInfo); |
| 18 | +} |
| 19 | + |
13 | 20 | public class BrandingProvider : IBrandingProvider |
14 | 21 | { |
15 | 22 | private readonly IAppState _appState; |
@@ -56,9 +63,9 @@ public async Task Initialize() |
56 | 63 | }; |
57 | 64 | } |
58 | 65 |
|
59 | | - if (_brandingInfo.Icon?.Any() != true) |
| 66 | + if (_brandingInfo.Icon is not { Length: > 0 }) |
60 | 67 | { |
61 | | - using var mrs = typeof(BrandingProvider).Assembly.GetManifestResourceStream("Desktop.Shared.Assets.Remotely_Icon.png"); |
| 68 | + using var mrs = typeof(BrandingProvider).Assembly.GetManifestResourceStream("Remotely.Desktop.Shared.Assets.Remotely_Icon.png"); |
62 | 69 | using var ms = new MemoryStream(); |
63 | 70 | mrs!.CopyTo(ms); |
64 | 71 |
|
@@ -87,21 +94,24 @@ private async Task<Result<BrandingInfo>> TryGetBrandingInfo() |
87 | 94 |
|
88 | 95 | var result = _embeddedDataSearcher.TryGetEmbeddedData(filePath); |
89 | 96 |
|
90 | | - if (!result.IsSuccess) |
91 | | - { |
92 | | - return result.HadException ? |
93 | | - Result.Fail<BrandingInfo>(result.Exception) : |
94 | | - Result.Fail<BrandingInfo>(result.Reason); |
95 | | - } |
96 | | - |
97 | | - if (!string.IsNullOrWhiteSpace(result.Value.OrganizationId)) |
| 97 | + if (result.IsSuccess) |
98 | 98 | { |
99 | | - _orgIdProvider.OrganizationId = result.Value.OrganizationId; |
| 99 | + if (!string.IsNullOrWhiteSpace(result.Value.OrganizationId)) |
| 100 | + { |
| 101 | + _orgIdProvider.OrganizationId = result.Value.OrganizationId; |
| 102 | + } |
| 103 | + |
| 104 | + if (result.Value.ServerUrl is not null) |
| 105 | + { |
| 106 | + _appState.Host = result.Value.ServerUrl.AbsoluteUri; |
| 107 | + } |
100 | 108 | } |
101 | 109 |
|
102 | | - if (result.Value.ServerUrl is not null) |
| 110 | + if (string.IsNullOrWhiteSpace(_appState.Host)) |
103 | 111 | { |
104 | | - _appState.Host = result.Value.ServerUrl.AbsoluteUri; |
| 112 | + return result.HadException ? |
| 113 | + Result.Fail<BrandingInfo>(result.Exception) : |
| 114 | + Result.Fail<BrandingInfo>(result.Reason); |
105 | 115 | } |
106 | 116 | } |
107 | 117 |
|
|
0 commit comments