Skip to content

Commit

Permalink
Merge pull request #14 from stomt/feature/details
Browse files Browse the repository at this point in the history
Feature: Details - allow users to add more text
  • Loading branch information
maxklenk authored Jan 27, 2021
2 parents e7cc739 + 384f3d0 commit d8061dd
Show file tree
Hide file tree
Showing 11 changed files with 255 additions and 207 deletions.
Binary file modified Content/Blueprints/Interface/StomtWidgetBP.uasset
Binary file not shown.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[4.24](https://github.com/stomt/stomt-unreal-plugin/tree/UE/4.24),
[4.25](https://github.com/stomt/stomt-unreal-plugin/tree/UE/4.25))**


<p align="center">
<img alt="STOMT Unreal Engine feedback integration" src="https://i.imgur.com/1i1eCrb.jpg" />
</p>
Expand Down
386 changes: 195 additions & 191 deletions Resources/languages.json

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion Source/StomtPlugin/Private/Stomt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ UStomt::UStomt()

}

UStomt* UStomt::ConstructStomt(FString NewTargetId, bool bNewPositive, FString NewText)
UStomt* UStomt::ConstructStomt(FString NewTargetId, bool bNewPositive, FString NewText, FString NewDetails)
{
UStomt* NewStomt = NewObject<UStomt>();
NewStomt->SetTargetId(NewTargetId);
NewStomt->SetPositive(bNewPositive);
NewStomt->SetText(NewText);
NewStomt->SetDetails(NewDetails);

return NewStomt;
}
Expand All @@ -40,6 +41,11 @@ void UStomt::SetText(FString NewText)
this->Text = NewText;
}

void UStomt::SetDetails(FString NewDetails)
{
this->Details = NewDetails;
}

void UStomt::SetAnonym(bool bNewAnonym)
{
this->bAnonym = bNewAnonym;
Expand Down Expand Up @@ -87,6 +93,12 @@ FString UStomt::GetText()
return this->Text;
}


FString UStomt::GetDetails()
{
return this->Details;
}

