Commit 9a8bfd82 authored by Geovanny Vera's avatar Geovanny Vera

Meetings get

parent 4c983992
...@@ -25,7 +25,7 @@ DefaultGraphicsPerformance=Scalable ...@@ -25,7 +25,7 @@ DefaultGraphicsPerformance=Scalable
AppliedDefaultGraphicsPerformance=Scalable AppliedDefaultGraphicsPerformance=Scalable
[/Script/EngineSettings.GameMapsSettings] [/Script/EngineSettings.GameMapsSettings]
EditorStartupMap=/Game/Campus/Maps/MainMenu.MainMenu EditorStartupMap=/Game/Campus/Maps/Login.Login
LocalMapOptions= LocalMapOptions=
TransitionMap=None TransitionMap=None
bUseSplitscreen=False bUseSplitscreen=False
...@@ -34,7 +34,7 @@ ThreePlayerSplitscreenLayout=FavorTop ...@@ -34,7 +34,7 @@ ThreePlayerSplitscreenLayout=FavorTop
FourPlayerSplitscreenLayout=Grid FourPlayerSplitscreenLayout=Grid
bOffsetPlayerGamepadIds=False bOffsetPlayerGamepadIds=False
GameInstanceClass=/Script/VRClassroom.VRCGameInstance GameInstanceClass=/Script/VRClassroom.VRCGameInstance
GameDefaultMap=/Game/Campus/Maps/MainMenu.MainMenu GameDefaultMap=/Game/Campus/Maps/Login.Login
ServerDefaultMap=/Game/Campus/Maps/TestServer.TestServer ServerDefaultMap=/Game/Campus/Maps/TestServer.TestServer
GlobalDefaultGameMode=/Game/Campus/Blueprints/BP_GameMode.BP_GameMode_C GlobalDefaultGameMode=/Game/Campus/Blueprints/BP_GameMode.BP_GameMode_C
GlobalDefaultServerGameMode=None GlobalDefaultServerGameMode=None
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "HttpService.h" #include "HttpService.h"
#include "Runtime/Core/Public/Misc/ConfigCacheIni.h" #include "Runtime/Core/Public/Misc/ConfigCacheIni.h"
#include "Runtime/Online/HTTP/Public/Http.h" #include "Runtime/Online/HTTP/Public/Http.h"
#include "VRCGameInstance.h"
UHttpService::UHttpService(const class FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) UHttpService::UHttpService(const class FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{ {
...@@ -24,8 +25,25 @@ UHttpService* UHttpService::GetHttp() { ...@@ -24,8 +25,25 @@ UHttpService* UHttpService::GetHttp() {
} }
void UHttpService::SetAuthToken(FString token) { void UHttpService::SetAuthToken(FString token) {
AuthToken = "Bearer "; if (AuthToken.IsEmpty()) {
AuthToken.Append(token); UE_LOG(LogTemp, Log, TEXT("Kill me"));
}
else {
UE_LOG(LogTemp, Log, TEXT("I don't know anymore"));
}
FString killme = FString("Bearer ");
killme.Append(token);
//AuthToken = FString("Bearer ");
//AuthToken.Empty();
//AuthToken.Append(*killme);
}
FString UHttpService::GetAuthToken() {
FString why = FString("Bearer ");
UVRCGameInstance* GameInstance = Cast<UVRCGameInstance>(GetWorld()->GetGameInstance());
why.Append(GameInstance->GetUserToken());
return why;
} }
void UHttpService::SetTimeout(float Timeout) { void UHttpService::SetTimeout(float Timeout) {
...@@ -81,10 +99,14 @@ TSharedRef<IHttpRequest> UHttpService::GetRequest(FString Subroute) { ...@@ -81,10 +99,14 @@ TSharedRef<IHttpRequest> UHttpService::GetRequest(FString Subroute) {
TSharedRef<IHttpRequest> UHttpService::AuthPostRequest(FString Subroute, FString ContentJsonString) { TSharedRef<IHttpRequest> UHttpService::AuthPostRequest(FString Subroute, FString ContentJsonString) {
TSharedRef<IHttpRequest> Request = PostRequest(Subroute, ContentJsonString); TSharedRef<IHttpRequest> Request = PostRequest(Subroute, ContentJsonString);
Request->SetHeader("Authorization", AuthToken); Request->SetHeader("Authorization", GetAuthToken());
return Request;
} }
TSharedRef<IHttpRequest> UHttpService::AuthGetRequest(FString Subroute) { TSharedRef<IHttpRequest> UHttpService::AuthGetRequest(FString Subroute) {
TSharedRef<IHttpRequest> Request = GetRequest(Subroute); TSharedRef<IHttpRequest> Request = GetRequest(Subroute);
Request->SetHeader("Authorization", AuthToken); Request->SetHeader("Authorization", GetAuthToken());
return Request;
} }
\ No newline at end of file
...@@ -19,17 +19,17 @@ void AVRCPlayerController::ConnectToCampus() { ...@@ -19,17 +19,17 @@ void AVRCPlayerController::ConnectToCampus() {
UVRCGameInstance* GameInstance = Cast<UVRCGameInstance>(GetWorld()->GetGameInstance()); UVRCGameInstance* GameInstance = Cast<UVRCGameInstance>(GetWorld()->GetGameInstance());
Http = GameInstance->GetHttpService(); Http = GameInstance->GetHttpService();
//FString token = GameInstance->GetUserToken(); FString token = GameInstance->GetUserToken();
Http->SetTimeout(TravelTimeout); Http->SetTimeout(TravelTimeout);
TSharedRef<IHttpRequest> Request = Http->AuthGetRequest("instances/join-server"); TSharedRef<IHttpRequest> Request = Http->GetRequest("instances/join-server");
Request->OnProcessRequestComplete().BindUObject(this, &AVRCPlayerController::OnConnectToCampusResponseRecieved); Request->OnProcessRequestComplete().BindUObject(this, &AVRCPlayerController::OnConnectToCampusResponseRecieved);
Request->SetHeader("Accepts", TEXT("application/json")); Request->SetHeader("Accepts", TEXT("application/json"));
//FString auth = "Bearer "; FString auth = "Bearer ";
//auth.Append(token); auth.Append(token);
//Request->SetHeader("Authorization", auth); Request->SetHeader("Authorization", auth);
//FString url = FString(VRCAPIPath + "instances/join-server"); //FString url = FString(VRCAPIPath + "instances/join-server");
...@@ -68,15 +68,19 @@ void AVRCPlayerController::ConnectToMeeting(int32 MeetingId) { ...@@ -68,15 +68,19 @@ void AVRCPlayerController::ConnectToMeeting(int32 MeetingId) {
UVRCGameInstance* GameInstance = Cast<UVRCGameInstance>(GetWorld()->GetGameInstance()); UVRCGameInstance* GameInstance = Cast<UVRCGameInstance>(GetWorld()->GetGameInstance());
Http = GameInstance->GetHttpService(); Http = GameInstance->GetHttpService();
FString token = GameInstance->GetUserToken();
Http->SetTimeout(20.0f); Http->SetTimeout(20.0f);
FString SubRoute = "instances/join-classroom/"; FString SubRoute = "instances/join-classroom/";
SubRoute.AppendInt(MeetingId); SubRoute.AppendInt(MeetingId);
TSharedRef<IHttpRequest> Request = Http->AuthGetRequest(SubRoute); TSharedRef<IHttpRequest> Request = Http->GetRequest(SubRoute);
//FString url = "http://localhost:1337/instances/join-classroom/"; //FString url = "http://localhost:1337/instances/join-classroom/";
//url.AppendInt(MeetingId); //url.AppendInt(MeetingId);
//Request->SetURL(url); //Request->SetURL(url);
FString auth = "Bearer ";
auth.Append(token);
Request->SetHeader("Authorization", auth);
Request->SetHeader("Accepts", TEXT("application/json")); Request->SetHeader("Accepts", TEXT("application/json"));
Request->OnProcessRequestComplete().BindUObject(this, &AVRCPlayerController::OnConnectToMeetingResponseRecieved); Request->OnProcessRequestComplete().BindUObject(this, &AVRCPlayerController::OnConnectToMeetingResponseRecieved);
......
...@@ -10,17 +10,17 @@ void UVRCScheduleWidget::GetMeetings() { ...@@ -10,17 +10,17 @@ void UVRCScheduleWidget::GetMeetings() {
UVRCGameInstance* GameInstance = Cast<UVRCGameInstance>(GetWorld()->GetGameInstance()); UVRCGameInstance* GameInstance = Cast<UVRCGameInstance>(GetWorld()->GetGameInstance());
Http = GameInstance->GetHttpService(); Http = GameInstance->GetHttpService();
//FString token = GameInstance->GetUserToken(); FString token = GameInstance->GetUserToken();
Http->SetTimeout(20.0f); Http->SetTimeout(5.0f);
TSharedRef<IHttpRequest> Request = Http->AuthGetRequest("users/meetings"); TSharedRef<IHttpRequest> Request = Http->GetRequest("users/meetings");
//Request->SetURL(FString("http://localhost:1337/users/meetings")); //Request->SetURL(FString("http://localhost:1337/users/meetings"));
Request->SetHeader("Accepts", TEXT("application/json")); Request->SetHeader("Accepts", TEXT("application/json"));
Request->OnProcessRequestComplete().BindUObject(this, &UVRCScheduleWidget::OnGetMeetingsResponseRecieved); Request->OnProcessRequestComplete().BindUObject(this, &UVRCScheduleWidget::OnGetMeetingsResponseRecieved);
//FString auth = "Bearer "; FString auth = "Bearer ";
//auth.Append(token); auth.Append(token);
//Request->SetHeader("Authorization", auth); Request->SetHeader("Authorization", auth);
Request->ProcessRequest(); Request->ProcessRequest();
//Testy(); //Testy();
...@@ -48,7 +48,7 @@ void UVRCScheduleWidget::OnGetMeetingsResponseRecieved(FHttpRequestPtr Request, ...@@ -48,7 +48,7 @@ void UVRCScheduleWidget::OnGetMeetingsResponseRecieved(FHttpRequestPtr Request,
FString content = FString(Response->GetContentAsString()); FString content = FString(Response->GetContentAsString());
if (FJsonObjectConverter::JsonArrayStringToUStruct(content, &responseMeetings, 0, 0)) { if (FJsonObjectConverter::JsonArrayStringToUStruct(content, &responseMeetings, 0, 0)) {
meetings = responseMeetings; meetings = responseMeetings;
UE_LOG(LogTemp, Log, TEXT("Meetings found: %d", meetings.Num)); UE_LOG(LogTemp, Log, TEXT("Meetings found"));
NotifyGetMeetings(); NotifyGetMeetings();
} }
......
// Copyright 2020 Testy
#include "VRCWidgetComponent.h"
void UVRCWidgetComponent::ToggleWidget(bool toggle) {
bToggleWidget = toggle;
this->SetVisibility(bToggleWidget);
if (bToggleWidget) {
this->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
}
else {
this->SetCollisionEnabled(ECollisionEnabled::NoCollision);
}
}
\ No newline at end of file
...@@ -15,7 +15,7 @@ class VRCLASSROOM_API UHttpService : public UObject ...@@ -15,7 +15,7 @@ class VRCLASSROOM_API UHttpService : public UObject
GENERATED_BODY() GENERATED_BODY()
FHttpModule* Http; FHttpModule* Http;
FString AuthToken = ""; FString AuthToken;
public: public:
...@@ -27,6 +27,8 @@ public: ...@@ -27,6 +27,8 @@ public:
void SetAuthToken(FString token); void SetAuthToken(FString token);
FString GetAuthToken();
void SetTimeout(float Timeout); void SetTimeout(float Timeout);
bool ResponseIsValid(FHttpResponsePtr Response, bool bWasSuccessful); bool ResponseIsValid(FHttpResponsePtr Response, bool bWasSuccessful);
......
// Copyright 2020 Testy
#pragma once
#include "CoreMinimal.h"
#include "Components/WidgetComponent.h"
#include "VRCWidgetComponent.generated.h"
/**
*
*/
UCLASS(ClassGroup = (Custom), Blueprintable, meta = (BlueprintSpawnableComponent))
class VRCLASSROOM_API UVRCWidgetComponent : public UWidgetComponent
{
GENERATED_BODY()
bool bToggleWidget;
public:
UFUNCTION(BlueprintCallable, Category = "Widget")
void ToggleWidget(bool toggle);
};
{ {
"FileVersion": 3, "FileVersion": 3,
<<<<<<< HEAD
"EngineAssociation": "{0506F437-410D-A1AD-0DE5-36A1D1C0C5F7}", "EngineAssociation": "{0506F437-410D-A1AD-0DE5-36A1D1C0C5F7}",
=======
"EngineAssociation": "{7E4506D0-4E9A-9CE5-C703-1FAFBE0E6174}",
>>>>>>> 50f7ad7d559929fa644f71b77304290f2c4d15cf
"Category": "", "Category": "",
"Description": "", "Description": "",
"Modules": [ "Modules": [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment