Skip to content

Commit

Permalink
Merge pull request #11 from harryphone/main
Browse files Browse the repository at this point in the history
feat: v3.18.0
  • Loading branch information
harryphone authored Feb 20, 2023
2 parents d7edf03 + 60cc346 commit de38a91
Show file tree
Hide file tree
Showing 77 changed files with 981 additions and 360 deletions.
4 changes: 2 additions & 2 deletions AntiAddiction/AntiAddiction.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 31605001,
"VersionName": "3.17.0",
"Version": 31800001,
"VersionName": "3.18.0",
"FriendlyName": "AntiAddiction",
"Description": "",
"Category": "TapTap",
Expand Down
Binary file modified AntiAddiction/Content/AAUBackView.uasset
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

<buildGradleAdditions>
<insert>
dependencies.implementation(name: 'AntiAddiction_3.17.0',ext:'aar')
dependencies.implementation(name: 'AntiAddictionUI_3.17.0',ext:'aar')
dependencies.implementation(name: 'AntiAddiction_3.18.0',ext:'aar')
dependencies.implementation(name: 'AntiAddictionUI_3.18.0',ext:'aar')
</insert>
</buildGradleAdditions>
</root>
4 changes: 2 additions & 2 deletions AntiAddiction/Source/AntiAddiction/Public/AntiAddiction.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include "Modules/ModuleManager.h"

#define AntiAddictionUE_VERSION_NUMBER "31700001"
#define AntiAddictionUE_VERSION "3.17.0"
#define AntiAddictionUE_VERSION_NUMBER "31800001"
#define AntiAddictionUE_VERSION "3.18.0"

class FAntiAddictionModule : public IModuleInterface
{
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions LeanCloud/Source/LeanCloud/LeanCloud.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public LeanCloud(ReadOnlyTargetRules Target) : base(Target)
"SlateCore",
"Json",
"JsonUtilities",
"HTTP",
// ... add private dependencies that you statically link with here ...
}
);
Expand Down
4 changes: 2 additions & 2 deletions LeanCloud/Source/LeanCloud/LeanCloud_Android_UPL.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@

<buildGradleAdditions>
<insert>
dependencies.implementation('cn.leancloud:realtime-android:8.2.2')
dependencies.implementation('cn.leancloud:storage-android:8.2.7')
dependencies.implementation('cn.leancloud:realtime-android:8.2.17')
dependencies.implementation('cn.leancloud:storage-android:8.2.17')
dependencies.implementation('io.reactivex.rxjava2:rxandroid:2.1.1')
</insert>
</buildGradleAdditions>
Expand Down
55 changes: 55 additions & 0 deletions LeanCloud/Source/LeanCloud/Private/LCUser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ FString FLCUser::KeyAuthDataAnonymous = "anonymous";
FString FLCUser::KeySessionToken = "sessionToken";
FString FLCUser::CLASS_NAME = "_User";

FString GetSyncString()
{
const int64 Ticks = FDateTime::UtcNow().ToUnixTimestamp() * 1000;
const FString TimeStr = FString::Printf(TEXT("%010lld"), Ticks);
return FMD5::HashAnsiString(*(TimeStr + FLCConfig::Get().ClientToken)) + TEXT(",") + TimeStr;
}

FLCUser::FLCUser(TSharedPtr<FJsonObject> InServerData): FLCObject(CLASS_NAME, InServerData) {
}

Expand Down Expand Up @@ -51,6 +58,54 @@ bool FLCUser::IsAuthenticated() const {
return !GetSessionToken().IsEmpty();
}

void FLCUser::RetrieveShortToken(const FStringSignature& OnSuccess, const FLCError::FDelegate& OnFailed)
{
if (TSharedPtr<FLCError> Error = FLCConfig::Get().CheckConfig())
{
OnFailed.ExecuteIfBound(*Error);
return;
}
const TSharedRef<IHttpRequest, ESPMode::ThreadSafe> HttpRequest = FHttpModule::Get().CreateRequest();
HttpRequest->SetVerb(TEXT("GET"));

FString Url = FLCConfig::Get().ServerURL + TEXT("/storage/1.1/users/tap-support/identity");
HttpRequest->SetURL(Url);

HttpRequest->SetHeader(TEXT("X-LC-Id"), FLCConfig::Get().ClientID);
HttpRequest->SetHeader(TEXT("X-LC-Sign"), GetSyncString());
HttpRequest->SetHeader(TEXT("X-LC-Session"), GetSessionToken());
HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json"));

HttpRequest->OnProcessRequestComplete().BindSP(this, &FLCUser::OnRetrieveShortTokenCallback, OnSuccess, OnFailed);

if (!HttpRequest->ProcessRequest())
{
OnFailed.ExecuteIfBound(FLCError(-1, TEXT("Net Error. http send failed.")));
}
}

void FLCUser::OnRetrieveShortTokenCallback(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bConnectedSuccessfully, FStringSignature OnSuccess, FLCError::FDelegate OnError)
{
if (bConnectedSuccessfully && Response && EHttpResponseCodes::IsOk(Response->GetResponseCode()))
{
FString ContentString = Response->GetContentAsString();
TSharedPtr<FJsonObject> JsonObject;
const TSharedRef<TJsonReader<>> JsonReader = TJsonReaderFactory<>::Create(ContentString);
if (FJsonSerializer::Deserialize(JsonReader, JsonObject) && JsonObject.IsValid())
{
FString Token;
if (JsonObject->TryGetStringField(TEXT("identityToken"), Token))
{
OnSuccess.ExecuteIfBound(Token);
return;
}
}
OnError.ExecuteIfBound(FLCError(-1, FString::Printf(TEXT("Net Error, http response content:%s."), *ContentString)));
return;
}
OnError.ExecuteIfBound(FLCError(-1, TEXT("Net Error, Http failed.")));
}

TSharedPtr<FJsonObject> FLCUser::GetAuthData() const {
const TSharedPtr<FJsonObject> * TempPtr = nullptr;
ServerData->TryGetObjectField(KeyAuthData, TempPtr);
Expand Down
4 changes: 3 additions & 1 deletion LeanCloud/Source/LeanCloud/Private/LeanCloudImpl.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "LeanCloudImpl.h"

#include "Tools/LCDebuger.h"

#if PLATFORM_IOS
Expand All @@ -12,7 +13,8 @@ typedef FLeanCloud_iOS LeanCloud;
typedef FLeanCloud_Android LeanCloud;

#else
typedef FLeanCloudImpl LeanCloud;
#include "PC/LeanCloud_PC.h"
typedef FLeanCloud_PC LeanCloud;
#endif

#define UnsupportedPlatformsLog LCDebuger::ErrorLog(FString::Printf(TEXT("LeanCloud Unsupported Platforms Call %s"), ANSI_TO_TCHAR(__FUNCTION__)));
Expand Down
23 changes: 23 additions & 0 deletions LeanCloud/Source/LeanCloud/Private/LeanCloudType.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
#include "LeanCloudType.h"

FLCConfig FLCConfig::Instance;
FLCConfig& FLCConfig::Get()
{
return Instance;
}

TSharedPtr<FLCError> FLCConfig::CheckConfig() const
{
if (ClientID.IsEmpty())
{
return MakeShared<FLCError>(-1, TEXT("ClientID is empty."));
}
if (ClientToken.IsEmpty())
{
return MakeShared<FLCError>(-1, TEXT("ClientToken is empty."));
}
if (ServerURL.IsEmpty())
{
return MakeShared<FLCError>(-1, TEXT("ServerURL is empty."));
}
return nullptr;
}
15 changes: 15 additions & 0 deletions LeanCloud/Source/LeanCloud/Private/PC/LeanCloud_PC.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Fill out your copyright notice in the Description page of Project Settings.


#include "LeanCloud_PC.h"


FLeanCloud_PC::FLeanCloud_PC()
{
}

void FLeanCloud_PC::Init(const FLCConfig& InConfig)
{
FLCConfig::Get() = InConfig;
}

17 changes: 17 additions & 0 deletions LeanCloud/Source/LeanCloud/Private/PC/LeanCloud_PC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "LeanCloudImpl.h"

/**
*
*/
class LEANCLOUD_API FLeanCloud_PC : public FLeanCloudImpl
{
public:
FLeanCloud_PC();
virtual void Init(const FLCConfig& InConfig) override;

};
4 changes: 2 additions & 2 deletions LeanCloud/Source/LeanCloud/Public/LCObject.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

struct LEANCLOUD_API FLCObject {
struct LEANCLOUD_API FLCObject : public TSharedFromThis<FLCObject>{
public:

FLCObject(const FString& InClassName, TSharedPtr<FJsonObject> InServerData = nullptr);
~FLCObject();
virtual ~FLCObject();

static FLCObject CreateWithoutData(const FString& InClassName, const FString& ObjectId);

Expand Down
6 changes: 6 additions & 0 deletions LeanCloud/Source/LeanCloud/Public/LCUser.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#pragma once
#include "LCError.h"
#include "LCObject.h"
#include "Http.h"
#include "LeanCloudType.h"

struct LEANCLOUD_API FLCUser: public FLCObject {
public:
Expand All @@ -13,6 +16,7 @@ struct LEANCLOUD_API FLCUser: public FLCObject {
bool IsAnonymous() const;
bool IsMobilePhoneVerified() const;
bool IsAuthenticated() const;
virtual void RetrieveShortToken(const FStringSignature& OnSuccess, const FLCError::FDelegate& OnFailed);

protected:
static FString KeyUserName;
Expand All @@ -25,5 +29,7 @@ struct LEANCLOUD_API FLCUser: public FLCObject {
static FString KeySessionToken;
static FString CLASS_NAME;

void OnRetrieveShortTokenCallback(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bConnectedSuccessfully, FStringSignature OnSuccess, FLCError::FDelegate OnError);

TSharedPtr<FJsonObject> GetAuthData() const;
};
8 changes: 8 additions & 0 deletions LeanCloud/Source/LeanCloud/Public/LeanCloudType.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include "LCError.h"
#include "LeanCloudType.generated.h"


Expand All @@ -15,4 +16,11 @@ struct LEANCLOUD_API FLCConfig {
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString ServerURL;

static FLCConfig& Get();

TSharedPtr<FLCError> CheckConfig() const;
protected:
static FLCConfig Instance;
};

DECLARE_DELEGATE_OneParam(FStringSignature, const FString&);
Binary file modified LeanCloud/Source/ThirdParty/iOS/Frameworks/LeanCloudObjc.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions TapBillboard/Source/TapBillboard/Public/TapBillboardModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
struct FTUConfig;
typedef TSharedPtr<class FTapBillboardCommon, ESPMode::ThreadSafe> FTapBillboardPtr;

#define TapBillboard_VERSION_NUMBER "31700001"
#define TapBillboard_VERSION "3.17.0"
#define TapBillboard_VERSION_NUMBER "31800001"
#define TapBillboard_VERSION "3.18.0"

class TAPBILLBOARD_API FTapBillboardModule : public IModuleInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<buildGradleAdditions>
<insert>
dependencies.implementation(name: 'TapBillboard_3.17.0',ext:'aar')
dependencies.implementation(name: 'TapBillboard_3.18.0',ext:'aar')
</insert>
</buildGradleAdditions>

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions TapBillboard/TapBillboard.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 31602001,
"VersionName": "3.17.0",
"Version": 31800001,
"VersionName": "3.18.0",
"FriendlyName": "TapBillboard",
"Description": "TapTap Billboard",
"Category": "TapTap",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Set;

import cn.leancloud.LCUser;
import cn.leancloud.json.JSONObject;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

Expand All @@ -30,7 +31,7 @@ public static void init(Activity activity, String clientID, String clientToken,
Handler mainHandler = new Handler(Looper.getMainLooper());
mainHandler.post(new Runnable() {
@Override
public void run() {
public void run() {
TapDBConfig dbConfig = new TapDBConfig();
dbConfig.setEnable(dbEnable);
dbConfig.setChannel(channel);
Expand All @@ -42,24 +43,24 @@ public void run() {
.withClientToken(clientToken)
.withRegionType(isCN ? TapRegionType.CN : TapRegionType.IO)
.withTapDBConfig(dbConfig);

if(billboardEnable){
Set<Pair<String, String>> dimensionSet = new HashSet<>();
for (int i = 0; i < dimensionString.length; i += 2)
{
dimensionSet.add(Pair.create(dimensionString[i], dimensionString[i+1]));
}

TapBillboardConfig billboardConfig = new TapBillboardConfig.Builder()
.withDimensionSet(dimensionSet)
.withDimensionSet(dimensionSet)
.withServerUrl(billboardUrl)
.build();

builder.withBillboardConfig(billboardConfig);
}

TapConfig tapConfig = builder.build();

TapBootstrap.init(activity, tapConfig);
}
});
Expand Down Expand Up @@ -217,7 +218,7 @@ public void onComplete() {
public static void save(TDSUser user) {
user.saveInBackground();
}

public static void queryTapFriendsLeaderBoard(String name, int from, int limit, int callBackID) {
TDSLeaderBoardRanking.queryTapFriendsLeaderBoard(name, from, limit, new Callback<List<TDSLeaderBoardRanking>>() {
@Override
Expand All @@ -231,13 +232,42 @@ public void onFail(TapError error) {
}
});
}


public static void retrieveShortToken(String sessionToken, int callBackID) {
TDSUser.retrieveShortTokenInBackground(sessionToken).subscribe(new Observer<JSONObject>() {
@Override
public void onSubscribe(Disposable d) {

}

@Override
public void onNext(JSONObject jsonObject) {
String credential = jsonObject.getString("identityToken");
onRetrieveShortTokenSuccess(credential, callBackID);
}

@Override
public void onError(Throwable error) {
onRetrieveShortTokenError(-1, error.toString(), callBackID);
}

@Override
public void onComplete() {

}
});
}

public native void onUserError(int code, String Message, int callBackID);

public native void onUserSuccess(TDSUser user, int callBackID);

public native void onRankingsError(int code, String Message, int callBackID);

public native void onRankingsSuccess(List<TDSLeaderBoardRanking> result, int callBackID);

public native static void onRetrieveShortTokenError(int code, String Message, int callBackID);

public native static void onRetrieveShortTokenSuccess(String credential, int callBackID);

}
Loading

0 comments on commit de38a91

Please sign in to comment.