Skip to content

Commit 4e7ed0b

Browse files
Add Linux support. Fix Unicode characters in chat. (#24)
add(Linux): add Linux support fix(chat): fix bug that Unicode characters became broken when sent in chat message
1 parent 53957d0 commit 4e7ed0b

File tree

9 files changed

+27
-9
lines changed

9 files changed

+27
-9
lines changed

PubnubChat.uplugin

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FileVersion": 3,
3-
"Version": 10,
4-
"VersionName": "0.2.4",
3+
"Version": 11,
4+
"VersionName": "0.2.5",
55
"FriendlyName": "Pubnub Chat SDK",
66
"Description": "Quickly and easily integrate a real-time text chat solution that is reliable, flexible, and scalable.",
77
"Category": "Code",
@@ -16,7 +16,8 @@
1616
"Installed": false,
1717
"SupportedTargetPlatforms": [
1818
"Win64",
19-
"Mac"
19+
"Mac",
20+
"Linux"
2021
],
2122
"Modules": [
2223
{
@@ -25,7 +26,8 @@
2526
"LoadingPhase": "PostEngineInit",
2627
"PlatformAllowList": [
2728
"Win64",
28-
"Mac"
29+
"Mac",
30+
"Linux"
2931
]
3032
}
3133
]

Source/PubnubChatSDK/Private/FunctionLibraries/PubnubChatUtilities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
FString UPubnubChatUtilities::PubnubStringToFString(Pubnub::String PubnubString)
1515
{
16-
return FString(PubnubString);
16+
return FString(UTF8_TO_TCHAR(PubnubString));
1717
}
1818

1919
Pubnub::String UPubnubChatUtilities::FStringToPubnubString(FString UEString)

Source/PubnubChatSDK/Private/PubnubChatSDK.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
void FPubnubChatSDKModule::StartupModule()
1212
{
1313
bool IsEditor = false;
14+
bool LoadDLL = true;
1415
FString BaseDir;
1516
FString LibraryPath;
1617

@@ -31,15 +32,21 @@ void FPubnubChatSDKModule::StartupModule()
3132

3233
LibraryPath = IsEditor? FPaths::Combine(*BaseDir, TEXT("Source/ThirdParty/sdk/lib/macos/libpubnub-chat.dylib")) :
3334
FPaths::Combine(*BaseDir, TEXT("Binaries/macos/libpubnub-chat.dylib"));
35+
36+
#elif PLATFORM_LINUX
3437

38+
LoadDLL = false;
39+
3540
#endif
3641

3742
ChatSDKLibraryHandle = !LibraryPath.IsEmpty() ? FPlatformProcess::GetDllHandle(*LibraryPath) : nullptr;
38-
39-
if (!ChatSDKLibraryHandle)
43+
44+
45+
if (!ChatSDKLibraryHandle && LoadDLL)
4046
{
41-
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("ChatSDKModuleHandle", "Failed to load pubnub third party library"));
47+
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("ChatSDKModuleHandle", "Failed to load pubnub chat third party library"));
4248
}
49+
4350
}
4451

4552
void FPubnubChatSDKModule::ShutdownModule()

Source/ThirdParty/sdk/ChatSDKModule/ChatSDKModule.Build.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,19 @@ public ChatSDKModule(ReadOnlyTargetRules Target) : base(Target)
3131
PublicDelayLoadDLLs.Add(Path.Combine(SDKPath, "lib", "macos", "libpubnub-chat.dylib"));
3232
RuntimeDependencies.Add("$(BinaryOutputDir)/libpubnub-chat.dylib", "$(PluginDir)/Source/ThirdParty/sdk/lib/macos/libpubnub-chat.dylib");
3333
}
34+
else if(Target.Platform == UnrealTargetPlatform.Linux)
35+
{
36+
string LibPath = Path.Combine(SDKPath, "lib", "Linux", "libpubnub-chat.so");
3437

38+
PublicAdditionalLibraries.Add(LibPath);
39+
PublicDelayLoadDLLs.Add(LibPath);
40+
RuntimeDependencies.Add("$(BinaryOutputDir)/libpubnub-chat.so", LibPath);
41+
}
3542

3643
PublicIncludePaths.AddRange(
3744
new string[] {
3845
SDKPath,
39-
Path.Combine(SDKPath, "Include"),
46+
Path.Combine(SDKPath, "include"),
4047
}
4148
);
4249
PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public"));

Source/ThirdParty/sdk/include/pubnub_chat/enums.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define PN_ENUMS_HPP
33

44
#include "string.hpp"
5+
#include <cstdint>
56

67
namespace Pubnub
78
{

Source/ThirdParty/sdk/include/pubnub_chat/message_draft.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "string.hpp"
55
#include <map>
66
#include <vector>
7+
#include <functional>
78

89
#include "option.hpp"
910
#include "message_elements.hpp"
1.72 MB
Binary file not shown.
0 Bytes
Binary file not shown.
-2.81 MB
Binary file not shown.

0 commit comments

Comments
 (0)