bool UStomt::GetAnonym()
{
return this->bAnonym;
Expand Down
5 changes: 3 additions & 2 deletions Source/StomtPlugin/Private/StomtAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ void UStomtAPI::SendStomt(UStomt* NewStomt)
Request->GetRequestObject()->SetField(TEXT("target_id"), UStomtJsonValue::ConstructJsonValueString(this, NewStomt->GetTargetId()));
Request->GetRequestObject()->SetField(TEXT("positive"), UStomtJsonValue::ConstructJsonValueBool(this, NewStomt->GetPositive()));
Request->GetRequestObject()->SetField(TEXT("text"), UStomtJsonValue::ConstructJsonValueString(this, NewStomt->GetText()));
Request->GetRequestObject()->SetField(TEXT("details"), UStomtJsonValue::ConstructJsonValueString(this, NewStomt->GetDetails()));
Request->GetRequestObject()->SetField(TEXT("anonym"), UStomtJsonValue::ConstructJsonValueBool(this, NewStomt->GetAnonym()));

// Labels
UStomtRestJsonObject* JObjExtraData = UStomtRestJsonObject::ConstructJsonObject(this);
TArray<UStomtJsonValue*> Labels = TArray<UStomtJsonValue*>();
Expand Down Expand Up @@ -701,7 +702,7 @@ FString UStomtAPI::LoadLanguageFileContent()
{
UE_LOG(StomtInit, Warning, TEXT("Language file not found"));

JsonString = "{\"data\":{\"de\": {\"SDK_STOMT_WISH_BUBBLE\": \"Ich wünschte\",\"SDK_STOMT_LIKE_BUBBLE\": \"Ich mag\",\"SDK_STOMT_DEFAULT_TEXT_WISH\": \"würde\",\"SDK_STOMT_DEFAULT_TEXT_LIKE\": \"weil\",\"SDK_STOMT_PLACEHOLDER\": \"...bitte beende diesen Satz\",\"SDK_STOMT_ERROR_MORE_TEXT\": \"Bitte schreibe etwas mehr.\",\"SDK_STOMT_ERROR_LESS_TEXT\": \"Nutze nur {0} Zeichen.\", \"SDK_STOMT_SCREENSHOT\": \"Screenshot\",\"SDK_HEADER_TARGET_STOMTS\": \"STOMTS\",\"SDK_HEADER_YOUR_STOMTS\": \"DEINE\",\"SDK_SUBSCRIBE_GET_NOTIFIED\": \"Werde benachrichtigt, wenn jemand reagiert.\",\"SDK_SUBSCRIBE_TOGGLE_EMAIL\": \"E-Mail\",\"SDK_SUBSCRIBE_TOGGLE_PHONE\": \"SMS\",\"SDK_SUBSCRIBE_EMAIL_QUESTION\": \"Wie lautet deine E-Mail-Adresse?\",\"SDK_SUBSCRIBE_PHONE_QUESTION\": \"Wie lautet deine Telefonnummer?\",\"SDK_SUBSCRIBE_PHONE_PLACEHOLDER\" : \"+49 152 03959902\",\"SDK_SUBSCRIBE_EMAIL_PLACEHOLDER\" : \"[email protected]\",\"SDK_SUBSCRIBE_DEFAULT_PLACEHOLDER\" : \"Wir senden dir keine Spam Nachrichten\",\"SDK_SUBSCRIBE_VALID_EMAIL\" : \"E-Mail-Adresse ist gültig, fantastisch!\",\"SDK_SUBSCRIBE_NO_VALID_EMAIL\" : \"Bitte gebe eine gültige Adresse ein.\",\"SDK_SUBSCRIBE_SKIP\": \"Überspringen\",\"SDK_SUCCESS_THANK_YOU\": \"DANKE!\",\"SDK_SUCCESS_FIND_ALL_STOMTS\": \"Super, finde mehr Wünsche auf\",\"SDK_SUCCESS_FIND_YOUR_STOMTS\": \"Finde deine stomts\",\"SDK_SUCCESS_CREATE_NEW_WISH\": \"Wünsch dir noch was\",\"SDK_NETWORK_NOT_CONNECTED\": \"Verbindung zu STOMT unterbrochen\",\"SDK_NETWORK_NO_INTERNET\": \"Keine Internetverbindung\",\"SDK_NETWORK_RECONNECT\": \"Wiederverbinden\",\"SDK_LOGIN_ACCOUNT_WRONG\": \"Account Name stimmt nicht.\",\"SDK_LOGIN_PASSWORD_WRONG\": \"Passwort stimmt nicht.\",\"SDK_LOGIN_PASSWORD\": \"Passwort\",\"SDK_LOGIN\": \"Login\",\"SDK_LOGIN_SIGNUP\": \"Anmelden\",\"SDK_LOGIN_LOGOUT\": \"Ausloggen\",\"SDK_LOGIN_FORGOT_PW\": \"Passwort vergessen?\",\"SDK_LOGIN_SUCCESS\": \"Du bist eingeloggt!\",\"SDK_LOGIN_WENT_WRONG\": \"Ups, da lief was schief.\"},\"en\": {\"SDK_STOMT_WISH_BUBBLE\": \"I wish\",\"SDK_STOMT_LIKE_BUBBLE\": \"I like\",\"SDK_STOMT_DEFAULT_TEXT_WISH\": \"would\",\"SDK_STOMT_DEFAULT_TEXT_LIKE\": \"because\",\"SDK_STOMT_PLACEHOLDER\": \"...please finish the sentence\",\"SDK_STOMT_ERROR_MORE_TEXT\": \"Please write a bit more.\",\"SDK_STOMT_ERROR_LESS_TEXT\": \"Use only {0} characters.\", \"SDK_STOMT_SCREENSHOT\": \"Screenshot\",\"SDK_HEADER_TARGET_STOMTS\": \"STOMTS\",\"SDK_HEADER_YOUR_STOMTS\": \"YOURS\",\"SDK_SUBSCRIBE_GET_NOTIFIED\": \"Get notified when someone reacts.\",\"SDK_SUBSCRIBE_TOGGLE_EMAIL\": \"E-Mail\",\"SDK_SUBSCRIBE_TOGGLE_PHONE\": \"SMS\",\"SDK_SUBSCRIBE_EMAIL_QUESTION\": \"What's your email address?\",\"SDK_SUBSCRIBE_PHONE_QUESTION\": \"What's your phone number?\",\"SDK_SUBSCRIBE_PHONE_PLACEHOLDER\" : \"+1-541-754-3010\",\"SDK_SUBSCRIBE_EMAIL_PLACEHOLDER\" : \"[email protected]\",\"SDK_SUBSCRIBE_DEFAULT_PLACEHOLDER\" : \"We won’t share your contact nor spam you.\",\"SDK_SUBSCRIBE_VALID_EMAIL\" : \"Email address is valid, fantastic!\",\"SDK_SUBSCRIBE_NO_VALID_EMAIL\" : \"Please type in a valid address.\",\"SDK_SUBSCRIBE_SKIP\": \"Skip\",\"SDK_SUCCESS_THANK_YOU\": \"THANK YOU!\",\"SDK_SUCCESS_FIND_ALL_STOMTS\": \"Amazing, find more wishes on\",\"SDK_SUCCESS_FIND_YOUR_STOMTS\": \"click to find your stomts here\",\"SDK_SUCCESS_CREATE_NEW_WISH\": \"Create another wish\",\"SDK_NETWORK_NOT_CONNECTED\": \"Could not connect to STOMT\",\"SDK_NETWORK_NO_INTERNET\": \"No internet connection\",\"SDK_NETWORK_RECONNECT\": \"Reconnect\",\"SDK_LOGIN_ACCOUNT_WRONG\": \"Account was incorrect.\",\"SDK_LOGIN_PASSWORD_WRONG\": \"Password was incorrect.\",\"SDK_LOGIN_PASSWORD\": \"Password\",\"SDK_LOGIN\": \"Login\",\"SDK_LOGIN_SIGNUP\": \"Signup\",\"SDK_LOGIN_LOGOUT\": \"Logout\",\"SDK_LOGIN_FORGOT_PW\": \"Forgot password?\",\"SDK_LOGIN_SUCCESS\": \"You're now logged in!\",\"SDK_LOGIN_WENT_WRONG\": \"Ups something went wrong.\"}}}";
JsonString = "{\"data\":{\"de\": {\"SDK_STOMT_WISH_BUBBLE\": \"Ich wünschte\",\"SDK_STOMT_LIKE_BUBBLE\": \"Ich mag\",\"SDK_STOMT_DEFAULT_TEXT_WISH\": \"würde\",\"SDK_STOMT_DEFAULT_TEXT_LIKE\": \"weil\",\"SDK_STOMT_PLACEHOLDER\": \"...bitte beende diesen Satz\",\"SDK_STOMT_ERROR_MORE_TEXT\": \"Bitte schreibe etwas mehr.\",\"SDK_STOMT_ERROR_LESS_TEXT\": \"Nutze nur {0} Zeichen.\", \"SDK_STOMT_SCREENSHOT\": \"Screenshot\",\"SDK_HEADER_TARGET_STOMTS\": \"STOMTS\",\"SDK_HEADER_YOUR_STOMTS\": \"DEINE\",\"SDK_SUBSCRIBE_GET_NOTIFIED\": \"Werde benachrichtigt, wenn jemand reagiert.\",\"SDK_SUBSCRIBE_TOGGLE_EMAIL\": \"E-Mail\",\"SDK_SUBSCRIBE_TOGGLE_PHONE\": \"SMS\",\"SDK_SUBSCRIBE_EMAIL_QUESTION\": \"Wie lautet deine E-Mail-Adresse?\",\"SDK_SUBSCRIBE_PHONE_QUESTION\": \"Wie lautet deine Telefonnummer?\",\"SDK_SUBSCRIBE_PHONE_PLACEHOLDER\" : \"+49 152 03959902\",\"SDK_SUBSCRIBE_EMAIL_PLACEHOLDER\" : \"[email protected]\",\"SDK_SUBSCRIBE_DEFAULT_PLACEHOLDER\" : \"Wir senden dir keine Spam Nachrichten\",\"SDK_SUBSCRIBE_VALID_EMAIL\" : \"E-Mail-Adresse ist gültig, fantastisch!\",\"SDK_SUBSCRIBE_NO_VALID_EMAIL\" : \"Bitte gebe eine gültige Adresse ein.\",\"SDK_SUBSCRIBE_SKIP\": \"Überspringen\",\"SDK_SUCCESS_THANK_YOU\": \"DANKE!\",\"SDK_SUCCESS_FIND_ALL_STOMTS\": \"Super, finde mehr Wünsche auf\",\"SDK_SUCCESS_FIND_YOUR_STOMTS\": \"Finde deine stomts\",\"SDK_SUCCESS_CREATE_NEW_WISH\": \"Wünsch dir noch was\",\"SDK_NETWORK_NOT_CONNECTED\": \"Verbindung zu STOMT unterbrochen\",\"SDK_NETWORK_NO_INTERNET\": \"Keine Internetverbindung\",\"SDK_NETWORK_RECONNECT\": \"Wiederverbinden\",\"SDK_LOGIN_ACCOUNT_WRONG\": \"Account Name stimmt nicht.\",\"SDK_LOGIN_PASSWORD_WRONG\": \"Passwort stimmt nicht.\",\"SDK_LOGIN_PASSWORD\": \"Passwort\",\"SDK_LOGIN\": \"Login\",\"SDK_LOGIN_SIGNUP\": \"Anmelden\",\"SDK_LOGIN_LOGOUT\": \"Ausloggen\",\"SDK_LOGIN_FORGOT_PW\": \"Passwort vergessen?\",\"SDK_LOGIN_SUCCESS\": \"Du bist eingeloggt!\",\"SDK_LOGIN_WENT_WRONG\": \"Ups, da lief was schief.\",\"SDK_ADD_DETAILS\": \"Mehr Text\",\"SDK_TERMS_LOGS_OPT_IN\": \"Dürfen wir Log-Dateien mitsenden?\",\"SDK_TERMS_LOGS_OPT_IN_DIS\": \"Nein, bitte nicht.\",\"SDK_TERMS_LOGS_OPT_OUT\": \"Wir werden Log-Dateien anhängen.\",\"SDK_TERMS_LOGS_OPT_OUT_DIS\": \"Keine Log-Dateien anhängen.\"},\"en\": {\"SDK_STOMT_WISH_BUBBLE\": \"I wish\",\"SDK_STOMT_LIKE_BUBBLE\": \"I like\",\"SDK_STOMT_DEFAULT_TEXT_WISH\": \"would\",\"SDK_STOMT_DEFAULT_TEXT_LIKE\": \"because\",\"SDK_STOMT_PLACEHOLDER\": \"...please finish the sentence\",\"SDK_STOMT_ERROR_MORE_TEXT\": \"Please write a bit more.\",\"SDK_STOMT_ERROR_LESS_TEXT\": \"Use only {0} characters.\", \"SDK_STOMT_SCREENSHOT\": \"Screenshot\",\"SDK_HEADER_TARGET_STOMTS\": \"STOMTS\",\"SDK_HEADER_YOUR_STOMTS\": \"YOURS\",\"SDK_SUBSCRIBE_GET_NOTIFIED\": \"Get notified when someone reacts.\",\"SDK_SUBSCRIBE_TOGGLE_EMAIL\": \"E-Mail\",\"SDK_SUBSCRIBE_TOGGLE_PHONE\": \"SMS\",\"SDK_SUBSCRIBE_EMAIL_QUESTION\": \"What's your email address?\",\"SDK_SUBSCRIBE_PHONE_QUESTION\": \"What's your phone number?\",\"SDK_SUBSCRIBE_PHONE_PLACEHOLDER\" : \"+1-541-754-3010\",\"SDK_SUBSCRIBE_EMAIL_PLACEHOLDER\" : \"[email protected]\",\"SDK_SUBSCRIBE_DEFAULT_PLACEHOLDER\" : \"We won’t share your contact nor spam you.\",\"SDK_SUBSCRIBE_VALID_EMAIL\" : \"Email address is valid, fantastic!\",\"SDK_SUBSCRIBE_NO_VALID_EMAIL\" : \"Please type in a valid address.\",\"SDK_SUBSCRIBE_SKIP\": \"Skip\",\"SDK_SUCCESS_THANK_YOU\": \"THANK YOU!\",\"SDK_SUCCESS_FIND_ALL_STOMTS\": \"Amazing, find more wishes on\",\"SDK_SUCCESS_FIND_YOUR_STOMTS\": \"click to find your stomts here\",\"SDK_SUCCESS_CREATE_NEW_WISH\": \"Create another wish\",\"SDK_NETWORK_NOT_CONNECTED\": \"Could not connect to STOMT\",\"SDK_NETWORK_NO_INTERNET\": \"No internet connection\",\"SDK_NETWORK_RECONNECT\": \"Reconnect\",\"SDK_LOGIN_ACCOUNT_WRONG\": \"Account was incorrect.\",\"SDK_LOGIN_PASSWORD_WRONG\": \"Password was incorrect.\",\"SDK_LOGIN_PASSWORD\": \"Password\",\"SDK_LOGIN\": \"Login\",\"SDK_LOGIN_SIGNUP\": \"Signup\",\"SDK_LOGIN_LOGOUT\": \"Logout\",\"SDK_LOGIN_FORGOT_PW\": \"Forgot password?\",\"SDK_LOGIN_SUCCESS\": \"You're now logged in!\",\"SDK_LOGIN_WENT_WRONG\": \"Ups something went wrong.\",\"SDK_ADD_DETAILS\": \"More Text\",\"SDK_TERMS_LOGS_OPT_IN\": \"May we attach log files?\",\"SDK_TERMS_LOGS_OPT_IN_DIS\": \"No, please don't.\",\"SDK_TERMS_LOGS_OPT_OUT\": \"We will attach log files to your stomt.\",\"SDK_TERMS_LOGS_OPT_OUT_DIS\": \"Do not attach log files.\"}}}";
return JsonString;
}

Expand Down
3 changes: 2 additions & 1 deletion Source/StomtPlugin/Private/StomtConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ TArray<UStomt*> UStomtConfig::GetStomts()
UStomt* StomtObject = UStomt::ConstructStomt(
JObjStomt->GetStringField("target_id"),
JObjStomt->GetBoolField("positive"),
JObjStomt->GetStringField("text")
JObjStomt->GetStringField("text"),
JObjStomt->GetStringField("details")
);

StomtObjects.Add(StomtObject);
Expand Down
15 changes: 14 additions & 1 deletion Source/StomtPlugin/Private/StomtPluginWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ void UStomtPluginWidget::OnMessageChanged(FString text)
}
}


void UStomtPluginWidget::OnDetailsCommitted(FString text)
{
if (!text.IsEmpty())
{
this->Details = text;
}
else
{
this->Details = FString(TEXT(""));
}
}

void UStomtPluginWidget::OnSubmit()
{
if (this->Message.IsEmpty())
Expand All @@ -63,7 +76,7 @@ void UStomtPluginWidget::OnSubmit()
UE_LOG(StomtLog, Log, TEXT("Is EMail Already Known: %s"), this->bIsEMailAlreadyKnown ? TEXT("true") : TEXT("false"));

// Create Stomt Instance
this->Stomt = UStomt::ConstructStomt(this->Api->GetTargetId(), !this->bIsWish, this->Message);
this->Stomt = UStomt::ConstructStomt(this->Api->GetTargetId(), !this->bIsWish, this->Message, this->Details);
this->Stomt->SetLabels(this->Labels);
this->Stomt->SetAnonym(false);

Expand Down
9 changes: 3 additions & 6 deletions Source/StomtPlugin/Private/StomtRestRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,10 @@ TArray<FString> UStomtRestRequest::GetAllResponseHeaders()

void UStomtRestRequest::ProcessUrl(const FString& Url)
{
TSharedRef<IHttpRequest> HttpRequest = FHttpModule::Get().CreateRequest();
// Signature changed from version 4.25 to 4.26 (ThreadSafe)
auto HttpRequest = FHttpModule::Get().CreateRequest();
HttpRequest->SetURL(Url);

this->ProcessRequest(HttpRequest);
}

void UStomtRestRequest::ProcessRequest(TSharedRef<IHttpRequest> HttpRequest)
{
// Set verb
switch (RequestVerb)
{
Expand Down Expand Up @@ -190,6 +186,7 @@ void UStomtRestRequest::ProcessRequest(TSharedRef<IHttpRequest> HttpRequest)
HttpRequest->ProcessRequest();
}


//////////////////////////////////////////////////////////////////////////
// Request callbacks

Expand Down
11 changes: 10 additions & 1 deletion Source/StomtPlugin/Public/Stomt.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ class STOMTPLUGIN_API UStomt : public UObject
* @param NewTargetId - Stomt target Id
* @param bNewPositive - whether it is wish(false) or like(true)
* @param NewText - Stomt content text.
* @param NewDetails - Stomt details text.
*/
static UStomt* ConstructStomt(FString NewTargetId, bool bNewPositive, FString NewText);
static UStomt* ConstructStomt(FString NewTargetId, bool bNewPositive, FString NewText, FString NewDetails);

//////////////////////////////////////////////////////////////////////////
// Destruction and reset
Expand All @@ -37,6 +38,8 @@ class STOMTPLUGIN_API UStomt : public UObject
void SetPositive(bool bNewPositive);

void SetText(FString NewText);

void SetDetails(FString NewDetails);

void SetAnonym(bool bNewAnonym);

Expand All @@ -54,12 +57,15 @@ class STOMTPLUGIN_API UStomt : public UObject
bool GetPositive();

FString GetText();

FString GetDetails();

bool GetAnonym();

TArray<UStomtLabel*> GetLabels();

FString GetServersideId();



//////////////////////////////////////////////////////////////////////////
Expand All @@ -81,6 +87,9 @@ class STOMTPLUGIN_API UStomt : public UObject
UPROPERTY()
FString Url;

UPROPERTY()
FString Details;

UPROPERTY()
bool bAnonym;

Expand Down
13 changes: 13 additions & 0 deletions Source/StomtPlugin/Public/StomtPluginWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ class UStomtPluginWidget : public UUserWidget
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stomt Widget Plugin")
FString Message;

/**
* Stomt details-text from the UI textbox.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stomt Widget Plugin")
FString Details;

/**
* EMail from the UI EMail layer.
*/
Expand Down Expand Up @@ -122,6 +128,13 @@ class UStomtPluginWidget : public UUserWidget
UFUNCTION(BlueprintCallable, Category = "Stomt Widget Plugin")
void OnMessageChanged(FString text);

/**
* Event when details text of the widget is committed.
* @param text - Current details text from the widget-textbox
*/
UFUNCTION(BlueprintCallable, Category = "Stomt Widget Plugin")
void OnDetailsCommitted(FString text);

/**
* Once the user sends off the stomt.
*/
Expand Down
5 changes: 1 addition & 4 deletions Source/StomtPlugin/Public/StomtRestRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ class UStomtRestRequest : public UObject
// URL processing

/** Open URL with current setup */
virtual void ProcessUrl(const FString& Url = TEXT("http://alyamkin.com"));

/** Apply current internal setup to Request and process it */
void ProcessRequest(TSharedRef<IHttpRequest> HttpRequest);
virtual void ProcessUrl(const FString& Url);


//////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit d8061dd

Please sign in to comment.