Skip to content

Commit

Permalink
2023.7.2
Browse files Browse the repository at this point in the history
Updates

* NativeSDK updated
* SubmitModChangesAsync now allows the alteration of a mod's tags
* DisplayNamePortal field added to User objects to provide the portal-specific display name for that user

Bugfixes

* Email validation regex had some edge cases not handled properly
* Mod Tags no longer have incorrect caching logic
  • Loading branch information
stephenwhittle committed Aug 16, 2023
1 parent 0eeaf2e commit f67f1d9
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 35 deletions.
Binary file not shown.
7 changes: 6 additions & 1 deletion Doc/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -9004,6 +9004,11 @@ <h4 id="_variables_6" class="discrete">Variables</h4>
<td class="tableblock halign-left valign-top"><p class="tableblock"><span class="variablename">ProfileUrl</span></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><span class="variabletype"><a href="#FString">FString</a></span></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><span class="variablename">DisplayNamePortal</span></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
<hr>
Expand Down Expand Up @@ -15244,7 +15249,7 @@ <h4 id="_values_43" class="discrete">Values</h4>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2023-07-28 16:21:40 +1000
Last updated 2023-08-16 16:50:01 +1000
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion Source/Modio/Private/Internal/Convert/EditModParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ FORCEINLINE Modio::EditModParams ToModio(const FModioEditModParams& In)
: Modio::Optional<Modio::MaturityOption> {};
Out.MetadataBlob = ToModioOptional<std::string>(In.MetadataBlob);
Out.LogoPath = ToModioOptional<std::string>(In.LogoPath);

Out.Tags = ToModioOptional<std::vector<std::string>>(In.Tags);
return Out;
}
1 change: 1 addition & 0 deletions Source/Modio/Private/Internal/Convert/User.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ FORCEINLINE FModioUser ToUnreal(const Modio::User& In) {
Out.Username = ToUnreal(In.Username);
Out.DateOnline = ToUnreal(In.DateOnline);
Out.ProfileUrl = ToUnreal(In.ProfileUrl);
Out.DisplayNamePortal = ToUnreal(In.DisplayNamePortal);
return Out;
}
5 changes: 5 additions & 0 deletions Source/Modio/Private/Libraries/ModioEditModLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,8 @@ void UModioEditModLibrary::SetLogoPath(FModioEditModParams& In, FString LogoPath
{
In.LogoPath = LogoPath;
}

void UModioEditModLibrary::SetTags(FModioEditModParams& In, TArray<FString>& Tags)
{
In.Tags = Tags;
}
5 changes: 0 additions & 5 deletions Source/Modio/Private/ModioSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,6 @@ void UModioSubsystem::K2_GetModMediaLogoAsync(FModioModID ModId, EModioLogoSize

void UModioSubsystem::GetModTagOptionsAsync(FOnGetModTagOptionsDelegateFast Callback)
{
if (CachedModTags)
{
Callback.ExecuteIfBound({}, CachedModTags);
return;
}
// TODO: @modio-UE4 capturing `this` is bad and we shouldn't do it. Better to store the cached tags as a TSharedPtr
// and capture that by value, so we are guaranteed lifetime
Modio::GetModTagOptionsAsync(
Expand Down
3 changes: 3 additions & 0 deletions Source/Modio/Public/Libraries/ModioEditModLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,7 @@ class MODIO_API UModioEditModLibrary : public UBlueprintFunctionLibrary

UFUNCTION(BlueprintCallable, Category = "mod.io|Edit Mod Params")
static void SetLogoPath(UPARAM(ref) FModioEditModParams& In, FString LogoPath);

UFUNCTION(BlueprintCallable, Category = "mod.io|Edit Mod Params")
static void SetTags(UPARAM(ref) FModioEditModParams& In, UPARAM(ref) TArray<FString>& Tags);
};
5 changes: 5 additions & 0 deletions Source/Modio/Public/Types/ModioEditModParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,9 @@ struct FModioEditModParams
* Optional path to a new logo image for this mod
**/
TOptional<FString> LogoPath;

/**
* List of metadata tags that reference the mod to create. They help to search and filter content
**/
TOptional<TArray<FString>> Tags;
};
6 changes: 6 additions & 0 deletions Source/Modio/Public/Types/ModioUser.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ struct MODIO_API FModioUser
**/
UPROPERTY(BlueprintReadOnly, Category = "User")
FString ProfileUrl;

/**
* Display name of this User for the given Portal, if their account is linked
**/
UPROPERTY(BlueprintReadOnly, Category = "User")
FString DisplayNamePortal;
};

/**
Expand Down
11 changes: 5 additions & 6 deletions Source/ModioUI/Private/ModioUISubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,17 +844,16 @@ void UModioUISubsystem::ShowUninstallConfirmationDialog(UObject* DialogDataSourc

TOptional<FModioModTagOptions> UModioUISubsystem::GetTagOptionsList()
{
if (CachedModTags.IsSet())
{
return CachedModTags;
}
return CachedModTags;
}

void UModioUISubsystem::GetTagOptionsListAsync()
{
if (UModioSubsystem* Subsystem = GEngine->GetEngineSubsystem<UModioSubsystem>())
{
Subsystem->GetModTagOptionsAsync(
FOnGetModTagOptionsDelegateFast::CreateUObject(this, &UModioUISubsystem::OnGetModTagOptionsComplete));
}

return TOptional<FModioModTagOptions>();
}

void UModioUISubsystem::OnGetModTagOptionsComplete(FModioErrorCode ec, TOptional<FModioModTagOptions> ModTags)
Expand Down
2 changes: 1 addition & 1 deletion Source/ModioUI/Private/UI/CommonComponents/ModioMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void UModioMenu::NativeOnInitialized()
{
Subsystem->EnableModManagement();
// Cache tags for this game
Subsystem->GetTagOptionsList();
Subsystem->GetTagOptionsListAsync();
}
// Find the refine search drawer, bind to its confirmed event so we know to display the search results
if (DrawerController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ void UModioRefineSearchDrawer::NativeOnInitialized()
{
SearchInput->MaxCharacters = MaxCharacterAmount;
}
if (CancelButton)
{
CancelButton->OnClicked.AddDynamic(this, &UModioRefineSearchDrawer::OnCancelClicked);
}

UISubsystem = GEngine->GetEngineSubsystem<UModioUISubsystem>();
UISubsystem->OnInputDeviceChanged.AddUObject(this, &UModioRefineSearchDrawer::OnInputDeviceChanged);
Expand Down Expand Up @@ -94,6 +98,7 @@ void UModioRefineSearchDrawer::ConstructNavigationPath()

NavigationPath.Add(ApplyButton);
NavigationPath.Add(ClearButton);
NavigationPath.Add(CancelButton);
}

void UModioRefineSearchDrawer::BindCollapseButtons()
Expand All @@ -118,6 +123,8 @@ void UModioRefineSearchDrawer::BindCollapseButtons()

void UModioRefineSearchDrawer::ValidateAndSetFocus()
{
CurrentNavIndex = FMath::Clamp(CurrentNavIndex, 0, NavigationPath.Num() - 1);
UE_LOG(LogTemp, Warning, TEXT("%d"), CurrentNavIndex);
if (NavigationPath.IsValidIndex(CurrentNavIndex))
{
if (!NavigationPath[CurrentNavIndex]->TakeWidget()->SupportsKeyboardFocus())
Expand Down Expand Up @@ -192,6 +199,11 @@ void UModioRefineSearchDrawer::OnClearClicked()
}
}

void UModioRefineSearchDrawer::OnCancelClicked()
{
GEngine->GetEngineSubsystem<UModioUISubsystem>()->CloseSearchDrawer();
}

void UModioRefineSearchDrawer::OnApplyClicked()
{
Execute_NotifySettingsChanged(
Expand Down Expand Up @@ -234,45 +246,39 @@ FReply UModioRefineSearchDrawer::NativeOnPreviewKeyDown(const FGeometry& MyGeome

if (InKeyEvent.GetKey() == EKeys::Tab && CurrentNavIndex == 0)
{
if (NavigationPath.IsValidIndex(CurrentNavIndex + 1))
{
CurrentNavIndex += 1;
}
CurrentNavIndex += 1;
ValidateAndSetFocus();
return FReply::Handled();
}

if (GetCommandKeyForEvent(InKeyEvent) == FModioInputKeys::Down)
{
if (NavigationPath.IsValidIndex(CurrentNavIndex + 1)) {
CurrentNavIndex += 1;
}
CurrentNavIndex += 1;
ValidateAndSetFocus();
return FReply::Handled();
}
else if (GetCommandKeyForEvent(InKeyEvent) == FModioInputKeys::Up)
{
if (NavigationPath.IsValidIndex(CurrentNavIndex - 1))
{
CurrentNavIndex -= 1;
}
CurrentNavIndex -= 1;
ValidateAndSetFocus();
return FReply::Handled();
}
else if (GetCommandKeyForEvent(InKeyEvent) == FModioInputKeys::Left)

if (CurrentNavIndex >= NavigationPath.Num() - 3)
{
if (CurrentNavIndex == NavigationPath.Num() - 1)
if (GetCommandKeyForEvent(InKeyEvent) == FModioInputKeys::Left)
{
CurrentNavIndex -= 1;
CurrentNavIndex--;
CurrentNavIndex = FMath::Clamp(CurrentNavIndex, NavigationPath.Num() - 3, NavigationPath.Num() - 1);
ValidateAndSetFocus();
return FReply::Handled();
}
}
else if (GetCommandKeyForEvent(InKeyEvent) == FModioInputKeys::Right)
{
if (CurrentNavIndex == NavigationPath.Num() - 2)
else if (GetCommandKeyForEvent(InKeyEvent) == FModioInputKeys::Right)
{
CurrentNavIndex += 1;
CurrentNavIndex++;
CurrentNavIndex = FMath::Clamp(CurrentNavIndex, NavigationPath.Num() - 3, NavigationPath.Num() - 1);
ValidateAndSetFocus();
return FReply::Handled();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ FText UModioModDetailsPropertyInspector::GetPropertyText(EModioModInfoPropertyTy
switch (PropertyType)
{
case EModioModInfoPropertyType::CreatorName:
if (ModInfo->Underlying.ProfileSubmittedBy.DisplayNamePortal.Len() > 0)
{
return FText::Format(FText::FromString("{0} ({1})"), FText::FromString(ModInfo->Underlying.ProfileSubmittedBy.Username),
FText::FromString(ModInfo->Underlying.ProfileSubmittedBy.DisplayNamePortal));
}

return FText::FromString(ModInfo->Underlying.ProfileSubmittedBy.Username);
case EModioModInfoPropertyType::LastUpdated:
{
Expand Down
2 changes: 2 additions & 0 deletions Source/ModioUI/Public/ModioUISubsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ UCLASS() class MODIOUI_API UModioUISubsystem : public UEngineSubsystem

TOptional<FModioModTagOptions> GetTagOptionsList();

void GetTagOptionsListAsync();

UFUNCTION(BlueprintCallable, Category = "ModioUISubsystem")
float GetCurrentDPIScaleValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class MODIOUI_API UModioRefineSearchDrawer : public UModioUserWidgetBase,
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Widgets", meta = (BindWidget))
UModioRichTextButton* ClearButton;

UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Widgets", meta = (BindWidget))
UModioRichTextButton* CancelButton;

UPROPERTY(BlueprintAssignable)
FOnSearchSettingsChanged OnSettingsChanged;

Expand Down Expand Up @@ -76,6 +79,8 @@ class MODIOUI_API UModioRefineSearchDrawer : public UModioUserWidgetBase,
UFUNCTION()
void OnApplyClicked();
UFUNCTION()
void OnCancelClicked();
UFUNCTION()
void ConstructNavigationPath();
UFUNCTION()
void OnCollapse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class MODIOUI_API UModioUIInputValidationLibrary : public UBlueprintFunctionLibr
{
// Regex for validating email adress found here: https://mylittledevblog.com/2018/02/15/ue4-email-validation/
// I would prefer to use https://stackoverflow.com/a/201378/12018052, but that doesn't work
const FRegexPattern Pattern(TEXT("(\\w+)(\\.|_)?(\\w*)@(\\w+)(\\.(\\w+))+"));
const FRegexPattern Pattern(TEXT("^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$"));
FRegexMatcher Matcher(Pattern, TextToValidate.ToString());

return Matcher.FindNext();
Expand Down

0 comments on commit f67f1d9

Please sign in to comment.