8000 feat: Added ODPManager implementation by mikechu-optimizely · Pull Request #322 · optimizely/csharp-sdk · GitHub
[go: up one dir, main page]

Skip to content

feat: Added ODPManager implementation #322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Small refactors
  • Loading branch information
mikechu-optimizely committed Dec 1, 2022
commit dcafcee3e07a78595f681fd4040501d4b0d590ed
6 changes: 3 additions & 3 deletions OptimizelySDK.Tests/OdpTests/OdpConfigTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ public void ShouldNotEqualWithSegmentsWithNull()
[Test]
public void ShouldNotEqualIfCaseDifferenceInApiKey()
{
const string caseDifferenceInFirstLetterOfApiKey = "urAp1k3Y";
;
const string CASE_DIFFERENCE_IN_FIRST_LETTER_OF_API_KEY = "urAp1k3Y";
var apiKeyCaseDifferentConfig =
new OdpConfig(caseDifferenceInFirstLetterOfApiKey, API_HOST, segmentsToCheck);
new OdpConfig(CASE_DIFFERENCE_IN_FIRST_LETTER_OF_API_KEY, API_HOST,
segmentsToCheck);

Assert.IsFalse(_goodOdpConfig.Equals(apiKeyCaseDifferentConfig));
Assert.IsFalse(apiKeyCaseDifferentConfig.Equals(_goodOdpConfig));
Expand Down
36 changes: 18 additions & 18 deletions OptimizelySDK/Odp/OdpManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,6 @@ Dictionary<string, object> data
EventManager.SendEvent(new OdpEvent(type, action, identifiers, data));
}

/// <summary>
/// Determines if the EventManager is ready to be used
/// </summary>
/// <returns>True if EventManager can process events otherwise False</returns>
private bool EventManagerOrConfigNotReady()
{
return EventManager == null || !_enabled || !_odpConfig.IsReady();
}

/// <summary>
/// Determines if the SegmentManager is ready to be used
/// </summary>
/// <returns>True if SegmentManager can fetch audience segments otherwise False</returns>
private bool SegmentManagerOrConfigNotReady()
{
return SegmentManager == null || !_enabled || !_odpConfig.IsReady();
}

/// <summary>
/// Sends signal to stop Event Manager and clean up ODP Manager use
/// </summary>
Expand Down Expand Up @@ -292,5 +274,23 @@ public OdpManager Build(bool asEnabled = true)
return manager;
}
}

/// <summary>
/// Determines if the EventManager is ready to be used
/// </summary>
/// <returns>True if EventManager can process events otherwise False</returns>
private bool EventManagerOrConfigNotReady()
{
return EventManager == null || !_enabled || !_odpConfig.IsReady();
}

/// <summary>
/// Determines if the SegmentManager is ready to be used
/// </summary>
/// <returns>True if SegmentManager can fetch audience segments otherwise False</returns>
private bool SegmentManagerOrConfigNotReady()
{
return SegmentManager == null || !_enabled || !_odpConfig.IsReady();
}
}
}
0