Skip to content
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

Upgrade v4 #18

Merged
merged 36 commits into from
May 23, 2024
Merged

Upgrade v4 #18

merged 36 commits into from
May 23, 2024

Conversation

pasotee
Copy link
Collaborator

@pasotee pasotee commented Apr 24, 2024

Describe the purpose of your pull request

  • Upgrade Unreal Engine SDK to support the cpp-sdk [v4 release[(https://github.com/configcat/cpp-sdk/releases/tag/v4.0.0)

@pasotee pasotee requested a review from a team as a code owner April 24, 2024 07:01
@kp-cat
Copy link
Contributor

kp-cat commented May 22, 2024

Thanks @pasotee for the PR.
Could you please fix the configcat dependency in the CI yml configs?

name: Plugin CD

on:
  workflow_dispatch:
  push:
    tags:
      - 'v*'

env:
  VCPKG_COMMIT_HASH: "59852bb5bd0779788e5fc95e50d2048ae6c9399d"

jobs:
  build-win64:
    runs-on: windows-latest

    steps:
      - uses: actions/checkout@v2

      - name: Install via vcpkg
        run: |
          git clone https://github.com/microsoft/vcpkg build/vcpkg
          git -C build/vcpkg checkout ${{ env.VCPKG_COMMIT_HASH }}
          ./build/vcpkg/bootstrap-vcpkg.bat
          ./build/vcpkg/vcpkg install configcat[core] --triplet x64-windows

      - uses: actions/upload-artifact@v3
        with:
          name: Win64
          path: |
            ./build/vcpkg/installed/*/lib/configcat.lib
            ./build/vcpkg/installed/*/lib/hash-library.lib

@@ -217,20 +211,20 @@ void UConfigCatSubsystem::ForceRefresh()
ConfigCatClient->forceRefresh();
}

void UConfigCatSubsystem::SetDefaultUser(const FConfigCatUser& User)
void UConfigCatSubsystem::SetDefaultUser(const UConfigCatUserWrapper* User)
{
if (!ensure(ConfigCatClient))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please create an EnsureConfigCatClient() function where this log message can be printed:

bool EnsureConfigCatCline()
{
	if (ensure(ConfigCatClient))
	{
                return true;
        }
        
	UE_LOG(LogConfigCat, Warning, TEXT("Trying to access the ConfigCatClient before initialization or after shutdown."));
	return false;
}

In every function we can use this EnsureConfigCatClient() to check the client easier:

if (!EnsureConfigCatClient())
{
        return;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a great idea. I added it now, thanks.

@@ -0,0 +1,117 @@
// Fill out your copyright notice in the Description page of Project Settings.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the standard? Is this line needed here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is an oversight on my side. I have adjusted it with the proper copyright.


FString UConfigCatUserConditionWrapper::GetStringComparisonValue() const
{
// UserCondition.comparisonValue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can implement it like this:

Suggested change
// UserCondition.comparisonValue;
const auto comparisonValuePtr = get_if<string>(&UserCondition.comparisonValue);
if (comparisonValuePtr)
{
return UTF8_TO_TCHAR(comparisonValuePtr->c_str());
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting those and for the suggestions, I didn't know they were a thing.

However, I have to implement the Has...Value functions as well, so I will be using that to check the values.


double UConfigCatUserConditionWrapper::GetNumberComparisonValue() const
{
// UserCondition.comparisonValue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// UserCondition.comparisonValue;
const auto comparisonValuePtr = get_if<double>(&UserCondition.comparisonValue);
if (comparisonValuePtr)
{
return *comparisonValuePtr;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function is now implemented

Comment on lines 45 to 46
// UserCondition.comparisonValue;
return {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// UserCondition.comparisonValue;
return {};
TArray<FString> Result;
const auto comparisonValuePtr = get_if<vector<string>>(&UserCondition.comparisonValue);
if (comparisonValuePtr)
{
for (const auto& value : *comparisonValuePtr)
{
Result.Emplace(UTF8_TO_TCHAR(value.c_str()));
}
}
return Result;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function is now implemented

@pasotee
Copy link
Collaborator Author

pasotee commented May 22, 2024

Thanks @pasotee for the PR. Could you please fix the configcat dependency in the CI yml configs?

name: Plugin CD

on:
  workflow_dispatch:
  push:
    tags:
      - 'v*'

env:
  VCPKG_COMMIT_HASH: "59852bb5bd0779788e5fc95e50d2048ae6c9399d"

jobs:
  build-win64:
    runs-on: windows-latest

    steps:
      - uses: actions/checkout@v2

      - name: Install via vcpkg
        run: |
          git clone https://github.com/microsoft/vcpkg build/vcpkg
          git -C build/vcpkg checkout ${{ env.VCPKG_COMMIT_HASH }}
          ./build/vcpkg/bootstrap-vcpkg.bat
          ./build/vcpkg/vcpkg install configcat[core] --triplet x64-windows

      - uses: actions/upload-artifact@v3
        with:
          name: Win64
          path: |
            ./build/vcpkg/installed/*/lib/configcat.lib
            ./build/vcpkg/installed/*/lib/hash-library.lib

This is awesome. I think it would benefit both the CI & CD pipelines, so I've added it to both

@pasotee pasotee merged commit 7a6b6ab into main May 23, 2024
2 checks passed
@pasotee pasotee deleted the upgrade-v4 branch May 23, 2024 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants