Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
HuaweiPlugin
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minhan Jeong
HuaweiPlugin
Commits
b9a8ea41
Commit
b9a8ea41
authored
Nov 18, 2021
by
Minhan Jeong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
화웨이 로그인 시스템 작업중
parent
82ed0894
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
222 additions
and
0 deletions
+222
-0
DefaultEngine.ini
Config/DefaultEngine.ini
+5
-0
Hud.uasset
Content/MobileStarterContent/Blueprints/Hud.uasset
+0
-0
Huawei.uproject
Huawei.uproject
+20
-0
HuaweiSDK_UPL.xml
Plugins/HuaweiSDK/Source/HuaweiSDK/HuaweiSDK_UPL.xml
+18
-0
AccountActivity.java
...weiSDK/Private/Android/Java/activity/AccountActivity.java
+69
-0
HuaweiAccount.cpp
Plugins/HuaweiSDK/Source/HuaweiSDK/Private/HuaweiAccount.cpp
+86
-0
HuaweiAccount.h
Plugins/HuaweiSDK/Source/HuaweiSDK/Public/HuaweiAccount.h
+24
-0
No files found.
Config/DefaultEngine.ini
View file @
b9a8ea41
...
@@ -145,4 +145,9 @@ KeyAlias=rmvw2021
...
@@ -145,4 +145,9 @@ KeyAlias=rmvw2021
KeyStorePassword
=
3df1q2w3e
KeyStorePassword
=
3df1q2w3e
KeyPassword
=
3df1q2w3e
KeyPassword
=
3df1q2w3e
ApplicationDisplayName
=
Real Madrid Virtual World
ApplicationDisplayName
=
Real Madrid Virtual World
bBuildForArmV7
=
False
bBuildForArm64
=
True
[/Script/GooglePADEditor.GooglePADRuntimeSettings]
bOnlyDistribution
=
False
Content/MobileStarterContent/Blueprints/Hud.uasset
View file @
b9a8ea41
No preview for this file type
Huawei.uproject
View file @
b9a8ea41
...
@@ -14,6 +14,25 @@
...
@@ -14,6 +14,25 @@
{
{
"Name": "MobileNativeCode",
"Name": "MobileNativeCode",
"Enabled": false
"Enabled": false
},
{
"Name": "OculusVR",
"Enabled": false,
"SupportedTargetPlatforms": [
"Win32",
"Win64",
"Android"
]
},
{
"Name": "SteamVR",
"Enabled": false,
"SupportedTargetPlatforms": [
"Win32",
"Win64",
"Linux",
"Mac"
]
}
}
]
]
}
}
\ No newline at end of file
Plugins/HuaweiSDK/Source/HuaweiSDK/HuaweiSDK_UPL.xml
View file @
b9a8ea41
...
@@ -93,9 +93,17 @@
...
@@ -93,9 +93,17 @@
dependencies
dependencies
{
{
ext.JUNIT_VERSION = '4.12'
ext.ESPRESSO_VERSION = '2.2.2'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.huawei.hms:iap:6.0.0.300'
implementation 'com.huawei.hms:iap:6.0.0.300'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation fileTree(include: ['*.jar',], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation "com.google.code.gson:gson:2.8.5"
implementation 'com.huawei.hms:hwid:5.2.0.300'
}
}
allprojects
allprojects
...
@@ -105,6 +113,16 @@
...
@@ -105,6 +113,16 @@
google()
google()
jcenter()
jcenter()
maven {url 'http://developer.huawei.com/repo/'}
maven {url 'http://developer.huawei.com/repo/'}
repositories
{
flatDir
{
</insert>
<insertValue
value=
"dirs '$S(AbsPluginDir)/../aars'"
/>
<insertNewline/>
<insert>
}
}
}
}
}
}
...
...
Plugins/HuaweiSDK/Source/HuaweiSDK/Private/Android/Java/activity/AccountActivity.java
0 → 100644
View file @
b9a8ea41
package
com
.
Plugins
.
HuaweiSDK
.
activity
;
import
android.app.Fragment
;
import
android.app.FragmentTransaction
;
import
com.huawei.hms.support.account.AccountAuthManager
;
import
com.huawei.hms.support.account.request.AccountAuthParams
;
import
com.huawei.hms.support.account.service.AccountAuthService
;
public
class
AccountActivity
extends
activity
{
private
String
TAG
=
"HuaweiAccountActivity"
;
private
AccountAuthService
mAuthManager
;
private
AccountAuthParams
mAuthParam
;
private
Activity
mActivity
;
public
AccountActivity
(
Activity
activity
)
{
mActivity
=
activity
;
}
private
void
signIn
()
{
mAuthParam
=
new
AccountAuthParamsHelper
(
AccountAuthParams
.
DEFAULT_AUTH_REQUEST_PARAM
)
.
setIdToken
()
.
setAccessToken
()
.
createParams
();
mAuthManager
=
AccountAuthManager
.
getService
(
mActivity
,
mAuthParam
);
startActivityForResult
(
mAuthManager
.
getSignInIntent
(),
Constant
.
REQUEST_SIGN_IN_LOGIN
);
}
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
// if (requestCode == Constant.REQUEST_SIGN_IN_LOGIN) {
if
(
requestCode
==
1002
)
{
//login success
//get user message by parseAuthResultFromIntent
Task
<
AuthAccount
>
authAccountTask
=
AccountAuthManager
.
parseAuthResultFromIntent
(
data
);
if
(
authAccountTask
.
isSuccessful
())
{
AuthAccount
authAccount
=
authAccountTask
.
getResult
();
Log
.
i
(
TAG
,
authAccount
.
getDisplayName
()
+
" signIn success "
);
Log
.
i
(
TAG
,
"AccessToken: "
+
authAccount
.
getAccessToken
());
nativeSignInResult
(
true
,
authAccount
.
getAccessToken
());
}
else
{
Log
.
i
(
TAG
,
"signIn failed: "
+
((
ApiException
)
authAccountTask
.
getException
()).
getStatusCode
());
nativeSignInResult
(
false
,
0
);
}
}
if
(
requestCode
==
Constant
.
REQUEST_SIGN_IN_LOGIN_CODE
)
{
//login success
Task
<
AuthAccount
>
authAccountTask
=
AccountAuthManager
.
parseAuthResultFromIntent
(
data
);
if
(
authAccountTask
.
isSuccessful
())
{
AuthAccount
authAccount
=
authAccountTask
.
getResult
();
Log
.
i
(
TAG
,
"signIn get code success."
);
Log
.
i
(
TAG
,
"ServerAuthCode: "
+
authAccount
.
getAuthorizationCode
());
/**** english doc:For security reasons, the operation of changing the code to an AT must be performed on your server. The code is only an example and cannot be run. ****/
/**********************************************************************************************/
}
else
{
Log
.
i
(
TAG
,
"signIn get code failed: "
+
((
ApiException
)
authAccountTask
.
getException
()).
getStatusCode
());
}
}
}
public
native
void
nativeSignInResult
(
boolean
success
,
String
accessToken
);
}
\ No newline at end of file
Plugins/HuaweiSDK/Source/HuaweiSDK/Private/HuaweiAccount.cpp
0 → 100644
View file @
b9a8ea41
#include "HuaweiAccount.h"
using
namespace
std
;
#if PLATFORM_ANDROID
#include "Android/Utils/AndroidUtils.h"
#include "Android/AndroidJNI.h"
#endif
#include <set>
#pragma region SignIn
static
std
::
set
<
UHuaweiAccount
*>
s_huaweiAccounts
;
UHuaweiAccount
::
UHuaweiAccount
(){}
UHuaweiAccount
::~
UHuaweiAccount
()
{
std
::
set
<
UHuaweiAccount
*>::
iterator
it
=
s_huaweiAccounts
.
find
(
this
);
if
(
it
!=
s_huaweiAccounts
.
end
())
{
s_huaweiAccounts
.
erase
(
it
);
}
}
UHuaweiAccount
*
UHuaweiAccount
::
SignIn
()
{
UHuaweiAccount
*
BPNode
=
NewObject
<
UHuaweiAccount
>
();
s_huaweiAccounts
.
insert
(
BPNode
);
return
BPNode
;
}
#if PLATFORM_ANDROID
static
void
ReqSignIn
()
{
if
(
JNIEnv
*
Env
=
FAndroidApplication
::
GetJavaEnv
())
{
static
jmethodID
SignInMethod
=
FJavaWrapper
::
FindMethod
(
Env
,
FJavaWrapper
::
GameActivityClassID
,
"AndroidThunkJava_SignIn"
,
"()V"
,
false
);
if
(
SignInMethod
)
{
FJavaWrapper
::
CallVoidMethod
(
Env
,
FJavaWrapper
::
GameActivityThis
,
SignInMethod
);
}
}
}
__attribute__
((
visibility
(
"default"
)))
extern
"C"
void
Java_com_Plugins_HuaweiSDK_activity_AccountActivity_nativeSignInResult
(
JNIEnv
*
jenv
,
jobject
thiz
,
jboolean
success
,
jstring
accessToekn
)
{
UE_LOG
(
LogTemp
,
Log
,
TEXT
(
"nativeSignInResult"
));
const
char
*
charsAccessToken
=
jenv
->
GetStringUTFChars
(
accessToekn
,
0
);
FString
strAccessToken
=
FString
(
UTF8_TO_TCHAR
(
charsAccessToken
));
DECLARE_CYCLE_STAT
(
TEXT
(
"FSimpleDelegateGraphTask.Java_com_Plugins_HuaweiSDK_activity_AccountActivity_nativeSignInResult"
),
STAT_FSimpleDelegateGraphTask_Java_com_Plugins_HuaweiSDK_activity_AccountActivity_nativeSignInResult
,
STATGROUP_TaskGraphTasks
);
FSimpleDelegateGraphTask
::
CreateAndDispatchWhenReady
(
FSimpleDelegateGraphTask
::
FDelegate
::
CreateLambda
([
=
]()
{
if
(
strAccessToken
.
Len
()
>
0
)
{
for
(
std
::
set
<
UHuaweiAccount
*>::
iterator
it
=
s_huaweiAccounts
.
begin
();
it
!=
s_huaweiAccounts
.
end
();
it
++
)
{
(
*
it
)
->
OnComplete
.
Broadcast
(
true
,
strAccessToken
);
}
}
else
{
for
(
std
::
set
<
UHuaweiAccount
*>::
iterator
it
=
s_huaweiAccounts
.
begin
();
it
!=
s_huaweiAccounts
.
end
();
it
++
)
{
(
*
it
)
->
OnComplete
.
Broadcast
(
false
,
""
);
}
}
s_huaweiAccounts
.
clear
();
}),
GET_STATID
(
STAT_FSimpleDelegateGraphTask_Java_com_Plugins_HuaweiSDK_activity_AccountActivity_nativeSignInResult
),
nullptr
,
ENamedThreads
::
GameThread
);
}
#endif
void
UHuaweiAccount
::
Activate
()
{
#if PLATFORM_ANDROID
ReqSignIn
();
#endif
}
Plugins/HuaweiSDK/Source/HuaweiSDK/Public/HuaweiAccount.h
0 → 100644
View file @
b9a8ea41
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintAsyncActionBase.h"
#include "HuaweiAccount.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams
(
FSignInResult
,
bool
,
IsSuccess
,
FString
,
AccessToken
);
UCLASS
(
Category
=
"Huawei Account"
,
meta
=
(
DisplayName
=
"Huawei Account"
))
class
HUAWEISDK_API
UHuaweiAccount
:
public
UBlueprintAsyncActionBase
{
GENERATED_BODY
()
public
:
UHuaweiAccount
();
~
UHuaweiAccount
();
UFUNCTION
(
BlueprintCallable
,
meta
=
(
BlueprintINternalUseOnly
=
"true"
),
Category
=
"HuaweiAccount"
)
static
UHuaweiAccount
*
SignIn
();
virtual
void
Activate
()
override
;
UPROPERTY
(
BlueprintAssignable
)
FSignInResult
OnComplete
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment