diff --git a/services/BUILD.gn b/services/BUILD.gn index 07779129a2170215e2dfcab2964d1d5f45368897..466f2ffcc98c4b9ce093983c4bbe0280f00f4dc6 100755 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -47,7 +47,11 @@ ohos_shared_library("faceauth_service") { "//base/user_iam/face_auth/services/faceauth/src/face_auth_thread_pool.cpp", "//base/user_iam/face_auth/services/faceauth/src/face_auth_req.cpp", "//base/user_iam/face_auth/services/common/src/constant.cpp", - "//base/user_iam/face_auth/services/temp/src/face_auth_ca.cpp" + "//base/user_iam/face_auth/services/temp/src/face_auth_ca.cpp", + "//base/user_iam/face_auth/services/temp/src/adaptor_algorithm.cpp", + "//base/user_iam/face_auth/services/temp/src/adaptor_memory.cpp", + "//base/user_iam/face_auth/services/temp/src/buffer.cpp", + "//base/user_iam/face_auth/services/temp/src/face_auth_func.cpp" ] deps = [ diff --git a/services/faceauth/include/face_auth_manager.h b/services/faceauth/include/face_auth_manager.h index 0bf10d44f192ed59bb05d1d546299c0198d917ef..56d2384ebbe1834f7909d9cfb7602741104c2c94 100644 --- a/services/faceauth/include/face_auth_manager.h +++ b/services/faceauth/include/face_auth_manager.h @@ -53,7 +53,6 @@ private: static sptr executorMessenger_; static std::shared_ptr handler_; static std::shared_ptr runner_; - static volatile bool isStop_; static std::shared_ptr queryCallback_; static std::shared_ptr executorCallback_; std::map bundleNameList_; @@ -74,8 +73,10 @@ private: int32_t srcType, int32_t resultCode, pAuthAttributes finalResult); - static void* OperForAlgorithm(void* arg); - static void HandleAlgoResult(uint64_t scheduleID); + FIRetCode OperForAlgorithm(uint64_t scheduleID); + void HandleAlgoResult(uint64_t scheduleID); + int32_t OpenCamera(); + int32_t GetAuthMessage(uint64_t scheduleID); }; } // namespace FaceAuth } // namespace UserIAM diff --git a/services/faceauth/src/face_auth_executor_callback.cpp b/services/faceauth/src/face_auth_executor_callback.cpp index fe3dff403981f525f1a06ec7dfe877ec4d3b0b8f..8475c5fcbc9f8a07b898eac190b4715d1cbd5538 100644 --- a/services/faceauth/src/face_auth_executor_callback.cpp +++ b/services/faceauth/src/face_auth_executor_callback.cpp @@ -42,6 +42,7 @@ int32_t ExecutorCallback::OnBeginExecute(uint64_t scheduleId, std::vectorEnrollment(data); @@ -49,6 +50,7 @@ int32_t ExecutorCallback::OnBeginExecute(uint64_t scheduleId, std::vectorAuthenticate(data); @@ -56,18 +58,20 @@ int32_t ExecutorCallback::OnBeginExecute(uint64_t scheduleId, std::vectorCancelEnrollment(data); break; } case FACE_COMMAND_CANCEL_AUTH: { AuthParam data; + memset(&data,0,sizeof(AuthParam)); data.scheduleID = scheduleId; manager->CancelAuth(data); break; } default: - FACEAUTH_HILOGI(MODULE_SERVICE, "other command."); + FACEAUTH_HILOGI(MODULE_SERVICE, "other command.command = %u",command); break; } return FA_RET_OK; @@ -86,11 +90,13 @@ void ExecutorCallback::OnMessengerReady(const sptrSetExecutorMessenger(messenger); } + else { + FACEAUTH_HILOGI(MODULE_SERVICE, "manager instance is null."); + } } int32_t ExecutorCallback::OnSetProperty(pAuthAttributes properties) { - (void)(properties); FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); std::shared_ptr manager = FaceAuthManager::GetInstance(); if (manager == nullptr) { @@ -115,6 +121,7 @@ int32_t ExecutorCallback::OnSetProperty(pAuthAttributes properties) switch(command) { case FACE_COMMAND_REMOVE: { RemoveParam data; + memset(&data,0,sizeof(RemoveParam)); data.scheduleID = scheduleID; data.templateID = templateID; manager->Remove(data); @@ -127,7 +134,7 @@ int32_t ExecutorCallback::OnSetProperty(pAuthAttributes properties) manager->ReleaseAlgorithm(bundleName); break; default: - FACEAUTH_HILOGI(MODULE_SERVICE, "other command."); + FACEAUTH_HILOGI(MODULE_SERVICE, "other command.command = %u",command); break; } return FA_RET_OK; @@ -135,10 +142,9 @@ int32_t ExecutorCallback::OnSetProperty(pAuthAttributes properties) int32_t ExecutorCallback::OnGetProperty(std::shared_ptr conditions, std::shared_ptr values) { - (void)(conditions); - (void)(values); std::shared_ptr faceAuthCA = FaceAuthCA::GetInstance(); if (faceAuthCA == nullptr) { + FACEAUTH_HILOGE(MODULE_SERVICE, "faceAuthCA is nullptr."); return FA_RET_ERROR; } uint64_t templateID = 0; diff --git a/services/faceauth/src/face_auth_manager.cpp b/services/faceauth/src/face_auth_manager.cpp index be3f1c0a0f5c7d4db1a1c87424ff8c0c488ce39f..cdf9fd46439c10123b72a43fdd608e447f3cd4a8 100755 --- a/services/faceauth/src/face_auth_manager.cpp +++ b/services/faceauth/src/face_auth_manager.cpp @@ -31,7 +31,6 @@ std::shared_ptr FaceAuthManager::handler_ = nullptr; std::shared_ptr FaceAuthManager::runner_ = nullptr; std::shared_ptr FaceAuthManager::queryCallback_ = nullptr; std::shared_ptr FaceAuthManager::executorCallback_ = nullptr; -volatile bool FaceAuthManager::isStop_ = false; std::shared_ptr FaceAuthManager::GetInstance() { @@ -63,6 +62,7 @@ int32_t FaceAuthManager::Init() // start CA std::shared_ptr faceAuthCA = FaceAuthCA::GetInstance(); if (faceAuthCA == nullptr) { + FACEAUTH_HILOGE(MODULE_SERVICE, "create FaceAuthCA instance failed."); return FA_RET_ERROR; } if(FA_RET_OK != faceAuthCA->Init()) { @@ -194,18 +194,7 @@ void FaceAuthManager::HandleCallAuthenticate(const AuthParam ¶m) return; } // open camera and send image to algorithm - std::promise promiseobj; - std::future futureobj = promiseobj.get_future(); - FaceAuthThreadPool::GetInstance()->AddTask([&promiseobj]() { - promiseobj.set_value(FaceAuthCamera::GetInstance()->OpenCamera(nullptr)); - }); - std::chrono::microseconds span(OPEN_CAMERA_TIME_OUT); - while (futureobj.wait_for(span) == std::future_status::timeout) { - FACEAUTH_HILOGI(MODULE_SERVICE,"Open Camera TimeOut"); - return; - } - if (futureobj.get() == FA_RET_ERROR) { - FACEAUTH_HILOGE(MODULE_SERVICE,"Open Camera Fail"); + if(OpenCamera() != FA_RET_OK) { return; } // start algorithm operation @@ -224,12 +213,15 @@ void FaceAuthManager::HandleCallAuthenticate(const AuthParam ¶m) return; } // receive algorithm message and handle algorithm result - pthread_t threadID; - int ret = pthread_create(&threadID, nullptr, OperForAlgorithm, (void*)(&(param.scheduleID))); - if (ret != FA_RET_OK) { - FACEAUTH_HILOGE(MODULE_SERVICE, "create thread failed."); + if(GetAuthMessage(param.scheduleID) != FA_RET_OK) { + return; + } + // close camera + std::shared_ptr faceAuthCamera = FaceAuthCamera::GetInstance(); + if (faceAuthCamera == nullptr) { return; } + faceAuthCamera->CloseCamera(); } int32_t FaceAuthManager::Enrollment(const EnrollParam ¶m) { @@ -276,18 +268,7 @@ void FaceAuthManager::HandleCallEnroll(const EnrollParam ¶m) return; } // open camera and send image to algorithm - std::promise promiseobj; - std::future futureobj = promiseobj.get_future(); - FaceAuthThreadPool::GetInstance()->AddTask([&promiseobj]() { - promiseobj.set_value(FaceAuthCamera::GetInstance()->OpenCamera(nullptr)); - }); - std::chrono::microseconds span(OPEN_CAMERA_TIME_OUT); - while (futureobj.wait_for(span) == std::future_status::timeout) { - FACEAUTH_HILOGI(MODULE_SERVICE,"Open Camera TimeOut"); - return; - } - if (futureobj.get() == FA_RET_ERROR) { - FACEAUTH_HILOGE(MODULE_SERVICE,"Open Camera Fail"); + if(OpenCamera() != FA_RET_OK) { return; } // start algorithm operation @@ -306,12 +287,15 @@ void FaceAuthManager::HandleCallEnroll(const EnrollParam ¶m) return; } // receive algorithm message and handle algorithm result - pthread_t threadID; - int ret = pthread_create(&threadID, nullptr, OperForAlgorithm, (void*)(&(param.scheduleID))); - if (ret != FA_RET_OK) { - FACEAUTH_HILOGE(MODULE_SERVICE, "create thread failed."); + if(GetAuthMessage(param.scheduleID) != FA_RET_OK) { + return; + } + // close camera + std::shared_ptr faceAuthCamera = FaceAuthCamera::GetInstance(); + if (faceAuthCamera == nullptr) { return; } + faceAuthCamera->CloseCamera(); } int32_t FaceAuthManager::Remove(const RemoveParam ¶m) { @@ -369,26 +353,26 @@ void FaceAuthManager::HandleCallRemove(const RemoveParam ¶m) FACEAUTH_HILOGE(MODULE_SERVICE, "Remove failed."); } } -void* FaceAuthManager::OperForAlgorithm(void* arg) +FIRetCode FaceAuthManager::OperForAlgorithm(uint64_t scheduleID) { - uint64_t scheduleID = *(static_cast(arg)); std::shared_ptr faceAuthCA = FaceAuthCA::GetInstance(); if (faceAuthCA == nullptr) { - return nullptr; + FACEAUTH_HILOGI(MODULE_SERVICE, "faceAuthCA is null."); + return FI_RC_INVALID_ARGUMENT; } int32_t retCode = 0; std::vector retCoauthMsg; std::shared_ptr manager = FaceAuthManager::GetInstance(); if (manager == nullptr) { FACEAUTH_HILOGE(MODULE_SERVICE, "init manager failed."); - return nullptr; + return FI_RC_INVALID_ARGUMENT; } std::vector m_msg; std::shared_ptr msgInstance = std::make_shared(m_msg); if (msgInstance == nullptr) { - return nullptr; + return FI_RC_INVALID_ARGUMENT; } - while (!isStop_) { + while (1) { faceAuthCA->GetAlgorithmState(retCode, retCoauthMsg); FACEAUTH_HILOGI(MODULE_SERVICE, "receive new co auth message."); std::shared_ptr msg(msgInstance->FromUint8Array(retCoauthMsg)); @@ -396,44 +380,32 @@ void* FaceAuthManager::OperForAlgorithm(void* arg) manager->SendData(scheduleID, 0, TYPE_ALL_IN_ONE, TYPE_CO_AUTH, msg); } if (FACE_ALOGRITHM_OPERATION_BREAK == retCode) { - isStop_ = true; FACEAUTH_HILOGI(MODULE_SERVICE, "FACE_ALOGRITHM_OPERATION_BREAK."); + break; } } HandleAlgoResult(scheduleID); - // close camera - std::shared_ptr faceAuthCamera = FaceAuthCamera::GetInstance(); - if (faceAuthCamera == nullptr) { - return nullptr; - } - faceAuthCamera->CloseCamera(); - return nullptr; + return FI_RC_OK; } void FaceAuthManager::HandleAlgoResult(uint64_t scheduleID) { std::shared_ptr faceAuthCA = FaceAuthCA::GetInstance(); if (faceAuthCA == nullptr) { + FACEAUTH_HILOGI(MODULE_SERVICE, "faceAuthCA is null."); return; } AlgorithmResult retResult; faceAuthCA->FinishAlgorithmOperation(retResult); FACEAUTH_HILOGI(MODULE_SERVICE, "Face auth result = %{public}d.", retResult.result); // return result + pAuthAttributes authAttributes = std::make_shared(); + authAttributes->SetUint32Value(AUTH_RESULT_CODE, 0); + authAttributes->SetUint8ArrayValue(AUTH_RESULT,retResult.coauthMsg); std::shared_ptr manager = FaceAuthManager::GetInstance(); if (manager == nullptr) { FACEAUTH_HILOGE(MODULE_SERVICE, "init manager failed."); return; } - std::vector m_msg; - std::shared_ptr msgInstance = std::make_shared(m_msg); - if (msgInstance !=nullptr) { - std::shared_ptr msg(msgInstance->FromUint8Array(retResult.coauthMsg)); - if (msg != nullptr) { - manager->SendData(scheduleID, 0, TYPE_ALL_IN_ONE, TYPE_CO_AUTH, msg); - } - } - pAuthAttributes authAttributes = std::make_shared(); - authAttributes->SetUint32Value(AUTH_RESULT_CODE, 0); manager->Finish(scheduleID, TYPE_ALL_IN_ONE, retResult.result, authAttributes); } int32_t FaceAuthManager::CancelAuth(const AuthParam ¶m) @@ -615,6 +587,43 @@ uint32_t FaceAuthManager::GenerateEventId() FACEAUTH_HILOGI(MODULE_SERVICE,"GenerateEventId generate eventId %{public}u", eventId); return eventId; } +int32_t FaceAuthManager::OpenCamera() +{ + std::promise promiseobj; + std::future futureobj = promiseobj.get_future(); + FaceAuthThreadPool::GetInstance()->AddTask([&promiseobj]() { + promiseobj.set_value(FaceAuthCamera::GetInstance()->OpenCamera(nullptr)); + }); + std::chrono::microseconds span(OPEN_CAMERA_TIME_OUT); + while (futureobj.wait_for(span) == std::future_status::timeout) { + FACEAUTH_HILOGI(MODULE_SERVICE,"Open Camera TimeOut"); + return FA_RET_ERROR; + } + if (futureobj.get() == FA_RET_ERROR) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Open Camera Fail"); + return FA_RET_ERROR; + } + return FA_RET_OK; +} +int32_t FaceAuthManager::GetAuthMessage(uint64_t scheduleID) +{ + std::promise promiseobj; + std::future futureobj = promiseobj.get_future(); + FACEAUTH_HILOGI(MODULE_SERVICE,"FaceAuthCurTaskNum is %{public}d ", FaceAuthThreadPool::GetInstance()->GetCurTaskNum()); + FaceAuthThreadPool::GetInstance()->AddTask([&promiseobj, this, &scheduleID]() { + promiseobj.set_value(OperForAlgorithm(scheduleID)); + }); + std::chrono::microseconds span(GET_RESULT_TIME_OUT); + while (futureobj.wait_for(span) == std::future_status::timeout) { + FACEAUTH_HILOGI(MODULE_SERVICE,"GetAuthResult TimeOut"); + return FA_RET_ERROR; + } + if (futureobj.get() != FI_RC_OK) { + FACEAUTH_HILOGI(MODULE_SERVICE,"GetAuthResult Fail"); + return FA_RET_ERROR; + } + return FA_RET_OK; +} } // namespace FaceAuth } // namespace UserIAM } // namespace OHOS diff --git a/services/temp/include/adaptor_algorithm.h b/services/temp/include/adaptor_algorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..fc59e6db6870dc59f0a8414adb312262b28e7681 --- /dev/null +++ b/services/temp/include/adaptor_algorithm.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ADAPTOR_ALGORITHM_H +#define ADAPTOR_ALGORITHM_H + +#include +#include +#include "buffer.h" +namespace OHOS { +namespace UserIAM { +namespace FaceAuth { +#define ED25519_FIX_SIGN_BUFFER_SIZE 64 + +typedef struct { + Buffer *pubKey; + Buffer *priKey; +} KeyPair; + +bool IsEd25519KeyPairValid(const KeyPair *keyPair); +void DestoryKeyPair(KeyPair *keyPair); +KeyPair *GenerateEd25519KeyPair(void); +int32_t Ed25519Sign(const KeyPair *keyPair, const Buffer *data, Buffer **sign); +int32_t Ed25519Verify(const Buffer *pubKey, const Buffer *data, const Buffer *sign); + +int32_t HmacSha256(const Buffer *hmacKey, const Buffer *data, Buffer **hmac); +int32_t HmacSha512(const Buffer *hmacKey, const Buffer *data, Buffer **hmac); + +int32_t SecureRandom(uint8_t *buffer, uint32_t size); +} +} +} +#endif + diff --git a/services/temp/include/adaptor_memory.h b/services/temp/include/adaptor_memory.h new file mode 100644 index 0000000000000000000000000000000000000000..bd481d09b00f79a10844f29aae8ffb9c61a3210e --- /dev/null +++ b/services/temp/include/adaptor_memory.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ADAPTOR_MEMORY_H +#define ADAPTOR_MEMORY_H + +#include +namespace OHOS { +namespace UserIAM { +namespace FaceAuth { +void *Malloc(const size_t size); + +void Free(void *ptr); +} +} +} +#endif diff --git a/services/temp/include/buffer.h b/services/temp/include/buffer.h new file mode 100644 index 0000000000000000000000000000000000000000..038417b84946cdcb2b66ab68e6cd03f0298c4ed9 --- /dev/null +++ b/services/temp/include/buffer.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef COMMON_BUFFER_H +#define COMMON_BUFFER_H + +#include "stdbool.h" +#include "stddef.h" +#include "stdint.h" +#include "defines.h" +namespace OHOS { +namespace UserIAM { +namespace FaceAuth { +typedef struct { + uint8_t *buf; + uint32_t contentSize; + uint32_t maxSize; +} Buffer; + +bool IsBufferValid(const Buffer *buffer); +Buffer *CreateBuffer(const uint32_t size); +ResultCode InitBuffer(Buffer *buffer, const uint8_t *buf, const uint32_t bufSize); +void DestoryBuffer(Buffer *buffer); +Buffer *CopyBuffer(const Buffer *buffer); +bool CompareBuffer(const Buffer *buffer1, const Buffer *buffer2); +Buffer *CreateBufferByData(const uint8_t *data, const uint32_t dataSize); +ResultCode GetBufferData(const Buffer *buffer, uint8_t *data, uint32_t *dataSize); +bool CheckBufferWithSize(const Buffer *buffer, const uint32_t size); +} +} +} +#endif diff --git a/services/temp/include/defines.h b/services/temp/include/defines.h new file mode 100644 index 0000000000000000000000000000000000000000..fde7559f3dceb742f9fbae4c0a54692d89d0f65d --- /dev/null +++ b/services/temp/include/defines.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef COMMON_DEFINES_H +#define COMMON_DEFINES_H +namespace OHOS { +namespace UserIAM { +namespace FaceAuth { +typedef enum ResultCode { + RESULT_SUCCESS = 0x0, + RESULT_GENERAL_ERROR = 0x1, + RESULT_BAD_PARAM = 0x2, + RESULT_BAD_COPY = 0x3, + RESULT_NO_MEMORY = 0x4, + RESULT_NEED_INIT = 0x5, + RESULT_NOT_FOUND = 0x6, + RESULT_REACH_LIMIT = 0x7, + RESULT_DUPLICATE_CHECK_FAILED = 0x8, + RESULT_BAD_READ = 0x9, + RESULT_BAD_WRITE = 0xA, + RESULT_BAD_DEL = 0xB, + RESULT_UNKNOWN = 0xC, + RESULT_BAD_MATCH = 0xD, + RESULT_BAD_SIGN = 0xE, + RESULT_BUSY = 0xF, + RESULT_PIN_FREEZE = 0x11, + RESULT_PIN_FAIL = 0X12, +} ResultCode; + +typedef enum AuthType { + DEFAULT_AUTH_TYPE = 0, + PIN_AUTH = 1, + FACE_AUTH = 2, +} AuthType; + +typedef enum AuthSubType { + DEFAULT_TYPE = 0, +} AuthSubType; + +#define MAX_DULPLICATE_CHECK 100 +} +} +} +#endif diff --git a/services/temp/include/face_auth_ca.h b/services/temp/include/face_auth_ca.h index 8caf60a55e3088b40a043233a6a830afc701d8ac..b03ee7fb33560e325cdd2647c86385b6d24f26cd 100644 --- a/services/temp/include/face_auth_ca.h +++ b/services/temp/include/face_auth_ca.h @@ -72,9 +72,11 @@ public: int32_t GetRemainTimes(uint64_t templateId, int32_t &remainingTimes); int32_t ResetRemainTimes(uint64_t templateId); int32_t CancelAlogrithmOperation(); + void SetAlgorithmParam(const AlgorithmParam ¶m); private: static std::shared_ptr faceAuthCA_; static std::mutex mutex_; + AlgorithmParam param_; }; } } diff --git a/services/temp/include/face_auth_func.h b/services/temp/include/face_auth_func.h new file mode 100644 index 0000000000000000000000000000000000000000..16550c4678db03068d3cd50e86e3f17531bbb9d9 --- /dev/null +++ b/services/temp/include/face_auth_func.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FACE_AUTHTA_FUNC_H +#define FACE_AUTHTA_FUNC_H + +#include "defines.h" +#include "buffer.h" +#include +namespace OHOS { +namespace UserIAM { +namespace FaceAuth { +#define TAG_AND_LEN_BYTE 8 +#define TAG_ANG_LEN_T 12 +#define TAG_AND_LEN_S 16 +#define MAX_TLV_LEN 200 +#define SIGN_DATA_LEN 64 +#define PIN_RET_TYPE_LEN 8 +#define PIN_RET_DATA_LEN 72 +#define PIN_CAPABILITY_LEVEL 3 +#define FACE_AUTH_CAPABILITY_LEVEL 3 +#define ED25519_FIX_PUBKEY_BUFFER_SIZE 32 +#define ED25519_FIX_PRIKEY_BUFFER_SIZE 64 +#define PIN_EXECUTOR_SECURITY_LEVEL 2 +#define FACE_EXECUTOR_SECURITY_LEVEL 2 +#define PIN_AUTH_AIBNILITY 7 +#define FACE_AUTH_AIBNILITY 7 +#define RESULT_TLV_LEN 160U +#define CONST_PUB_KEY_LEN 32U + +typedef enum { + /** + * Root tag + */ + AUTH_ROOT = 1000000, + + /** + * Result code + */ + AUTH_RESULT_CODE = 1000001, + + /** + * Tag of signature data in TLV + */ + AUTH_SIGNATURE = 1000002, + + /** + * Tag of templateId data in TLV + */ + AUTH_TEMPLATE_ID = 1000004, + + /** + * Session id, required when decode in C + */ + AUTH_SESSION_ID = 1000008, + + /** + * Tag of executor's data + */ + AUTH_EXECUTOR_DATA = 1000013, + + /** + * Tag of auth subType + */ + AUTH_SUBTYPE = 1000014, + + /** + * Tag of capability level + */ + AUTH_CAPABILITY_LEVEL = 1000015 +} AuthAttributeType; + +ResultCode GenerateRetTlv(uint32_t result, uint64_t scheduleId, uint64_t subType, uint64_t templatedId, Buffer *retTlv); +ResultCode GenerateKeyPair(); +ResultCode SetResultTlv(Buffer *retTlv, std::vector &resultTlv); +ResultCode DoGetExecutorInfo(std::vector &vPubKey, uint32_t &esl, uint64_t &authAbility); +} +} +} +#endif // FACE_AUTHTA_FUNC_H diff --git a/services/temp/src/adaptor_algorithm.cpp b/services/temp/src/adaptor_algorithm.cpp new file mode 100644 index 0000000000000000000000000000000000000000..349c46c04c804eea49ab9be54db1b284460216f2 --- /dev/null +++ b/services/temp/src/adaptor_algorithm.cpp @@ -0,0 +1,302 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "adaptor_algorithm.h" +#include +#include +#include +#include "adaptor_memory.h" +#include "buffer.h" +#include "defines.h" +#include "face_auth_log_wrapper.h" +namespace OHOS { +namespace UserIAM { +namespace FaceAuth { +#define OPENSSL_SUCCESS 1 + +#define ED25519_FIX_PRIKEY_BUFFER_SIZE 32 +#define ED25519_FIX_PUBKEY_BUFFER_SIZE 32 +#define ED25519_FIX_SIGN_BUFFER_SIZE 64 + +#define SHA256_DIGEST_SIZE 32 +#define SHA512_DIGEST_SIZE 64 + +static KeyPair *CreateEd25519KeyPair(void) +{ + KeyPair *keyPair = (KeyPair*)Malloc(sizeof(KeyPair)); + if (keyPair == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"no memory for key pair"); + return NULL; + } + keyPair->pubKey = CreateBuffer(ED25519_FIX_PUBKEY_BUFFER_SIZE); + if (keyPair->pubKey == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"no memory for pub key"); + Free(keyPair); + return NULL; + } + keyPair->priKey = CreateBuffer(ED25519_FIX_PRIKEY_BUFFER_SIZE); + if (keyPair->priKey == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"no memory for pri key"); + DestoryBuffer(keyPair->pubKey); + Free(keyPair); + return NULL; + } + return keyPair; +} + +void DestoryKeyPair(KeyPair *keyPair) +{ + if (keyPair == NULL) { + return; + } + if (keyPair->pubKey != NULL) { + DestoryBuffer(keyPair->pubKey); + } + if (keyPair->priKey != NULL) { + DestoryBuffer(keyPair->priKey); + } + Free(keyPair); +} + +bool IsEd25519KeyPairValid(const KeyPair *keyPair) +{ + if (keyPair == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"invalid key pair"); + return false; + } + if (!CheckBufferWithSize(keyPair->pubKey, ED25519_FIX_PUBKEY_BUFFER_SIZE)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"invalid pub key"); + return false; + } + if (!CheckBufferWithSize(keyPair->priKey, ED25519_FIX_PRIKEY_BUFFER_SIZE)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"invalid pri key"); + return false; + } + return true; +} + +KeyPair *GenerateEd25519KeyPair() +{ + KeyPair *keyPair = CreateEd25519KeyPair(); + if (keyPair == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"create key pair fail"); + return NULL; + } + EVP_PKEY *key = NULL; + EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_ED25519, NULL); + if (ctx == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"new ctx fail"); + DestoryKeyPair(keyPair); + keyPair = NULL; + return keyPair; + } + if (EVP_PKEY_keygen_init(ctx) != OPENSSL_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"init ctx fail"); + DestoryKeyPair(keyPair); + keyPair = NULL; + return keyPair; + } + if (EVP_PKEY_keygen(ctx, &key) != OPENSSL_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"generate key fail"); + DestoryKeyPair(keyPair); + keyPair = NULL; + return keyPair; + } + size_t pubKeySize = keyPair->pubKey->maxSize; + if (EVP_PKEY_get_raw_public_key(key, keyPair->pubKey->buf, &pubKeySize) != OPENSSL_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"get pub key fail"); + DestoryKeyPair(keyPair); + keyPair = NULL; + return keyPair; + } + keyPair->pubKey->contentSize = pubKeySize; + size_t priKeySize = keyPair->priKey->maxSize; + if (EVP_PKEY_get_raw_private_key(key, keyPair->priKey->buf, &priKeySize) != OPENSSL_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"get pri key fail"); + DestoryKeyPair(keyPair); + keyPair = NULL; + return keyPair; + } + keyPair->priKey->contentSize = priKeySize; + if (key != NULL) { + EVP_PKEY_free(key); + } + if (ctx != NULL) { + EVP_PKEY_CTX_free(ctx); + } + return keyPair; +} + +int32_t Ed25519Sign(const KeyPair *keyPair, const Buffer *data, Buffer **sign) +{ + if (!IsEd25519KeyPairValid(keyPair) || !IsBufferValid(data) || sign == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"bad param"); + return RESULT_BAD_PARAM; + } + int32_t ret = RESULT_GENERAL_ERROR; + EVP_PKEY *key = EVP_PKEY_new_raw_private_key(EVP_PKEY_ED25519, NULL, + keyPair->priKey->buf, keyPair->priKey->contentSize); + if (key == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"get pri key fail"); + return ret; + } + EVP_MD_CTX *ctx = EVP_MD_CTX_new(); + if (ctx == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"get ctx fail"); + EVP_PKEY_free(key); + return ret; + } + if (EVP_DigestSignInit(ctx, NULL, NULL, NULL, key) != OPENSSL_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"init sign fail"); + EVP_PKEY_free(key); + EVP_MD_CTX_free(ctx); + return ret; + } + *sign = CreateBuffer(ED25519_FIX_SIGN_BUFFER_SIZE); + if (!IsBufferValid(*sign)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"create buffer fail"); + EVP_PKEY_free(key); + EVP_MD_CTX_free(ctx); + return ret; + } + size_t signSize = (*sign)->maxSize; + if (EVP_DigestSign(ctx, (*sign)->buf, &signSize, data->buf, data->contentSize) != OPENSSL_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"sign fail"); + DestoryBuffer(*sign); + *sign = NULL; + EVP_PKEY_free(key); + EVP_MD_CTX_free(ctx); + return ret; + } + (*sign)->contentSize = signSize; + ret = RESULT_SUCCESS; + EVP_PKEY_free(key); + EVP_MD_CTX_free(ctx); + return ret; +} + +int32_t Ed25519Verify(const Buffer *pubKey, const Buffer *data, const Buffer *sign) +{ + if (!CheckBufferWithSize(pubKey, ED25519_FIX_PUBKEY_BUFFER_SIZE) || !IsBufferValid(data) || + !CheckBufferWithSize(sign, ED25519_FIX_SIGN_BUFFER_SIZE)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"bad param"); + return RESULT_BAD_PARAM; + } + int32_t ret = RESULT_GENERAL_ERROR; + EVP_PKEY *key = EVP_PKEY_new_raw_public_key(EVP_PKEY_ED25519, NULL, pubKey->buf, pubKey->contentSize); + if (key == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"get pub key fail"); + return ret; + } + EVP_MD_CTX *ctx = EVP_MD_CTX_new(); + if (ctx == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"get ctx fail"); + EVP_PKEY_free(key); + return ret; + } + if (EVP_DigestVerifyInit(ctx, NULL, NULL, NULL, key) != OPENSSL_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"init verify fail"); + EVP_PKEY_free(key); + EVP_MD_CTX_free(ctx); + return ret; + } + if (EVP_DigestVerify(ctx, sign->buf, sign->contentSize, data->buf, data->contentSize) != OPENSSL_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"verify fail"); + EVP_PKEY_free(key); + EVP_MD_CTX_free(ctx); + return ret; + } + ret = RESULT_SUCCESS; + EVP_PKEY_free(key); + EVP_MD_CTX_free(ctx); + return ret; +} + +static int32_t IamHmac(const EVP_MD *alg, + const Buffer *hmacKey, const Buffer *data, Buffer *hmac) +{ + if (!IsBufferValid(hmacKey) || hmacKey->contentSize > INT_MAX || + !IsBufferValid(data) || !IsBufferValid(hmac) || hmac->maxSize > UINT_MAX) { + FACEAUTH_HILOGE(MODULE_SERVICE,"bad param"); + return RESULT_BAD_PARAM; + } + unsigned int hmacSize = hmac->maxSize; + uint8_t *hmacData = HMAC(alg, hmacKey->buf, (int)hmacKey->contentSize, data->buf, data->contentSize, + hmac->buf, &hmacSize); + if (hmacData == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"hmac fail"); + return RESULT_GENERAL_ERROR; + } + hmac->contentSize = hmacSize; + return RESULT_SUCCESS; +} + +int32_t HmacSha256(const Buffer *hmacKey, const Buffer *data, Buffer **hmac) +{ + const EVP_MD *alg = EVP_sha256(); + if (alg == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"no algo"); + return RESULT_GENERAL_ERROR; + } + *hmac = CreateBuffer(SHA256_DIGEST_SIZE); + if (*hmac == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"create buffer fail"); + return RESULT_NO_MEMORY; + } + if (IamHmac(alg, hmacKey, data, *hmac) != RESULT_SUCCESS) { + DestoryBuffer(*hmac); + *hmac = NULL; + FACEAUTH_HILOGE(MODULE_SERVICE,"hmac fail"); + return RESULT_GENERAL_ERROR; + } + return RESULT_SUCCESS; +} + +int32_t HmacSha512(const Buffer *hmacKey, const Buffer *data, Buffer **hmac) +{ + const EVP_MD *alg = EVP_sha512(); + if (alg == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"no algo"); + return RESULT_GENERAL_ERROR; + } + *hmac = CreateBuffer(SHA512_DIGEST_SIZE); + if (*hmac == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"create buffer fail"); + return RESULT_NO_MEMORY; + } + if (IamHmac(alg, hmacKey, data, *hmac) != RESULT_SUCCESS) { + DestoryBuffer(*hmac); + *hmac = NULL; + FACEAUTH_HILOGE(MODULE_SERVICE,"hmac fail"); + return RESULT_GENERAL_ERROR; + } + return RESULT_SUCCESS; +} + +int32_t SecureRandom(uint8_t *buffer, uint32_t size) +{ + if (buffer == NULL || size > INT_MAX) { + FACEAUTH_HILOGE(MODULE_SERVICE,"bad param"); + return RESULT_BAD_PARAM; + } + if (RAND_bytes(buffer, (int)size) != OPENSSL_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"rand fail"); + return RESULT_GENERAL_ERROR; + } + return RESULT_SUCCESS; +} +} +} +} diff --git a/services/temp/src/adaptor_memory.cpp b/services/temp/src/adaptor_memory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f9efe83bf22ea5959edd9af5cf5976ebbf3b9db3 --- /dev/null +++ b/services/temp/src/adaptor_memory.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "adaptor_memory.h" +#include +namespace OHOS { +namespace UserIAM { +namespace FaceAuth { +void *Malloc(const size_t size) +{ + if (size == 0) { + return NULL; + } + return malloc(size); +} + +void Free(void *ptr) +{ + if (ptr == NULL) { + return; + } + free(ptr); +} +} +} +} diff --git a/services/temp/src/buffer.cpp b/services/temp/src/buffer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..972e384a48650f2f4607a844b191152b16bb005c --- /dev/null +++ b/services/temp/src/buffer.cpp @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "buffer.h" +#include "adaptor_memory.h" +#include "securec.h" +#include "face_auth_log_wrapper.h" +namespace OHOS { +namespace UserIAM { +namespace FaceAuth { +#define MAX_BUFFER_SIZE 512000 + +bool IsBufferValid(const Buffer *buffer) +{ + if ((buffer == NULL) || (buffer->buf == NULL) || + (buffer->maxSize == 0) || (buffer->maxSize > MAX_BUFFER_SIZE) || + (buffer->contentSize > buffer->maxSize)) { + return false; + } + + return true; +} + +bool CheckBufferWithSize(const Buffer *buffer, const uint32_t size) +{ + if ((!IsBufferValid(buffer)) || (buffer->contentSize != size)) { + return false; + } + + return true; +} + +Buffer *CreateBuffer(const uint32_t size) +{ + if ((size == 0) || (size > MAX_BUFFER_SIZE)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Bad param size:%zu", size); + return NULL; + } + + Buffer *buffer = (Buffer *)Malloc(sizeof(Buffer)); + if (buffer == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Get buffer struct error"); + return NULL; + } + + buffer->buf = (uint8_t *)Malloc(size); + if (buffer->buf == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Get buffer error"); + Free(buffer); + return NULL; + } + + if (memset_s(buffer->buf, size, 0, size) != EOK) { + Free(buffer->buf); + Free(buffer); + return NULL; + } + buffer->maxSize = size; + buffer->contentSize = 0; + + return buffer; +} + +Buffer *CreateBufferByData(const uint8_t *data, const uint32_t dataSize) +{ + if ((data == NULL) || (dataSize == 0) || (dataSize > MAX_BUFFER_SIZE)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Bad param size:%u", dataSize); + return NULL; + } + + Buffer *buffer = (Buffer *)Malloc(sizeof(Buffer)); + if (buffer == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Get buffer struct error"); + return NULL; + } + + buffer->buf = (uint8_t *)Malloc(dataSize); + if (buffer->buf == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Get buffer error"); + Free(buffer); + return NULL; + } + + if (memcpy_s(buffer->buf, dataSize, data, dataSize) != EOK) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Cpy buffer error"); + DestoryBuffer(buffer); + return NULL; + } + buffer->maxSize = dataSize; + buffer->contentSize = dataSize; + + return buffer; +} + +ResultCode InitBuffer(Buffer *buffer, const uint8_t *buf, const uint32_t bufSize) +{ + if (!IsBufferValid(buffer) || (buf == NULL) || (bufSize == 0)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Bad param"); + return RESULT_BAD_PARAM; + } + + if (memcpy_s(buffer->buf, buffer->maxSize, buf, bufSize) != EOK) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Copy buffer fail"); + return RESULT_BAD_COPY; + } + buffer->contentSize = bufSize; + + return RESULT_SUCCESS; +} + +void DestoryBuffer(Buffer *buffer) +{ + if (buffer != NULL) { + if (buffer->buf != NULL) { + if (memset_s(buffer->buf, buffer->contentSize, 0, buffer->contentSize) != EOK) { + FACEAUTH_HILOGE(MODULE_SERVICE,"DestoryBuffer memset fail!"); + } + Free(buffer->buf); + buffer->buf = NULL; + buffer->contentSize = 0; + buffer->maxSize = 0; + } + Free(buffer); + } +} + +Buffer *CopyBuffer(const Buffer *buffer) +{ + if (!IsBufferValid(buffer)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Invalid buffer"); + return NULL; + } + + Buffer *copyBuffer = CreateBuffer(buffer->maxSize); + if (copyBuffer == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Invalid buffer"); + return NULL; + } + + if (memcpy_s(copyBuffer->buf, copyBuffer->maxSize, buffer->buf, buffer->contentSize) != EOK) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Copy buffer fail"); + goto FAIL; + } + copyBuffer->contentSize = buffer->contentSize; + + return copyBuffer; + +FAIL: + DestoryBuffer(copyBuffer); + + return NULL; +} + +bool CompareBuffer(const Buffer *buffer1, const Buffer *buffer2) +{ + if (!IsBufferValid(buffer1) || !IsBufferValid(buffer2) || (buffer1->contentSize != buffer2->contentSize)) { + return false; + } + + if (memcmp(buffer1->buf, buffer2->buf, buffer1->contentSize) == 0) { + return true; + } + + return false; +} + +ResultCode GetBufferData(const Buffer *buffer, uint8_t *data, uint32_t *dataSize) +{ + if (!IsBufferValid(buffer) || (data == NULL) || (dataSize == NULL)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Bad param"); + return RESULT_BAD_PARAM; + } + if (memcpy_s(data, *dataSize, buffer->buf, buffer->contentSize) != EOK) { + FACEAUTH_HILOGE(MODULE_SERVICE,"Copy buffer fail"); + return RESULT_BAD_COPY; + } + *dataSize = buffer->contentSize; + return RESULT_SUCCESS; +} +} +} +} diff --git a/services/temp/src/face_auth_ca.cpp b/services/temp/src/face_auth_ca.cpp index 61705c0324e2d0753fcd88728d09850b596e22bc..e8d3ced512d2e059de2192abdb56b088b92a9f03 100644 --- a/services/temp/src/face_auth_ca.cpp +++ b/services/temp/src/face_auth_ca.cpp @@ -1,120 +1,149 @@ -#include "face_auth_ca.h" -namespace OHOS { -namespace UserIAM { -namespace FaceAuth { -std::shared_ptr FaceAuthCA::faceAuthCA_ = nullptr; -std::mutex FaceAuthCA::mutex_; - -std::shared_ptr FaceAuthCA::GetInstance() { - if(faceAuthCA_ == nullptr) { - std::lock_guard lock_l(mutex_); - if(faceAuthCA_ == nullptr) { - faceAuthCA_ = std::make_shared(); - } - } - return faceAuthCA_; -} - -int32_t FaceAuthCA::Init() { - FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); - return 0; -} - -int32_t FaceAuthCA::Close() { - FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); - return 0; -} - -int32_t FaceAuthCA::LoadAlgorithm() { - FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); - return 0; -} - -int32_t FaceAuthCA::ReleaseAlgorithm() { - FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); - return 0; -} - -int32_t FaceAuthCA::StartAlgorithmOperation(AlgorithmOperation algorithmOperation, AlgorithmParam param) { - FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); - (void)(algorithmOperation); - (void)(param); - return 0; -} - -int32_t FaceAuthCA::TransferImageToAlgorithm(CameraImage images) { - sleep(1); - (void)(images); - return 0; -} - -void FaceAuthCA::GetAlgorithmState(int32_t &retCode, std::vector &retCoauthMsg) { - retCode = 1; - (void)(retCoauthMsg); - return ; -} - -int32_t FaceAuthCA::GetExecutorInfo(std::vector &pubKey, uint32_t &esl, uint64_t &authAbility) { - FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); - (void)(pubKey); - (void)(esl); - (void)(authAbility); - return 0; -} - -int32_t FaceAuthCA::FinishAlgorithmOperation(AlgorithmResult &retResult) { - FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); - int32_t result = 0; - GetAuthResult(result); - FACEAUTH_HILOGI(MODULE_SERVICE, "get auth result = %{public}d.",result); - retResult.result = result; - return 0; -} - -int32_t FaceAuthCA::DeleteTemplete(uint64_t templateId) { - FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); - (void)(templateId); - return 0; -} - -int32_t FaceAuthCA::VerifyTemplateData(std::vector templateIdList) { - FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); - (void)(templateIdList); - return 0; -} - -int32_t FaceAuthCA::GetRemainTimes(uint64_t templateId, int32_t &remainingTimes) { - FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); - return 0; -} - -int32_t FaceAuthCA::ResetRemainTimes(uint64_t templateId) { - FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); - return 0; -} - -int32_t FaceAuthCA::CancelAlogrithmOperation() { - FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); - return 0; -} -//temp code start -void GetAuthResult(int32_t &result) { - FILE* pFile = nullptr; - pFile = fopen("/data/useriam/auth_result.txt","a+"); - if(pFile == nullptr) { - printf("open file failed."); - return; - } - fseek(pFile,0,SEEK_END); - if(0 < ftell(pFile)) { - fseek(pFile,0,SEEK_SET); - char str[128] = {0}; - fread((void*)str,sizeof(char),128,pFile); - result = atoi(str); - } - fclose(pFile); -} -//temp code end -} -} -} \ No newline at end of file +#include "face_auth_ca.h" +#include "defines.h" +#include "face_auth_func.h" + +namespace OHOS { +namespace UserIAM { +namespace FaceAuth { +std::shared_ptr FaceAuthCA::faceAuthCA_ = nullptr; +std::mutex FaceAuthCA::mutex_; + +std::shared_ptr FaceAuthCA::GetInstance() { + if(faceAuthCA_ == nullptr) { + std::lock_guard lock_l(mutex_); + if(faceAuthCA_ == nullptr) { + faceAuthCA_ = std::make_shared(); + } + } + return faceAuthCA_; +} + +int32_t FaceAuthCA::Init() { + FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); + GenerateKeyPair(); + return 0; +} + +int32_t FaceAuthCA::Close() { + FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); + return 0; +} + +int32_t FaceAuthCA::LoadAlgorithm() { + FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); + return 0; +} + +int32_t FaceAuthCA::ReleaseAlgorithm() { + FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); + return 0; +} + +int32_t FaceAuthCA::StartAlgorithmOperation(AlgorithmOperation algorithmOperation, AlgorithmParam param) { + FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); + (void)(algorithmOperation); + SetAlgorithmParam(param); + return 0; +} + +int32_t FaceAuthCA::TransferImageToAlgorithm(CameraImage images) { + sleep(1); + (void)(images); + return 0; +} + +void FaceAuthCA::GetAlgorithmState(int32_t &retCode, std::vector &retCoauthMsg) { + retCode = 1; + (void)(retCoauthMsg); + return ; +} + +int32_t FaceAuthCA::GetExecutorInfo(std::vector &pubKey, uint32_t &esl, uint64_t &authAbility) { + FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); + if(DoGetExecutorInfo(pubKey,esl,authAbility) != RESULT_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE, "DoGetExecutorInfo failed."); + return -1; + } + return 0; +} + +int32_t FaceAuthCA::FinishAlgorithmOperation(AlgorithmResult &retResult) { + FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); + int32_t authResult = 0; + GetAuthResult(authResult); + FACEAUTH_HILOGI(MODULE_SERVICE, "get auth result = %{public}d.",authResult); + retResult.result = authResult; + retResult.templateId = param_.templateId; + GetRemainTimes(param_.templateId,retResult.remainTimes); + Buffer *retTlv = CreateBuffer(RESULT_TLV_LEN); + if(retTlv == nullptr) { + FACEAUTH_HILOGE(MODULE_SERVICE, "CreateBuffer failed."); + return -1; + } + ResultCode result = GenerateRetTlv(RESULT_SUCCESS, param_.scheduleId, FACE_AUTH, param_.templateId, retTlv); + if(result != RESULT_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE, "GenerateRetTlv failed."); + DestoryBuffer(retTlv); + return -1; + } + result = SetResultTlv(retTlv, retResult.coauthMsg); + if (result != RESULT_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE, "SetResultTlv failed."); + DestoryBuffer(retTlv); + return -1; + } + DestoryBuffer(retTlv); + return 0; +} + +int32_t FaceAuthCA::DeleteTemplete(uint64_t templateId) { + FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); + (void)(templateId); + return 0; +} + +int32_t FaceAuthCA::VerifyTemplateData(std::vector templateIdList) { + FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); + (void)(templateIdList); + return 0; +} + +int32_t FaceAuthCA::GetRemainTimes(uint64_t templateId, int32_t &remainingTimes) { + FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); + return 0; +} + +int32_t FaceAuthCA::ResetRemainTimes(uint64_t templateId) { + FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); + return 0; +} + +int32_t FaceAuthCA::CancelAlogrithmOperation() { + FACEAUTH_HILOGI(MODULE_SERVICE, "%{public}s run.", __PRETTY_FUNCTION__); + return 0; +} +void FaceAuthCA::SetAlgorithmParam(const AlgorithmParam ¶m) +{ + param_ = param; +} +//temp code start +void GetAuthResult(int32_t &result) { + FILE* pFile = nullptr; + pFile = fopen("/data/useriam/auth_result.txt","r"); + if(pFile == nullptr) { + printf("open file failed."); + return; + } + fseek(pFile,0,SEEK_END); + if(0 < ftell(pFile)) { + fseek(pFile,0,SEEK_SET); + char str[128] = {0}; + fread((void*)str,sizeof(char),127,pFile); + result = atoi(str); + } + fclose(pFile); +} +//temp code end +} +} +} diff --git a/services/temp/src/face_auth_func.cpp b/services/temp/src/face_auth_func.cpp new file mode 100644 index 0000000000000000000000000000000000000000..66ecb746719c7c3e88183707a7a90d738be127f6 --- /dev/null +++ b/services/temp/src/face_auth_func.cpp @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "face_auth_func.h" +#include "adaptor_algorithm.h" +#include "buffer.h" +#include "securec.h" +#include "face_auth_log_wrapper.h" + +namespace OHOS { +namespace UserIAM { +namespace FaceAuth { +static KeyPair *g_keyPair = NULL; + +ResultCode GenerateKeyPair() +{ + DestoryKeyPair(g_keyPair); + g_keyPair = GenerateEd25519KeyPair(); + if (g_keyPair == NULL) { + FACEAUTH_HILOGE(MODULE_SERVICE,"GenerateEd25519Keypair fail!"); + return RESULT_GENERAL_ERROR; + } + FACEAUTH_HILOGI(MODULE_SERVICE,"GenerateKeyPair success"); + return RESULT_SUCCESS; +} + +static ResultCode WriteTlvHead(const AuthAttributeType type, const uint32_t length, Buffer *buf) +{ + int32_t tempType = type; + if (memcpy_s(buf->buf + buf->contentSize, buf->maxSize - buf->contentSize, &tempType, sizeof(tempType)) != EOK) { + FACEAUTH_HILOGE(MODULE_SERVICE,"copy type fail."); + return RESULT_BAD_COPY; + } + buf->contentSize += sizeof(tempType); + if (memcpy_s(buf->buf + buf->contentSize, buf->maxSize - buf->contentSize, &length, sizeof(length)) != EOK) { + FACEAUTH_HILOGE(MODULE_SERVICE,"copy length fail."); + return RESULT_BAD_COPY; + } + buf->contentSize += sizeof(length); + return RESULT_SUCCESS; +} + +static ResultCode WriteTlv(const AuthAttributeType type, const uint32_t length, const uint8_t *value, Buffer *buf) +{ + if (WriteTlvHead(type, length, buf) != RESULT_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"copy head fail."); + return RESULT_BAD_COPY; + } + if (memcpy_s(buf->buf + buf->contentSize, buf->maxSize - buf->contentSize, value, length) != EOK) { + FACEAUTH_HILOGE(MODULE_SERVICE,"copy value fail."); + return RESULT_BAD_COPY; + } + buf->contentSize += length; + return RESULT_SUCCESS; +} + +static Buffer *GetDataTlvContent(uint32_t result, uint64_t scheduleId, uint64_t subType, uint64_t templatedId) +{ + Buffer *ret = CreateBuffer(MAX_TLV_LEN); + if (!IsBufferValid(ret)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"no memory."); + return NULL; + } + uint32_t acl = FACE_AUTH_CAPABILITY_LEVEL; + if (WriteTlv(AUTH_RESULT_CODE, sizeof(result), (const uint8_t *)&result, ret) != RESULT_SUCCESS || + WriteTlv(AUTH_TEMPLATE_ID, sizeof(templatedId), (const uint8_t *)&templatedId, ret) != RESULT_SUCCESS || + WriteTlv(AUTH_SESSION_ID, sizeof(scheduleId), (const uint8_t *)&scheduleId, ret) != RESULT_SUCCESS || + WriteTlv(AUTH_SUBTYPE, sizeof(subType), (const uint8_t *)&subType, ret) != RESULT_SUCCESS || + WriteTlv(AUTH_CAPABILITY_LEVEL, sizeof(acl), (const uint8_t *)&acl, ret) != RESULT_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"write tlv fail."); + DestoryBuffer(ret); + return NULL; + } + return ret; +} + +ResultCode GenerateRetTlv(uint32_t result, uint64_t scheduleId, uint64_t subType, uint64_t templatedId, + Buffer *retTlv) +{ + if (!IsBufferValid(retTlv) || !IsEd25519KeyPairValid(g_keyPair)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"param is invalid."); + return RESULT_BAD_PARAM; + } + Buffer *dataContent = GetDataTlvContent(result, scheduleId, subType, templatedId); + if (!IsBufferValid(dataContent)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"get data content fail."); + return RESULT_BAD_COPY; + } + Buffer *signContent = NULL; + if (Ed25519Sign(g_keyPair, dataContent, &signContent) != RESULT_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"sign data fail."); + DestoryBuffer(dataContent); + return RESULT_GENERAL_ERROR; + } + uint32_t rootLen = TAG_AND_LEN_BYTE + dataContent->contentSize + TAG_AND_LEN_BYTE + ED25519_FIX_SIGN_BUFFER_SIZE; + if (WriteTlvHead(AUTH_ROOT, rootLen, retTlv) != RESULT_SUCCESS || + WriteTlv(AUTH_EXECUTOR_DATA, dataContent->contentSize, dataContent->buf, retTlv) != RESULT_SUCCESS || + WriteTlv(AUTH_SIGNATURE, signContent->contentSize, signContent->buf, retTlv) != RESULT_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"write tlv fail."); + DestoryBuffer(dataContent); + DestoryBuffer(signContent); + return RESULT_BAD_COPY; + } + DestoryBuffer(dataContent); + DestoryBuffer(signContent); + return RESULT_SUCCESS; +} +ResultCode SetResultTlv(Buffer *retTlv, std::vector &resultTlv) +{ + resultTlv.resize(retTlv->contentSize); + if (memcpy_s(&resultTlv[0], retTlv->contentSize, retTlv->buf, retTlv->contentSize) != EOK) { + FACEAUTH_HILOGE(MODULE_SERVICE,"copy retTlv to resultTlv fail!"); + return RESULT_GENERAL_ERROR; + } + return RESULT_SUCCESS; +} +ResultCode DoGetExecutorInfo(std::vector &vPubKey, uint32_t &esl, uint64_t &authAbility) +{ + if (!IsEd25519KeyPairValid(g_keyPair)) { + FACEAUTH_HILOGE(MODULE_SERVICE,"key pair not init!"); + return RESULT_NEED_INIT; + } + uint32_t pubKeyLen = CONST_PUB_KEY_LEN; + uint8_t pubKey[CONST_PUB_KEY_LEN]; + if (GetBufferData(g_keyPair->pubKey, pubKey, &pubKeyLen) != RESULT_SUCCESS) { + FACEAUTH_HILOGE(MODULE_SERVICE,"GetBufferData fail!"); + return RESULT_UNKNOWN; + } + int index = 0; + vPubKey.clear(); + for(index = 0;index { + // console.log("FaceEnroll resourceManager startAbilityForResult asyncCallback StartAbilityResult: " + // + err.code + " data: " + data) + // }).then(data => + // console.info("FaceEnroll resourceManager startApplicationForResult promise::then : " + JSON.stringify(data)); + // ).catch(error => + // console.info("FaceEnroll resourceManager startApplicationForResult promise::catch : " + JSON.stringify(error)); + // ); + } +} \ No newline at end of file diff --git a/ui/faceenroll/common/src/main/ets/default/common/model/DeviceModel.ets b/ui/faceenroll/common/src/main/ets/default/common/model/DeviceModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..49bcfd2e185fa50a177d4a55b8fbff8a9ff46af4 --- /dev/null +++ b/ui/faceenroll/common/src/main/ets/default/common/model/DeviceModel.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Config from "../Config/Config.ets" + +export default class trustedModel { + private static trustedModel = new trustedModel(); + + public static getInstance(): trustedModel{ + return this.trustedModel; + } + + public getDeviceList(callback){ + callback(Config.DEVICE_LIST); + } + public getAddDeviceList(callback){ + callback(Config.ADD_LIST); + } + + public removeDevice(device){ + } + + public addDevice(device){ + } + +} \ No newline at end of file diff --git a/ui/faceenroll/common/src/main/ets/default/common/model/FaceSettingsModel.ets b/ui/faceenroll/common/src/main/ets/default/common/model/FaceSettingsModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..1e75f9b856cabba78e100e30afa2d4e3a128f649 --- /dev/null +++ b/ui/faceenroll/common/src/main/ets/default/common/model/FaceSettingsModel.ets @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Config from "../Config/Config.ets" +/** + * Class FaceSettingsModel. + */ +export default class FaceSettingsModel { + private static mFaceSettingsModel: FaceSettingsModel = new FaceSettingsModel(); + + /** + * Return an instance of FaceSettingsModel. + */ + public static getInstance(): FaceSettingsModel { + return this.mFaceSettingsModel; + } + + /** + * New face data. (pad) + * + * @param {object} callback - The callback from presenter. + */ + NewFaceData(callback) { + console.info("FaceEnroll FaceSettingsModel NewFaceData start"); + let credentialId = Math.random()*1000; + let faceData = Config.FACE_DATA + callback(faceData); + console.info("FaceEnroll FaceSettingsModel NewFaceData end"); + } + + + /** + * Choose unlock method + * + * @param {object} methods - The unlock method + */ + chooseUnlockMethod(method) { + console.info('FaceEnroll FaceSettingsModel chooseUnlockMethod start'); + console.info('FaceEnroll FaceSettingsModel chooseUnlockMethod method' + method); + console.info('FaceEnroll FaceSettingsModel chooseUnlockMethod end '); + } + + /** + * Whether to start up app lock + * + * @param {object} status - The AppLock status + */ + AppLock(status) { + console.info('FaceEnroll FaceSettingsModel activateAppLock start'); + if (status === true) { + AppStorage.SetOrCreate('appLock_isOn', true); + } else { + console.info("FaceEnroll FaceSettingsModel close AppLock "); + AppStorage.SetOrCreate('appLock_isOn', false); + } + console.info('FaceEnroll FaceSettingsModel activateAppLock end '); + } + + /** + * Whether to start up safe cabinet + * + * @param {object} status - The SafeCabinet status + */ + SafeCabinet(status) { + console.info('FaceEnroll FaceSettingsModel activateSafeCabinet start'); + if (status === true) { + AppStorage.SetOrCreate('safeCabinet_isOn', true); + } else { + console.info("FaceEnroll FaceSettingsModel close activateSafeCabinet "); + AppStorage.SetOrCreate('safeCabinet_isOn', false); + } + console.info('FaceEnroll FaceSettingsModel activateSafeCabinet end '); + } + + + /** + * Whether to start up Screen fill light in low light environment + * + * @param {object} status - The ScreenFillFightInLowLightEnvironment status + */ + ScreenFillFightInLowLightEnvironment(status) { + console.info("FaceEnroll FaceSettingsModel ScreenFillFightInLowLightEnvironment start"); + if (status == true) { + AppStorage.SetOrCreate('fillLight_isOn', true); + } else { + console.info("FaceEnroll FaceSettingsModel close ScreenFillFightInLowLightEnvironment "); + AppStorage.SetOrCreate('fillLight_isOn', false); + } + console.info("FaceEnroll FaceSettingsModel ScreenFillFightInLowLightEnvironment end"); + } + + /** + * Whether to start up smart lock screen notifications + * + * @param {object} status - The SmartLockScreenNotifications status + */ + SmartLockScreenNotifications(status) { + console.info("FaceEnroll FaceSettingsModel SmartLockScreenNotifications start"); + if (status === true) { + AppStorage.SetOrCreate('smartDisplayLockScreen_isOn', true); + } else { + console.info("FaceEnroll FaceSettingsModel close SmartLockScreenNotifications "); + AppStorage.SetOrCreate('smartDisplayLockScreen_isOn', false); + } + console.info("FaceEnroll FaceSettingsModel SmartLockScreenNotifications end"); + } + + /** + * Whether to start up automatic fill in account password + * + * @param {object} status - The FillInAccountPassword status + */ + FillInAccountPassword(status) { + console.info("faceSettingsModel FillInAccountPassword start"); + if (status === true) { + AppStorage.SetOrCreate('fillInAccount_isOn', true); + } else { + console.info("FaceEnroll FaceSettingsModel close FillInAccountPassword "); + AppStorage.SetOrCreate('fillInAccount_isOn', false); + } + console.info("FaceEnroll FaceSettingsModel FillInAccountPassword end"); + } + + /** + * Whether to start up look at screen during face recognition + * + * @param {object} status - The lookAtScreenDuringFaceRecognition status + */ + lookAtScreenDuringFaceRecognition(status) { + console.info("FaceEnroll FaceSettingsModel lookAtScreenDuringFaceRecognition start"); + if (status === true) { + AppStorage.SetOrCreate('lookAtScreenDuringFaceRecognition_isOn', true); + } else { + console.info("FaceEnroll FaceSettingsModel close lookAtScreenDuringFaceRecognition "); + AppStorage.SetOrCreate('lookAtScreenDuringFaceRecognition_isOn', false); + } + console.info("FaceEnroll FaceSettingsModel lookAtScreenDuringFaceRecognition end"); + } + + /** + * Whether to start up auxiliary mode + * + * @param {object} status - The auxiliaryMode status + */ + auxiliaryMode(status) { + console.info("FaceEnroll FaceSettingsModel auxiliaryMode start"); + if (status === true) { + AppStorage.SetOrCreate('auxiliaryMode_isOn', true); + } else { + console.info("FaceEnroll FaceSettingsModel close auxiliaryMode "); + AppStorage.SetOrCreate('auxiliaryMode_isOn', false); + } + console.info("FaceEnroll FaceSettingsModel auxiliaryMode end"); + } + + + /** + * Whether to turn off and pick up the phone to turn on the screen + * + * @param {object} status - The BrightScreenOfThePhone status + */ + BrightScreenOfThePhone(status) { + console.info("FaceEnroll FaceSettingsModel BrightScreenOfThePhone start"); + if (status === true) { + AppStorage.SetOrCreate('BrightScreenOfThePhone_isOn', true); + } else { + console.info("FaceEnroll FaceSettingsModel close BrightScreenOfThePhone "); + AppStorage.SetOrCreate('BrightScreenOfThePhone_isOn', false); + } + console.info("FaceEnroll FaceSettingsModel BrightScreenOfThePhone end"); + } +} diff --git a/ui/faceenroll/common/src/main/ets/default/common/model/userAuthModel.ets b/ui/faceenroll/common/src/main/ets/default/common/model/userAuthModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..b4bcb6f16af9814e7ed248d2bb6728fc1cbd4470 --- /dev/null +++ b/ui/faceenroll/common/src/main/ets/default/common/model/userAuthModel.ets @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UserIDM from '@ohos.useridm'; +import Config from "../Config/Config.ets" + +const auth = Config.AUTH +export default class userAuthModel { + private static userAuthModel = new userAuthModel(); + private authCounts: number; + private UserIDM ; + + constructor() { + this.UserIDM = UserIDM.constructor(); + } + + /** + * Return an instance of userAuthModel. + */ + public static getInstance(): userAuthModel{ + return this.userAuthModel; + } + + /** + * Get userAuthInfo. + * @param {function} callback - Callback function. + * @param {function} getUserMode - Do after callback function. + */ + public getUserAuthInfo(callback, getUserMode) { + console.info("FaceEnroll userAuthModel getUserAuthInfo start"); + this.UserIDM.getAuthInfo(Config.AUTH_TYPE, (data) => { + try { + console.info('FaceEnroll userAuthModel getUserAuthInfo getAuthInfo success', JSON.stringify(data)); + callback(data,getUserMode); + } + catch (e) { + console.info('FaceEnroll userAuthModel getUserAuthInfo getAuthInfo error' + JSON.stringify(e)); + } + }) + console.info("FaceEnroll userAuthModel getUserAuthInfo end"); + } + + /** + * Get phone mode(2D or 3D). + * @param callback + */ + public getUserMode(callback) { + callback(Config.TYPE2D); + } + + /** + * Delete face. + * @param {number} credentialId - CredentialId. + * @param {unit8Array} token - Token. + * @param callback + * @param sucssCallback + */ + public deleteFace(credentialId, token, callback, sucssCallback) { + console.info("FaceEnroll userAuthModel deleteFace start"); + this.UserIDM.delCred(credentialId, token, { + onResult: (result, extraInfo) => { + try { + console.info('FaceEnroll uaerAuthModel deleteFace delCred result', JSON.stringify(result)); + callback(result); + } + catch (e) { + console.info('FaceEnroll uaerAuthModel deleteFace delCred error', JSON.stringify(e)); + } + }, + onAcquireInfo: (moduleNum, acquireNum, extraInfo) => { + console.info('FaceEnroll uaerAuthModel deleteFace delCred onAcquireInfo callback'); + } + }) + console.info("FaceEnroll userAuthModel deleteFace end"); + } + + /** + * + * @param callback + */ + public getIsCheck(callback) { + callback(Config.TRUSTED_DEVICE_CHECK) + } +} diff --git a/ui/faceenroll/common/src/main/ets/default/common/presenter/FaceSettingsPresenter.ets b/ui/faceenroll/common/src/main/ets/default/common/presenter/FaceSettingsPresenter.ets new file mode 100644 index 0000000000000000000000000000000000000000..17adc065b3689e097298cc3351adfb5bb190cd4e --- /dev/null +++ b/ui/faceenroll/common/src/main/ets/default/common/presenter/FaceSettingsPresenter.ets @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import FaceSettingsModel from '../model/FaceSettingsModel.ets'; + +/** + * Class FaceSettingsPresenter. + */ +export default class FaceSettingsPresenter { + private static FaceSettingsPresenter: FaceSettingsPresenter = new FaceSettingsPresenter(); + private mFaceSettingsModel: FaceSettingsModel; + + private constructor() { + this.mFaceSettingsModel = FaceSettingsModel.getInstance(); + + } + + /** + * Return an instance of FaceSettingsPresenter. + */ + public static getInstance(): FaceSettingsPresenter{ + return this.FaceSettingsPresenter; + } + + /** + * New face data.(pad) + */ + NewFaceData(callback) { + console.info("FaceEnroll FaceSettingsPresenter NewFaceData start"); + this.mFaceSettingsModel.NewFaceData((data) => { + callback(data) + }) + console.info("FaceEnroll FaceSettingsPresenter NewFaceData end"); + } + + + /** + * Choose unlock method + * + * @param {object} methods - The unlock method + */ + chooseUnlockMethod(method) { + console.info("FaceEnroll FaceSettingsPresenter chooseUnlockMethod start"); + this.mFaceSettingsModel.chooseUnlockMethod(method); + console.info("FaceEnroll FaceSettingsPresenter chooseUnlockMethod end"); + } + + /** + * Whether to start up app lock + * + * @param {object} status - The AppLock status + */ + AppLock(status) { + console.info("FaceEnroll FaceSettingsPresenter AppLock start"); + this.mFaceSettingsModel.AppLock(status); + console.info("FaceEnroll FaceSettingsPresenter AppLock end"); + } + + /** + * start up safe cabinet + * + * @param {object} status - The SafeCabinet status + */ + SafeCabinet(status) { + console.info("FaceEnroll FaceSettingsPresenter SafeCabinet start"); + this.mFaceSettingsModel.SafeCabinet(status); + console.info("FaceEnroll FaceSettingsPresenter SafeCabinet end"); + } + + /** + * Whether to start up Screen fill light in low light environment + * + * @param {object} status - The ScreenFillFightInLowLightEnvironment status + */ + ScreenFillFightInLowLightEnvironment(status) { + console.info("FaceEnroll FaceSettingsPresenter ScreenFillFightInLowLightEnvironment start"); + this.mFaceSettingsModel.ScreenFillFightInLowLightEnvironment(status); + console.info("FaceEnroll FaceSettingsPresenter ScreenFillFightInLowLightEnvironment end"); + } + + /** + * smart lock screen notifications + * + * @param {object} status - The SmartLockScreenNotifications status + */ + SmartLockScreenNotifications(status) { + console.info("FaceEnroll FaceSettingsPresenter SmartLockScreenNotifications start"); + this.mFaceSettingsModel.SmartLockScreenNotifications(status); + console.info("FaceEnroll FaceSettingsPresenter SmartLockScreenNotifications end"); + } + + /** + * Whether to start up automatic fill in account password + * + * @param {object} status - The FillInAccountPassword status + */ + FillInAccountPassword(status) { + console.info("FaceEnroll FaceSettingsPresenter FillInAccountPassword start"); + this.mFaceSettingsModel.FillInAccountPassword(status); + console.info("FaceEnroll FaceSettingsPresenter FillInAccountPassword end"); + } + + /** + * Whether to start up look at screen during face recognition + * + * @param {object} status - The lookAtScreenDuringFaceRecognition status + */ + lookAtScreenDuringFaceRecognition(status) { + console.info("FaceEnroll FaceSettingsPresenter lookAtScreenDuringFaceRecognition start"); + this.mFaceSettingsModel.lookAtScreenDuringFaceRecognition(status); + console.info("FaceEnroll FaceSettingsPresenter lookAtScreenDuringFaceRecognition end"); + } + + /** + * Whether to start up auxiliary mode + * + * @param {object} status - The auxiliaryMode status + */ + auxiliaryMode(status) { + console.info("FaceEnroll FaceSettingsPresenter auxiliaryMode start"); + this.mFaceSettingsModel.auxiliaryMode(status); + console.info("FaceEnroll FaceSettingsPresenter auxiliaryMode end"); + } + + /** + * Whether to turn off and pick up the phone to turn on the screen + * + * @param {object} status - The BrightScreenOfThePhone status + */ + BrightScreenOfThePhone(status) { + console.info("FaceEnroll FaceSettingsPresenter BrightScreenOfThePhone start"); + this.mFaceSettingsModel.BrightScreenOfThePhone(status) + console.info("FaceEnroll FaceSettingsPresenter BrightScreenOfThePhone end"); + } +} \ No newline at end of file diff --git a/ui/faceenroll/common/src/main/ets/default/common/presenter/userAuthPresenter.ets b/ui/faceenroll/common/src/main/ets/default/common/presenter/userAuthPresenter.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ea58f697a1b2ce25a15231398be83b8a94f3766 --- /dev/null +++ b/ui/faceenroll/common/src/main/ets/default/common/presenter/userAuthPresenter.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ResourceManager from '../manager/resourceManager.ets' +import router from '@system.router'; + +export default class UserAuthPresenter { + protected mResourceManager: ResourceManager; + private static userAuthPresenter: UserAuthPresenter = new UserAuthPresenter(); + private static resourceManager: ResourceManager = new ResourceManager(); + + protected constructor() { + this.mResourceManager = ResourceManager.getInstance(); + } + + public static getInstance(): UserAuthPresenter{ + return this.userAuthPresenter; + } + + /** + * Jump to userAuth page. + * @param callback + */ + public jumpToUserAuth(callback) { + this.mResourceManager.jumpToUserAuth(this.jumpToUserAuthCallBack.bind(this),callback); + } + + /** + * Jump to userAuth after got token. + * @param {unit8Array} token - Token. + * @param {function} getTokenCallback - Do after get token. + */ + public jumpToUserAuthCallBack(token,getTokenCallback) { + AppStorage.SetOrCreate('faceToken', token); + getTokenCallback(); + setTimeout(()=>{ + router.push({ + uri:'pages/entryView' + }); + AppStorage.Delete('faceToken'); + },600000); + } +} + diff --git a/ui/faceenroll/common/src/main/ets/default/common/presenter/userSettingsPresenter.ets b/ui/faceenroll/common/src/main/ets/default/common/presenter/userSettingsPresenter.ets new file mode 100644 index 0000000000000000000000000000000000000000..be82d8aa647e54897729405ab6f483ff756c9d72 --- /dev/null +++ b/ui/faceenroll/common/src/main/ets/default/common/presenter/userSettingsPresenter.ets @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UserAuthModel from '../model/userAuthModel.ets' +import FeatureAbility from '@ohos.ability.featureAbility'; +import ResourceManager from '../manager/resourceManager.ets' +import router from '@system.router'; + +/** + * Class UserSettingsPresenter. + */ +export default class UserSettingsPresenter { + private authLength: number ; + protected mUserAuthModel: UserAuthModel; + protected mResourceManager: ResourceManager; + private deleteResArr = new Array(); + private faceInfo; + private static userSettingsPresenter: UserSettingsPresenter = new UserSettingsPresenter(); + private static resourceManager: ResourceManager = new ResourceManager(); + + protected constructor() { + this.mUserAuthModel = UserAuthModel.getInstance(); + this.mResourceManager = ResourceManager.getInstance(); + if (this.mUserAuthModel != undefined) { + this.faceInfo = AppStorage.Get('faceInfo'); + } + } + + /** + * Return an instance of UserSettingsPresenter. + */ + public static getInstance(): UserSettingsPresenter{ + return this.userSettingsPresenter; + } + + /** + * Delete face. + * @param {object} faceInfos - User faceInfos. + * @param {Uint8Array} token - Token. + * @param {function} sucssCallback - Do this after callback. + */ + public deleteFace(faceInfos, token, sucssCallback) { + for (let i = this.deleteResArr.length; i < faceInfos.length; i++) { + this.mUserAuthModel.deleteFace(faceInfos[i].credentialId, token, this.deleteFaceCallback.bind(this), sucssCallback); + } + } + + /** + * Delete face callback. + * @param {boolean} deleteRes - Delete face result. + * @param {function} sucssCallback - Do this after get delete result. + */ + public deleteFaceCallback(deleteRes, sucssCallback) { + let res: boolean = deleteRes; + this.deleteResArr.push(res); + if (this.deleteResArr.length == this.faceInfo.length) { + AppStorage.SetOrCreate('deleteRes', this.deleteResArr); + sucssCallback(); + } + } + + /** + * Delete face pad. + * @param {object} faceInfos - User faceInfos. + * @param {Uint8Array} token - Token. + * @param {function} sucssCallback - Do this after callback. + */ + public deleteFacePad(faceInfo, token, sucssCallback) { + this.mUserAuthModel.deleteFace(faceInfo.credentialId, token, this.deleteFaceCallbackPad.bind(this), sucssCallback); + } + /** + * Delete face Pad callback. + * @param {boolean} deleteRes - Delete face result. + * @param {function} sucssCallback - Do this after get delete result. + */ + public deleteFaceCallbackPad(deleteRes, sucssCallback) { + if (deleteRes == true) { + sucssCallback(); + } + } +} + diff --git a/ui/faceenroll/feature/faceSettings/build.gradle b/ui/faceenroll/feature/faceSettings/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..9f3fbd44a43f9933874d4f190e2e364f0f96d4a4 --- /dev/null +++ b/ui/faceenroll/feature/faceSettings/build.gradle @@ -0,0 +1,19 @@ +apply plugin: 'com.huawei.ohos.library' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 7 + defaultConfig { + compatibleSdkVersion 7 + } + arkEnabled false + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} +dependencies { +} \ No newline at end of file diff --git a/ui/faceenroll/feature/faceSettings/src/main/config.json b/ui/faceenroll/feature/faceSettings/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..5fde09ba43b21fb666b322c03469f1b1acddeead --- /dev/null +++ b/ui/faceenroll/feature/faceSettings/src/main/config.json @@ -0,0 +1,22 @@ +{ + "app": { + "bundleName": "com.ohos.faceEnroll", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.faceEnroll", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "faceSettings1", + "moduleType": "har" + } + } +} \ No newline at end of file diff --git a/ui/faceenroll/feature/faceSettings/src/main/ets/default/common/DefaultConstants.ets b/ui/faceenroll/feature/faceSettings/src/main/ets/default/common/DefaultConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..40d90a0ba8144192e7c76780fe796ee63306ec1f --- /dev/null +++ b/ui/faceenroll/feature/faceSettings/src/main/ets/default/common/DefaultConstants.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default class StyleConstants { + public static DEFAULT_FONT_COLOR: string = '#ffffff' + public static TOTAL_WIDTH: string = '93%'; + public static WIDTH: string = '100%'; + public static ICON_WIDTH: number = 25; + public static ICON_HEIGHT: number = 35; + public static BACK_ICON_HEIGHT: number = 80; + public static BACK_ICON_WIDTH: number = 40; + public static RADIO_SIZE: number = 30; + public static SINGLE_HEIGHT: number = 100; + public static DOUBLE_HEIGHT: number = 120; + public static SINGLE_HEIGHT_: number = 70; + public static DOUBLE_HEIGHT_: number = 84; + public static DIVIDER: number = 1; + public static BORDER_RADIUS: number = 30; + public static PADDING: number = 18; + public static PADDING_30: number = 30; + public static PADDING_20: number = 20; + public static PADDING_4: number = 4; + public static PADDING_8: number = 8; + public static PADDING_10: number = 10; + public static PADDING_16: number = 16; + public static PADDING_24: number = 24; + public static PADDING_32: number = 32; + public static WHITE_BACKGROUND_COLOR: string = '#FFFFFF'; + public static GREY_BACKGROUND_COLOR: string = '#F2F3F5'; + public static DARK_GREY_BACKGROUND_COLOR: string = '#E5E6E8'; + public static GREY_FONT_COLOR: string = '#5B5C5E'; + public static BLUE_FONT_COLOR: string = '#0A58F6'; + public static RAD_FONT_COLOR: string = '#FF4500'; + public static SMALL_FONT_SIZE: number = 18; + public static MEDIUM_FONT_SIZE: number = 20; + public static LARGE_FONT_SIZE: number = 23; + public static OVERSIZE_FONT_SIZE: number = 30; +} \ No newline at end of file diff --git a/ui/faceenroll/feature/faceSettings/src/main/ets/default/pages/faceSettings.ets b/ui/faceenroll/feature/faceSettings/src/main/ets/default/pages/faceSettings.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b6b920c973ac2eecace750c89ab8c4d986b6550 --- /dev/null +++ b/ui/faceenroll/feature/faceSettings/src/main/ets/default/pages/faceSettings.ets @@ -0,0 +1,730 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DefaultConstants from '../common/DefaultConstants.ets'; +import FaceSettingsPresenter from "../../../../../../../common/src/main/ets/default/common/presenter/FaceSettingsPresenter.ets"; +import UserSettingsPresenter from '../../../../../../../common/src/main/ets/default/common/presenter/userSettingsPresenter.ets'; +import router from '@system.router'; + +const FACELENGTH: number = 1; +const USER_MODE: string = '3D'; +let mFaceSettingsPresenter: FaceSettingsPresenter; +let mUserSettingsPresenter: UserSettingsPresenter; + +@Component +export default struct faceSettings { + scroller: Scroller = new Scroller(); + @Prop faceLength: number; + @Prop userMode: string; + @State mFaceLength: number = 1; + @StorageLink('deleteRes') @Watch('deleteFaceSuccess') resultArr: [] = []; + @StorageLink('smartDisplayLockScreen_isOn') smartDisplayLockScreen_isOn: boolean = true; + @StorageLink('fillInAccount_isOn') fillInAccount_isOn: boolean = false; + @StorageLink('lookAtScreenDuringFaceRecognition_isOn') lookAtScreenDuringFaceRecognition_isOn: boolean = false; + @StorageLink('fillLight_isOn') fillLight_isOn: boolean = false; + @StorageLink('auxiliaryMode_isOn') auxiliaryMode_isOn: boolean = false; + @State unlock_num: number = 2; + @State safeCabinet_isOn: boolean = true; + @State appLock_isOn: boolean = true; + + private aboutToAppear(): void { + console.info("FaceEnroll FaceSettings aboutToAppear start"); + console.info('FaceEnroll FaceSettings faceLength = ' + this.faceLength); + console.info('FaceEnroll FaceSettings userMode = ' + this.userMode); + mUserSettingsPresenter = UserSettingsPresenter.getInstance(); + mFaceSettingsPresenter = FaceSettingsPresenter.getInstance(); + this.mFaceLength = this.faceLength; + console.info("FaceEnroll FaceSettings aboutToAppear end"); + } + + SafeCabinetDialogController: CustomDialogController = new CustomDialogController({ + builder: SafeCabinetDialog({ status: $safeCabinet_isOn }), + autoCancel: false, + // offset: { + // dx: 0, dy: -30 + // }, + alignment: DialogAlignment.Bottom, + // customStyle: true + }) + AppLockDialogController: CustomDialogController = new CustomDialogController({ + builder: AppLockDialog({ status: $appLock_isOn }), + autoCancel: false, + alignment: DialogAlignment.Bottom, + // customStyle: true + }) + UnlockDialogController: CustomDialogController = new CustomDialogController({ + builder: UnlockDialog({ num: $unlock_num }), + autoCancel: false, + alignment: DialogAlignment.Bottom, + // customStyle: true + }) + deleteFaceDialogController: CustomDialogController = new CustomDialogController({ + builder: DeleteFaceDialog({ faceNum: this.mFaceLength, confirm: this.onAccept.bind(this) }), + autoCancel: false, + alignment: DialogAlignment.Bottom, + // customStyle: true + }) + +/** + * Delete face. + */ + onAccept() { + console.info("FaceSettings AppStorage.Get('faceInfo')" + JSON.stringify(AppStorage.Get('faceInfo'))); + let faceInfos = new Array(); + faceInfos = AppStorage.Get('faceInfo'); + let faceToken = AppStorage.Get('faceToken'); + let deleteResult = mUserSettingsPresenter.deleteFace(faceInfos, faceToken, this.deleteFaceSuccess.bind(this)); + } + +/** + * Do after delete face successfully. + */ + deleteFaceSuccess() { + console.info('FaceSettings deleteFaceSuccess start'); + let deleteRes: [] = AppStorage.Get('deleteRes'); + let faceInfos = new Array(); + faceInfos = AppStorage.Get('faceInfo'); + if (deleteRes.length == faceInfos.length) { + let resultSucFlag = 0; + for (let i = 0; i < deleteRes.length; i++) { + if (deleteRes[i]) { + resultSucFlag += 1; + } + } + if (resultSucFlag == deleteRes.length) { + this.deleteFaceDialogController.close(); + router.push({ + uri: 'pages/entryView' + }) + } else { + this.deleteFaceDialogController.close(); + console.info('FaceEnroll faceSettings delete face fail'); + } + } else { + this.deleteFaceSuccess(); + } + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Scroll(this.scroller) { + Column() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Image($r('app.media.back')) + .width(DefaultConstants.BACK_ICON_WIDTH) + .height(DefaultConstants.BACK_ICON_HEIGHT) + Text($r('app.string.face_checker')) + .fontSize(DefaultConstants.OVERSIZE_FONT_SIZE) + .margin({ left: DefaultConstants.PADDING_30 }) + } + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .height(DefaultConstants.SINGLE_HEIGHT) + .onClick(() => { + router.push({ + uri: 'pages/entryView' + }) + }) + + Text($r('app.string.face_recognition_is_used')) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .margin({ bottom: DefaultConstants.PADDING_16, top: DefaultConstants.PADDING_24 }) + Column() { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.face_unlock_method')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + Row() { + if (this.unlock_num === 2) { + Text($r('app.string.face_unlock_method_close')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + } else if (this.unlock_num === 1) { + Text($r('app.string.face_recognize_slideunlock_title')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + } + else if (this.unlock_num === 0) { + Text($r('app.string.face_recognize_unlock_title')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + } + Image($r('app.media.ic_settings_arrow')) + .width(DefaultConstants.ICON_WIDTH) + .height(DefaultConstants.ICON_HEIGHT) + } + } + .height(DefaultConstants.SINGLE_HEIGHT_) + .onClick(() => { + this.UnlockDialogController.open() + }) + + Divider() + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.GREY_BACKGROUND_COLOR) + Flex({ + direction: FlexDirection.Row, + justifyContent: FlexAlign.SpaceBetween, + alignItems: ItemAlign.Center + }) { + Text($r('app.string.secure_notification_new')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + Toggle({ type: ToggleType.Switch, isOn: this.smartDisplayLockScreen_isOn }) + .onChange(() => { + this.smartDisplayLockScreen_isOn = !this.smartDisplayLockScreen_isOn + mFaceSettingsPresenter.SmartLockScreenNotifications(this.smartDisplayLockScreen_isOn); + }) + } + .height(DefaultConstants.SINGLE_HEIGHT_) + + Divider() + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.GREY_BACKGROUND_COLOR) + if (this.userMode === USER_MODE) { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.title_strong_box_pref')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + if (this.safeCabinet_isOn === true) { + Toggle({ type: ToggleType.Switch, isOn: this.safeCabinet_isOn }).onChange(() => { + this.safeCabinet_isOn = false + }) + } else { + Flex({ justifyContent: FlexAlign.End }) { + Toggle({ type: ToggleType.Switch, isOn: this.safeCabinet_isOn }) + .enabled(false) + }.width(DefaultConstants.SINGLE_HEIGHT_) + .height(DefaultConstants.WIDTH) + .onClick(() => { + console.log('lzx====> SafeCabinetDialogController onchange') + if (this.safeCabinet_isOn === false) { + this.SafeCabinetDialogController.open(); + } else { + this.safeCabinet_isOn = false + } + }) + } + } + .height(DefaultConstants.SINGLE_HEIGHT_) + + Divider() + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.GREY_BACKGROUND_COLOR) + } + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.title_apps_security_pref')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + if (this.appLock_isOn === true) { + Toggle({ type: ToggleType.Switch, isOn: this.appLock_isOn }) + .onChange(() => { + this.appLock_isOn = false + mFaceSettingsPresenter.AppLock(this.appLock_isOn); + }) + } else { + Flex({ justifyContent: FlexAlign.End }) { + Toggle({ type: ToggleType.Switch, isOn: this.appLock_isOn }) + .enabled(false) + }.width(DefaultConstants.SINGLE_HEIGHT_) + .height(DefaultConstants.WIDTH) + .onClick(() => { + if (this.appLock_isOn === false) { + this.AppLockDialogController.open(); + } else { + this.appLock_isOn = false + mFaceSettingsPresenter.AppLock(this.appLock_isOn); + } + }) + } + } + .height(DefaultConstants.SINGLE_HEIGHT_) + + Divider() + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.GREY_BACKGROUND_COLOR) + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) { + Text($r('app.string.face_fingerprint_settings_switch_title')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_4 }) + Text($r('app.string.face_fingerprint_settings_switch_summary')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + } + + Toggle({ type: ToggleType.Switch, isOn: this.fillInAccount_isOn }) + .onChange(() => { + this.fillInAccount_isOn = !this.fillInAccount_isOn + mFaceSettingsPresenter.FillInAccountPassword(this.fillInAccount_isOn); + }) + } + .height(DefaultConstants.DOUBLE_HEIGHT_) + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .margin({ bottom: DefaultConstants.PADDING }) + .padding({ + top: DefaultConstants.PADDING_8, + bottom: DefaultConstants.PADDING_8, + left: DefaultConstants.PADDING, + right: DefaultConstants.PADDING + }) + + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Text($r('app.string.delete_record_title')) + .fontColor(Color.Red) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .margin({ bottom: DefaultConstants.PADDING_16 }) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .height(DefaultConstants.SINGLE_HEIGHT) + .onClick(() => { + this.deleteFaceDialogController.open(); + }) + + if (this.faceLength === FACELENGTH) { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Text($r('app.string.enroll_backup_face_title')) + .fontColor(Color.Blue) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .margin({ bottom: DefaultConstants.PADDING_16 }) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .height(DefaultConstants.SINGLE_HEIGHT) + + Text($r('app.string.enroll_backup_face_summary')) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .margin({ bottom: DefaultConstants.PADDING_32 }) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + } else { + Text($r('app.string.main_and_backup_faces')) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .margin({ bottom: DefaultConstants.PADDING_32 }) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + } + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.face_introdution_title')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + Row() { + Text($r('app.string.face_enterance_off')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + Image($r('app.media.ic_settings_arrow')) + .width(DefaultConstants.ICON_WIDTH) + .height(DefaultConstants.ICON_HEIGHT) + } + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .margin({ bottom: DefaultConstants.PADDING }) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .height(DefaultConstants.SINGLE_HEIGHT) + .onClick(() => { + AppStorage.SetOrCreate('facePageFlag', 1); + }) + + if (this.userMode === USER_MODE) { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.title_face_stare_aux')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + Toggle({ type: ToggleType.Switch, isOn: this.lookAtScreenDuringFaceRecognition_isOn }) + .onChange(() => { + this.lookAtScreenDuringFaceRecognition_isOn = !this.lookAtScreenDuringFaceRecognition_isOn + mFaceSettingsPresenter.lookAtScreenDuringFaceRecognition(this.lookAtScreenDuringFaceRecognition_isOn); + }) + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .margin({ bottom: DefaultConstants.PADDING_16 }) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .height(DefaultConstants.SINGLE_HEIGHT) + } else { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.title_fill_light')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + Toggle({ type: ToggleType.Switch, isOn: this.fillLight_isOn }) + .onChange(() => { + this.fillLight_isOn = !this.fillLight_isOn + mFaceSettingsPresenter.ScreenFillFightInLowLightEnvironment(this.fillLight_isOn); + }) + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .margin({ bottom: DefaultConstants.PADDING }) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .height(DefaultConstants.SINGLE_HEIGHT) + + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) { + Text($r('app.string.auxiliary_mode')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_4 }) + Text($r('app.string.recognize_without_opening_eyes')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + } + + Toggle({ type: ToggleType.Switch, isOn: this.auxiliaryMode_isOn }) + .onChange(() => { + this.auxiliaryMode_isOn = !this.auxiliaryMode_isOn + mFaceSettingsPresenter.auxiliaryMode(this.auxiliaryMode_isOn); + }) + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .margin({ bottom: DefaultConstants.PADDING }) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .height(DefaultConstants.DOUBLE_HEIGHT) + } + Text() { + Span($r('app.string.face_3dguide_info_2')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + if (this.userMode === USER_MODE) { + Span($r('app.string.face_guide_3d_announce_link')) + .fontColor(Color.Blue) + } else { + Span($r('app.string.face_guide_2d_announce_link')) + .fontColor(Color.Blue) + } + } + .fontSize(DefaultConstants.SMALL_FONT_SIZE) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .onClick(() => { + router.push({ + uri: 'pages/declare' + }) + }) + + Column() { + Text($r('app.string.recommend_preference_title')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_16 }) + Text($r('app.string.face_config_light_01_universal')) + .fontColor(Color.Blue) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + if (this.userMode === USER_MODE) { + Text($r('app.string.annotation_screen_keeps_on')) + .fontColor(Color.Blue) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + .margin({ top: DefaultConstants.PADDING_16 }) + } + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.DARK_GREY_BACKGROUND_COLOR) + .margin({ bottom: DefaultConstants.PADDING_32, top: DefaultConstants.PADDING_32 }) + .padding({ + bottom: DefaultConstants.PADDING_30, + top: DefaultConstants.PADDING_30, + left: DefaultConstants.PADDING, + right: DefaultConstants.PADDING + }) + .width(DefaultConstants.WIDTH) + .alignItems(HorizontalAlign.Start) + } + .backgroundColor(DefaultConstants.GREY_BACKGROUND_COLOR) + .width(DefaultConstants.TOTAL_WIDTH) + .alignItems(HorizontalAlign.Start) + } + .scrollBarWidth(0) + } + .width(DefaultConstants.WIDTH) + .height(DefaultConstants.WIDTH) + .backgroundColor(DefaultConstants.GREY_BACKGROUND_COLOR) + } +} + +@CustomDialog +struct UnlockDialog { + @Link num: number + controller: CustomDialogController; + @State booleans: boolean[] = [false, false, false] + + aboutToAppear() { + this.booleans[this.num] = true + } + + isChecked(num) { + for (let i = 0;i < this.booleans.length; i++) { + if (i != num) { + this.booleans[i] = false + } else { + this.booleans[i] = true + } + } + } + + build() { + Column() { + Text($r('app.string.face_unlock_method')) + .fontSize(DefaultConstants.OVERSIZE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_30 }) + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) { + Text($r('app.string.face_recognize_unlock_title')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_4 }) + Text($r('app.string.face_recognize_unlock_summary_3d')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + } + + Toggle({ type: ToggleType.Checkbox, isOn: this.booleans[0] }) + .width(DefaultConstants.RADIO_SIZE) + .height(DefaultConstants.RADIO_SIZE) + .onChange(() => { + this.isChecked(0) + this.num = 0 + mFaceSettingsPresenter.chooseUnlockMethod(this.num); + this.controller.close(); + }) + }.height(DefaultConstants.DOUBLE_HEIGHT_) + + Divider() + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.GREY_BACKGROUND_COLOR) + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) { + Text($r('app.string.face_recognize_slideunlock_title')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_4 }) + Text($r('app.string.face_recognize_slideunlock_summary_3d')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + } + + Toggle({ type: ToggleType.Checkbox, isOn: this.booleans[1] }) + .width(DefaultConstants.RADIO_SIZE) + .height(DefaultConstants.RADIO_SIZE) + .onChange(() => { + this.isChecked(1) + this.num = 1 + mFaceSettingsPresenter.chooseUnlockMethod(this.num); + this.controller.close() + }) + }.height(DefaultConstants.DOUBLE_HEIGHT_) + + Divider() + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.GREY_BACKGROUND_COLOR) + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.face_unlock_method_close')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + Toggle({ type: ToggleType.Checkbox, isOn: this.booleans[2] }) + .width(DefaultConstants.RADIO_SIZE) + .height(DefaultConstants.RADIO_SIZE) + .onChange(() => { + this.isChecked(2) + this.num = 2; + mFaceSettingsPresenter.chooseUnlockMethod(this.num); + this.controller.close() + }) + }.height(DefaultConstants.SINGLE_HEIGHT_) + + Column() { + Text($r('app.string.face_record_cancel')) + .fontColor(Color.Blue) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + } + .width(DefaultConstants.WIDTH) + .margin({ top: DefaultConstants.PADDING_20 }) + .onClick(() => { + this.controller.close() + }) + } + .width(DefaultConstants.TOTAL_WIDTH) + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .alignItems(HorizontalAlign.Start) + .padding({ + bottom: DefaultConstants.PADDING_30, + top: DefaultConstants.PADDING_20, + left: DefaultConstants.PADDING_30, + right: DefaultConstants.PADDING_30 + }) + } +} + +@CustomDialog +struct SafeCabinetDialog { + @Link status: boolean + controller: CustomDialogController + + build() { + Column() { + Text($r('app.string.activate_safe')) + .fontSize(DefaultConstants.OVERSIZE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_30 }) + Text($r('app.string.face_inform_open_strongbox_msg')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_20 }) + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Text($r('app.string.face_record_cancel')) + .fontColor(Color.Blue) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .onClick(() => { + this.controller.close() + }) + Divider() + .vertical(true) + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.DARK_GREY_BACKGROUND_COLOR) + .height(DefaultConstants.PADDING_30) + Text($r('app.string.enable')) + .fontColor(Color.Blue) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .onClick(() => { + this.status = true; + mFaceSettingsPresenter.SafeCabinet(this.status); + this.controller.close() + }) + } + } + .width(DefaultConstants.TOTAL_WIDTH) + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .alignItems(HorizontalAlign.Start) + .padding({ + bottom: DefaultConstants.PADDING_30, + top: DefaultConstants.PADDING_20, + left: DefaultConstants.PADDING_30, + right: DefaultConstants.PADDING_30 + }) + } +} + +@CustomDialog +struct AppLockDialog { + @Link status: boolean + controller: CustomDialogController + + build() { + Column() { + Text($r('app.string.activate_app_lock')) + .fontSize(DefaultConstants.OVERSIZE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_30 }) + Text($r('app.string.face_inform_open_applock_msg')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_20 }) + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Text($r('app.string.face_record_cancel')) + .fontColor(Color.Blue) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .onClick(() => { + this.controller.close() + }) + Divider() + .vertical(true) + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.DARK_GREY_BACKGROUND_COLOR) + .height(DefaultConstants.PADDING_30) + Text($r('app.string.enable')) + .fontColor(Color.Blue) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .onClick(() => { + this.status = true; + mFaceSettingsPresenter.AppLock(this.status); + this.controller.close() + }) + } + } + .width(DefaultConstants.TOTAL_WIDTH) + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .alignItems(HorizontalAlign.Start) + .padding({ + bottom: DefaultConstants.PADDING_30, + top: DefaultConstants.PADDING_20, + left: DefaultConstants.PADDING_30, + right: DefaultConstants.PADDING_30 + }) + } +} + +@CustomDialog +struct DeleteFaceDialog { + controller: CustomDialogController; + @Prop faceNum: number; + @StorageLink('BrightScreenOfThePhone_isOn') BrightScreenOfThePhone_isOn: boolean = true; + confirm: () => void; + + aboutToAppear() { + console.log('FaceSettings faceNum ' + this.faceNum) + } + + build() { + Column() { + if (this.faceNum === FACELENGTH) { + Text($r('app.string.delete_record_title')) + .fontSize(DefaultConstants.OVERSIZE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_20 }) + } else { + Text($r('app.string.delete_all_face_data')) + .fontSize(DefaultConstants.OVERSIZE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_20 }) + } + Text($r('app.string.wether_delete_face_data')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_16 }) + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Toggle({ type: ToggleType.Checkbox, isOn: this.BrightScreenOfThePhone_isOn }) + .width(DefaultConstants.RADIO_SIZE) + .height(DefaultConstants.RADIO_SIZE) + .onChange((isOn) => { + this.BrightScreenOfThePhone_isOn = !this.BrightScreenOfThePhone_isOn + }) + Text($r('app.string.face_recognize_lighton_close_universal')) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + } + .margin({ left: -DefaultConstants.PADDING_10, bottom: DefaultConstants.PADDING_20 }) + + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Text($r('app.string.face_record_cancel')) + .fontColor(Color.Blue) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .onClick(() => { + this.controller.close() + }) + Divider() + .vertical(true) + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.DARK_GREY_BACKGROUND_COLOR) + .height(DefaultConstants.PADDING_30) + Text($r('app.string.face_record_delete')) + .fontColor(Color.Red) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .onClick(() => { + mFaceSettingsPresenter.BrightScreenOfThePhone(this.BrightScreenOfThePhone_isOn); + this.controller.close() + this.confirm() + }) + } + } + .width(DefaultConstants.TOTAL_WIDTH) + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .alignItems(HorizontalAlign.Start) + .padding({ + bottom: DefaultConstants.PADDING_30, + top: DefaultConstants.PADDING_20, + left: DefaultConstants.PADDING_30, + right: DefaultConstants.PADDING_30 + }) + } +} diff --git a/ui/faceenroll/feature/faceSettings/src/main/resources/base/element/string.json b/ui/faceenroll/feature/faceSettings/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7d9c40f600eb8be7f031194129ed0c6f1b92da7d --- /dev/null +++ b/ui/faceenroll/feature/faceSettings/src/main/resources/base/element/string.json @@ -0,0 +1,175 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "ETS_Empty Ability" + }, + { + "name": "face_checker", + "value": "人脸识别" + }, + + { + "name": "face_unlock_method", + "value": "解锁屏幕" + }, + { + "name": "face_recognize_slideunlock_title", + "value": "滑动解锁" + }, + { + "name": "secure_notification_new", + "value": "智能显示锁屏通知" + }, + + { + "name": "face_fingerprint_settings_switch_title", + "value": "自动填充账号和密码" + }, + { + "name": "face_fingerprint_settings_switch_summary", + "value": "使用密码保险箱保存的帐号和密码" + }, + { + "name": "delete_record_title", + "value": "删除面部数据" + }, + { + "name": "enroll_backup_face_title", + "value": "设置备用面容" + }, + { + "name": "enroll_backup_face_summary", + "value": "除继续学习您的长相外,还可识别另一种面容" + }, + + { + "name": "face_introdution_title", + "value": "解锁时需连接可信设备" + }, + + { + "name": "title_face_stare_aux", + "value": "人脸识别时需注视屏幕" + }, + + { + "name": "face_3dguide_info_2", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + { + "name": "face_guide_2d_announce_link", + "value": "关于人脸识别的声明。" + }, + { + "name": "face_guide_3d_announce_link", + "value": "关于3D人脸识别的声明。" + }, + { + "name": "recommend_preference_title", + "value": "是否在寻找其他设置项?" + }, + { + "name": "face_config_light_01_universal", + "value": "拿起手机亮屏" + }, + + { + "name": "face_recognize_unlock_title", + "value": "直接解锁" + }, + { + "name": "face_recognize_unlock_summary_3d", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "face_recognize_slideunlock_summary_3d", + "value": "人脸识别成功后滑动屏幕解锁" + }, + { + "name": "face_unlock_method_close", + "value": "关闭" + }, + { + "name": "face_record_cancel", + "value": "取消" + }, + { + "name": "face_inform_open_strongbox_msg", + "value": "需要启用文件管理保密柜完成人脸关联。是否启用?" + }, + { + "name": "face_inform_open_applock_msg", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启用应用锁?" + }, + { + "name": "face_record_delete", + "value": "删除" + }, + { + "name": "face_recognize_lighton_close_universal", + "value": "同时关闭拿起手机亮屏" + }, + { + "name": "title_strong_box_pref", + "value": "访问保密柜" + }, + { + "name": "title_apps_security_pref", + "value": "访问应用锁" + }, + { + "name": "face_enterance_off", + "value": "已关闭" + }, + { + "name": "title_fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "face_recognition_is_used", + "value": "人脸识别用于" + }, + { + "name": "main_and_backup_faces", + "value": "已设置主用及备用面容" + }, + + { + "name": "auxiliary_mode", + "value": "辅助模式" + }, + { + "name": "recognize_without_opening_eyes", + "value": "开启屏幕朗读后无需睁眼即可识别" + }, + { + "name": "annotation_screen_keeps_on", + "value": "注视屏幕不熄屏" + }, + { + "name": "enable", + "value": "启用" + }, + { + "name": "activate_safe", + "value": "启用保密柜" + }, + { + "name": "activate_app_lock", + "value": "启用应用锁" + }, + { + "name": "delete_all_face_data", + "value": "删除主用及备用面容" + }, + { + "name": "wether_delete_face_data", + "value": "删除后,基于面部数据的功能将不可用。是否删除?" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/feature/faceSettings/src/main/resources/base/media/back.png b/ui/faceenroll/feature/faceSettings/src/main/resources/base/media/back.png new file mode 100644 index 0000000000000000000000000000000000000000..85dcc6ad6895ff1b4ef599be169e0df24a7b01b5 Binary files /dev/null and b/ui/faceenroll/feature/faceSettings/src/main/resources/base/media/back.png differ diff --git a/ui/faceenroll/feature/faceSettings/src/main/resources/base/media/ic_settings_arrow.svg b/ui/faceenroll/feature/faceSettings/src/main/resources/base/media/ic_settings_arrow.svg new file mode 100644 index 0000000000000000000000000000000000000000..6aebbe7b504aa070dafcb5df58347bc151f0237e --- /dev/null +++ b/ui/faceenroll/feature/faceSettings/src/main/resources/base/media/ic_settings_arrow.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/ui/faceenroll/feature/faceSettings/src/main/resources/base/media/icon.png b/ui/faceenroll/feature/faceSettings/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ui/faceenroll/feature/faceSettings/src/main/resources/base/media/icon.png differ diff --git a/ui/faceenroll/feature/faceSettings/src/main/resources/en_US/element/string.json b/ui/faceenroll/feature/faceSettings/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f1630486edc66fa39ecafb7ecd4da17211018481 --- /dev/null +++ b/ui/faceenroll/feature/faceSettings/src/main/resources/en_US/element/string.json @@ -0,0 +1,176 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "ETS_Empty Ability" + }, + { + "name": "face_checker", + "value": "Face Recognition" + }, + + { + "name": "face_unlock_method", + "value": "Unlock device" + }, + { + "name": "face_recognize_slideunlock_title", + "value": "Slide to unlock" + }, + { + "name": "secure_notification_new", + "value": "Show notifications" + }, + + { + "name": "face_fingerprint_settings_switch_title", + "value": "Autofill usernames and passwords" + }, + { + "name": "face_fingerprint_settings_switch_summary", + "value": "Usernames and passwords are accessed from Password Vault." + }, + { + "name": "delete_record_title", + "value": "Delete facial data" + }, + { + "name": "enroll_backup_face_title", + "value": "Set an alternate look" + }, + { + "name": "enroll_backup_face_summary", + "value": "Add another appearance for accurate facial recognition even if you change your look." + }, + + { + "name": "face_introdution_title", + "value": "Require trusted device" + }, + + { + "name": "title_face_stare_aux", + "value": "Require eye contact" + }, + + { + "name": "face_3dguide_info_2", + "value": "Face Recognition verifies your identity based on your facial features. To learn more, see the" + }, + { + "name": "face_guide_2d_announce_link", + "value": "Statement About Face Recognition" + }, + { + "name": "face_guide_3d_announce_link", + "value": "Statement About 3D Face Recognition" + }, + { + "name": "recommend_preference_title", + "value": "Looking for other settings?" + }, + { + "name": "face_config_light_01_universal", + "value": "Raise to wake" + }, + { + "name": "face_recognize_unlock_title", + "value": "Direct unlock" + }, + { + "name": "face_recognize_unlock_summary_3d", + "value": "Unlock directly after successful facial recognition." + }, + { + "name": "face_recognize_slideunlock_summary_3d", + "value": "Slide to unlock after successful facial recognition." + }, + { + "name": "face_unlock_method_close", + "value": "Off" + }, + { + "name": "face_record_cancel", + "value": "Cancel" + }, + { + "name": "face_inform_open_strongbox_msg", + "value": "The Safe feature hasn\\'t been enabled yet." + }, + { + "name": "face_inform_open_applock_msg", + "value": "App Lock is not enabled. Enable now?" + }, + { + "name": "face_record_delete", + "value": "Delete" + }, + { + "name": "face_recognize_lighton_close_universal", + "value": "Disable raise to wake" + }, + { + "name": "title_strong_box_pref", + "value": "Access Safe" + }, + { + "name": "title_apps_security_pref", + "value": "Access App Lock" + }, + { + "name": "face_enterance_off", + "value": "Off" + }, + { + "name": "title_fill_light", + "value": "Low light compensation" + }, + + + { + "name": "face_recognition_is_used", + "value": "人脸识别用于" + }, + { + "name": "main_and_backup_faces", + "value": "已设置主用及备用面容" + }, + + { + "name": "auxiliary_mode", + "value": "辅助模式" + }, + { + "name": "recognize_without_opening_eyes", + "value": "开启屏幕朗读后无需睁眼即可识别" + }, + { + "name": "annotation_screen_keeps_on", + "value": "注视屏幕不熄屏" + }, + { + "name": "enable", + "value": "启用" + }, + { + "name": "activate_safe", + "value": "启用保密柜" + }, + { + "name": "activate_app_lock", + "value": "启用应用锁" + }, + { + "name": "delete_all_face_data", + "value": "删除主用及备用面容" + }, + { + "name": "wether_delete_face_data", + "value": "删除后,基于面部数据的功能将不可用。是否删除?" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/feature/faceSettings/src/main/resources/zh_CN/element/string.json b/ui/faceenroll/feature/faceSettings/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7d9c40f600eb8be7f031194129ed0c6f1b92da7d --- /dev/null +++ b/ui/faceenroll/feature/faceSettings/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,175 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "ETS_Empty Ability" + }, + { + "name": "face_checker", + "value": "人脸识别" + }, + + { + "name": "face_unlock_method", + "value": "解锁屏幕" + }, + { + "name": "face_recognize_slideunlock_title", + "value": "滑动解锁" + }, + { + "name": "secure_notification_new", + "value": "智能显示锁屏通知" + }, + + { + "name": "face_fingerprint_settings_switch_title", + "value": "自动填充账号和密码" + }, + { + "name": "face_fingerprint_settings_switch_summary", + "value": "使用密码保险箱保存的帐号和密码" + }, + { + "name": "delete_record_title", + "value": "删除面部数据" + }, + { + "name": "enroll_backup_face_title", + "value": "设置备用面容" + }, + { + "name": "enroll_backup_face_summary", + "value": "除继续学习您的长相外,还可识别另一种面容" + }, + + { + "name": "face_introdution_title", + "value": "解锁时需连接可信设备" + }, + + { + "name": "title_face_stare_aux", + "value": "人脸识别时需注视屏幕" + }, + + { + "name": "face_3dguide_info_2", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + { + "name": "face_guide_2d_announce_link", + "value": "关于人脸识别的声明。" + }, + { + "name": "face_guide_3d_announce_link", + "value": "关于3D人脸识别的声明。" + }, + { + "name": "recommend_preference_title", + "value": "是否在寻找其他设置项?" + }, + { + "name": "face_config_light_01_universal", + "value": "拿起手机亮屏" + }, + + { + "name": "face_recognize_unlock_title", + "value": "直接解锁" + }, + { + "name": "face_recognize_unlock_summary_3d", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "face_recognize_slideunlock_summary_3d", + "value": "人脸识别成功后滑动屏幕解锁" + }, + { + "name": "face_unlock_method_close", + "value": "关闭" + }, + { + "name": "face_record_cancel", + "value": "取消" + }, + { + "name": "face_inform_open_strongbox_msg", + "value": "需要启用文件管理保密柜完成人脸关联。是否启用?" + }, + { + "name": "face_inform_open_applock_msg", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启用应用锁?" + }, + { + "name": "face_record_delete", + "value": "删除" + }, + { + "name": "face_recognize_lighton_close_universal", + "value": "同时关闭拿起手机亮屏" + }, + { + "name": "title_strong_box_pref", + "value": "访问保密柜" + }, + { + "name": "title_apps_security_pref", + "value": "访问应用锁" + }, + { + "name": "face_enterance_off", + "value": "已关闭" + }, + { + "name": "title_fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "face_recognition_is_used", + "value": "人脸识别用于" + }, + { + "name": "main_and_backup_faces", + "value": "已设置主用及备用面容" + }, + + { + "name": "auxiliary_mode", + "value": "辅助模式" + }, + { + "name": "recognize_without_opening_eyes", + "value": "开启屏幕朗读后无需睁眼即可识别" + }, + { + "name": "annotation_screen_keeps_on", + "value": "注视屏幕不熄屏" + }, + { + "name": "enable", + "value": "启用" + }, + { + "name": "activate_safe", + "value": "启用保密柜" + }, + { + "name": "activate_app_lock", + "value": "启用应用锁" + }, + { + "name": "delete_all_face_data", + "value": "删除主用及备用面容" + }, + { + "name": "wether_delete_face_data", + "value": "删除后,基于面部数据的功能将不可用。是否删除?" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/feature/faceSettingsPad/build.gradle b/ui/faceenroll/feature/faceSettingsPad/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..9f3fbd44a43f9933874d4f190e2e364f0f96d4a4 --- /dev/null +++ b/ui/faceenroll/feature/faceSettingsPad/build.gradle @@ -0,0 +1,19 @@ +apply plugin: 'com.huawei.ohos.library' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 7 + defaultConfig { + compatibleSdkVersion 7 + } + arkEnabled false + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} +dependencies { +} \ No newline at end of file diff --git a/ui/faceenroll/feature/faceSettingsPad/src/main/config.json b/ui/faceenroll/feature/faceSettingsPad/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..5fde09ba43b21fb666b322c03469f1b1acddeead --- /dev/null +++ b/ui/faceenroll/feature/faceSettingsPad/src/main/config.json @@ -0,0 +1,22 @@ +{ + "app": { + "bundleName": "com.ohos.faceEnroll", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.faceEnroll", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "faceSettings1", + "moduleType": "har" + } + } +} \ No newline at end of file diff --git a/ui/faceenroll/feature/faceSettingsPad/src/main/ets/default/common/DefaultConstants.ets b/ui/faceenroll/feature/faceSettingsPad/src/main/ets/default/common/DefaultConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0ecbd4bb37be923e6cb335cdc02eed491dbeb6a --- /dev/null +++ b/ui/faceenroll/feature/faceSettingsPad/src/main/ets/default/common/DefaultConstants.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default class StyleConstants { + public static DEFAULT_FONT_COLOR: string = '#ffffff' + public static WIDTH: string = '100%'; + public static DIALOG_WIDTH: number = 440; + public static DIALOG_PADDING: number = 24; + public static DIALOG_TITLE_TOP: number = 20; + public static DIALOG_TITLE_BOTTOM: number = 25; + public static DIALOG_BUTTON_WIDTH: number = 196; + public static DIALOG_BUTTON_WIDTH2: number = 392; + public static DIALOG_BUTTON_HEIGHT: number = 45; + public static ICON_WIDTH: number = 25; + public static ICON_HEIGHT: number = 35; + public static BACK_ICON_HEIGHT: number = 60; + public static BACK_ICON_WIDTH: number = 30; + public static RADIO_SIZE: number = 25; + public static TOGGLE_SIZE: number = 40; + public static TOGGLE_BOX_SIZE: number = 50; + public static SINGLE_HEIGHT: number = 68; + public static SINGLE_HEIGHT_: number = 55; + public static DOUBLE_HEIGHT_: number = 68; + public static DIVIDER: number = 1; + public static BORDER_RADIUS: number = 20; + public static PADDING: number = 14; + public static PADDING_30: number = 30; + public static PADDING_4: number = 4; + public static TEXT_PADDING: number = 10; + public static TEXT_PADDING2: number = 20; + public static GERY_BORDER_PADDING: number = 16; + public static WHITE_BACKGROUND_COLOR: string = '#FFFFFF'; + public static GREY_BACKGROUND_COLOR: string = '#F2F3F5'; + public static DARK_GREY_BACKGROUND_COLOR: string = '#E5E6E8'; + public static GREY_FONT_COLOR: string = '#5B5C5E'; + public static BLUE_FONT_COLOR: string = '#0A58F6'; + public static SMALL_FONT_SIZE: number = 17; + public static MEDIUM_FONT_SIZE: number = 18; + public static LARGE_FONT_SIZE: number = 19; + public static OVERSIZE_FONT_SIZE: number = 22; +} \ No newline at end of file diff --git a/ui/faceenroll/feature/faceSettingsPad/src/main/ets/default/pages/index.ets b/ui/faceenroll/feature/faceSettingsPad/src/main/ets/default/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd037482587ba33e8472fae046cd8c85232da7f3 --- /dev/null +++ b/ui/faceenroll/feature/faceSettingsPad/src/main/ets/default/pages/index.ets @@ -0,0 +1,603 @@ +// @ts-nocheck +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import DefaultConstants from '../common/DefaultConstants.ets' +import FaceSettingsPresenter from "../../../../../../../common/src/main/ets/default/common/presenter/FaceSettingsPresenter.ets" +import UserSettingsPresenter from '../../../../../../../common/src/main/ets/default/common/presenter/userSettingsPresenter.ets' + +let mFaceSettingsPresenter: FaceSettingsPresenter; +let mUserSettingsPresenter: UserSettingsPresenter; +const FACENAME = '面部'; + +@Component +export default struct FaceSettings { + scroller: Scroller = new Scroller(); + @Prop faceLength: number; + @Prop userMode: string; + @StorageLink('faceInfo') faceInfos: [] = []; + @StorageLink('fillLight_isOn') fillLight_isOn: boolean = false; + @StorageLink('fillInAccount_isOn') fillInAccount_isOn: boolean = false; + @State appLock_isOn: boolean = true; + @State unlock_num: number = 2; + @State text: string = '面部1'; + private removeFace ; + @State faceNames: [] = []; + private name: [] = [{ isUsed:false }, { isUsed:false },{ isUsed:false },{ isUsed:false },{ isUsed:false }]; + + private aboutToAppear(): void { + console.info("FaceEnroll FaceSettings aboutToAppear start"); + console.info('FaceEnroll FaceSettings faceLength = ' + this.faceLength); + console.info('FaceEnroll FaceSettings userMode = ' + this.userMode); + mFaceSettingsPresenter = FaceSettingsPresenter.getInstance(); + mUserSettingsPresenter = UserSettingsPresenter.getInstance(); + for (let i = 0; i < this.faceInfos.length; i++) { + this.faceNames.push({ + id: this.faceInfos[i].credentialId, + name: i+1 + }); + this.name[i].isUsed = true; + } + console.info("FaceEnroll FaceSettings aboutToAppear end"); + } + + AppLockDialogController: CustomDialogController = new CustomDialogController({ + builder: AppLockDialog({ status: $appLock_isOn }), + autoCancel: false, + customStyle: true + }) + UnlockDialogController: CustomDialogController = new CustomDialogController({ + builder: UnlockDialog({ num: $unlock_num }), + autoCancel: false, + customStyle: true + }) + ReviseFaceController: CustomDialogController = new CustomDialogController({ + builder: ReviseFaceDialog({ text: $text, confirm: this.onAccept.bind(this) }), + autoCancel: false, + customStyle: true + }) + + onAccept() { + let faceToken = AppStorage.Get('faceToken'); + mUserSettingsPresenter.deleteFacePad(this.removeFace, faceToken, this.deleteFaceSuccess.bind(this)); + } + + deleteFaceSuccess() { + if (this.faceInfos.length != 0) { +// let index = this.faceInfos.indexOf(this.removeFace) +// this.faceInfos.splice(index, 1) + for(let i =0;i { + this.UnlockDialogController.open(); + }) + + Divider() + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.GREY_BACKGROUND_COLOR) + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.title_apps_security_pref')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + if (this.appLock_isOn === true) { + Row() { + Toggle({ type: ToggleType.Switch, isOn: this.appLock_isOn }) + .width(DefaultConstants.TOGGLE_SIZE) + .onChange(() => { + this.appLock_isOn = false; + mFaceSettingsPresenter.AppLock(this.appLock_isOn); + }) + }.width(DefaultConstants.TOGGLE_BOX_SIZE) + .height(DefaultConstants.SINGLE_HEIGHT_) + } else { + Row() { + Toggle({ type: ToggleType.Switch, isOn: this.appLock_isOn }) + .width(DefaultConstants.TOGGLE_SIZE) + .enabled(false) + + }.width(DefaultConstants.TOGGLE_BOX_SIZE) + .height(DefaultConstants.SINGLE_HEIGHT_) + + .onClick(() => { + if (this.appLock_isOn === false) { + this.AppLockDialogController.open(); + } else { + this.appLock_isOn = false; + mFaceSettingsPresenter.AppLock(this.appLock_isOn); + } + }) + } + } + .height(DefaultConstants.SINGLE_HEIGHT_) + + Divider() + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.GREY_BACKGROUND_COLOR) + + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) { + Text($r('app.string.face_fingerprint_settings_switch_title')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_4 }) + Text($r('app.string.face_fingerprint_settings_switch_summary')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + } + + Toggle({ type: ToggleType.Switch, isOn: this.fillInAccount_isOn }) + .width(DefaultConstants.TOGGLE_SIZE) + .onChange(() => { + this.fillInAccount_isOn = !this.fillInAccount_isOn + mFaceSettingsPresenter.FillInAccountPassword(this.fillInAccount_isOn); + }) + } + .height(DefaultConstants.DOUBLE_HEIGHT_) + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .margin({ bottom: DefaultConstants.PADDING }) + .padding({ + top: DefaultConstants.PADDING_4, + bottom: DefaultConstants.PADDING_4, + left: DefaultConstants.PADDING, + right: DefaultConstants.PADDING + }) + + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.face_introdution_title')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + Row() { + Text($r('app.string.face_enterance_off')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + Image($r('app.media.ic_settings_arrow')) + .width(DefaultConstants.ICON_WIDTH) + .height(DefaultConstants.ICON_HEIGHT) + } + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .margin({ bottom: DefaultConstants.PADDING }) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .height(DefaultConstants.SINGLE_HEIGHT) + .onClick(() => { + AppStorage.SetOrCreate('facePageFlag', 1); + }) + + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.title_fill_light')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + Toggle({ type: ToggleType.Switch, isOn: this.fillLight_isOn }) + .width(DefaultConstants.TOGGLE_SIZE) + .onChange(() => { + this.fillLight_isOn = !this.fillLight_isOn + mFaceSettingsPresenter.ScreenFillFightInLowLightEnvironment(this.fillLight_isOn); + }) + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .margin({ bottom: DefaultConstants.PADDING }) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .height(DefaultConstants.SINGLE_HEIGHT) + + Text() { + Span($r('app.string.multiface_list_title')) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + if (Number(this.faceInfos.length) != 0) { + Span('(' + Number(this.faceInfos.length) + '/5)') + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + } + } + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .margin({ bottom: DefaultConstants.TEXT_PADDING, top: DefaultConstants.TEXT_PADDING }) + + Column() { + ForEach(this.faceNames, (item) => { + Column() { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text(FACENAME + item.name) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + } + .height(DefaultConstants.SINGLE_HEIGHT_) + .onClick(() => { + this.text = FACENAME + item.name; + this.removeFace = item.id; + this.ReviseFaceController.open(); + }) + + if (this.faceInfos.length <= 4) { + Divider() + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.GREY_BACKGROUND_COLOR) + } + } + }) + if (this.faceInfos.length != 5) { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.multiface_enroll_new_face')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .fontColor(DefaultConstants.BLUE_FONT_COLOR) + } + .height(DefaultConstants.SINGLE_HEIGHT_) + .onClick(() => { + mFaceSettingsPresenter.NewFaceData(this.addFaceInfo.bind(this)); + }) + } + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .padding({ + top: DefaultConstants.PADDING_4, + bottom: DefaultConstants.PADDING_4, + left: DefaultConstants.PADDING, + right: DefaultConstants.PADDING + }) + + Text() { + Span($r('app.string.face_3dguide_info_2')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + Span($r('app.string.face_guide_2d_announce_link')) + .fontColor(DefaultConstants.BLUE_FONT_COLOR) + } + .fontSize(DefaultConstants.SMALL_FONT_SIZE) + .padding({ left: DefaultConstants.PADDING, right: DefaultConstants.PADDING }) + .margin({ bottom: DefaultConstants.PADDING, top: DefaultConstants.TEXT_PADDING }) + + Column() { + Text($r('app.string.recommend_preference_title')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + .margin({ bottom: DefaultConstants.GERY_BORDER_PADDING }) + Text($r('app.string.face_config_light_01_universal')) + .fontColor(DefaultConstants.BLUE_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + } + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.DARK_GREY_BACKGROUND_COLOR) + .margin({ top: DefaultConstants.PADDING }) + .padding({ + bottom: DefaultConstants.GERY_BORDER_PADDING, + top: DefaultConstants.GERY_BORDER_PADDING, + left: DefaultConstants.PADDING, + right: DefaultConstants.PADDING + }) + .width(DefaultConstants.WIDTH) + .alignItems(HorizontalAlign.Start) + } + // .backgroundColor(DefaultConstants.GREY_BACKGROUND_COLOR) + .padding({ + left: DefaultConstants.PADDING, + right: DefaultConstants.PADDING + }) + .alignItems(HorizontalAlign.Start) + } + .scrollBarWidth(0) + } + .width(DefaultConstants.WIDTH) + .height(DefaultConstants.WIDTH) + .backgroundColor(DefaultConstants.GREY_BACKGROUND_COLOR) + } +} + +@CustomDialog +struct ReviseFaceDialog { + controller: CustomDialogController; + @Link text: string; + confirm: () => {} + + build() { + Column() { + Text($r('app.string.multiface_face_name_title')) + .fontSize(DefaultConstants.OVERSIZE_FONT_SIZE) + .margin({ bottom: DefaultConstants.DIALOG_TITLE_BOTTOM }) + TextInput({ placeholder: '面部1', text: this.text }) + .margin({ bottom: DefaultConstants.DIALOG_TITLE_TOP }) + .placeholderFont({ size: DefaultConstants.LARGE_FONT_SIZE }) + .caretColor(Color.White) + .placeholderColor(Color.Grey) + .width(DefaultConstants.WIDTH) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .onChange((value: string) => { + this.text = value; + }); + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Button() { + Text($r('app.string.delete_face')) + .fontColor(DefaultConstants.BLUE_FONT_COLOR) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + } + .type(ButtonType.Capsule) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .width(DefaultConstants.DIALOG_BUTTON_WIDTH) + .height(DefaultConstants.DIALOG_BUTTON_HEIGHT) + .onClick(() => { + this.controller.close(); + this.confirm(); + }) + + Button() { + Text($r('app.string.multiface_save')) + .fontColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + } + .backgroundColor(DefaultConstants.BLUE_FONT_COLOR) + .type(ButtonType.Capsule) + .width(DefaultConstants.DIALOG_BUTTON_WIDTH) + .height(DefaultConstants.DIALOG_BUTTON_HEIGHT) + .onClick(() => { + this.controller.close(); + }) + } + } + .width(DefaultConstants.DIALOG_WIDTH) + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .alignItems(HorizontalAlign.Start) + .padding({ + top: DefaultConstants.DIALOG_TITLE_TOP, + bottom: DefaultConstants.DIALOG_TITLE_TOP, + left: DefaultConstants.DIALOG_PADDING, + right: DefaultConstants.DIALOG_PADDING + }) + } +} + +@CustomDialog +struct AppLockDialog { + @Link status: boolean + controller: CustomDialogController + + build() { + Column() { + Text($r('app.string.activate_app_lock')) + .fontSize(DefaultConstants.OVERSIZE_FONT_SIZE) + .margin({ bottom: DefaultConstants.DIALOG_TITLE_BOTTOM }) + Text($r('app.string.face_inform_open_applock_msg')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .margin({ bottom: DefaultConstants.DIALOG_TITLE_TOP }) + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Button() { + Text($r('app.string.face_record_cancel')) + .fontColor(DefaultConstants.BLUE_FONT_COLOR) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + } + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .type(ButtonType.Capsule) + .width(DefaultConstants.DIALOG_BUTTON_WIDTH) + .height(DefaultConstants.DIALOG_BUTTON_HEIGHT) + .onClick(() => { + this.controller.close(); + }) + + Divider() + .vertical(true) + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.DARK_GREY_BACKGROUND_COLOR) + .height(DefaultConstants.PADDING_30) + Button() { + Text($r('app.string.enable')) + .fontColor(DefaultConstants.BLUE_FONT_COLOR) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + } + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .type(ButtonType.Capsule) + .width(DefaultConstants.DIALOG_BUTTON_WIDTH) + .height(DefaultConstants.DIALOG_BUTTON_HEIGHT) + .onClick(() => { + this.status = true; + mFaceSettingsPresenter.AppLock(this.status); + this.controller.close(); + }) + } + } + .width(DefaultConstants.DIALOG_WIDTH) + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .alignItems(HorizontalAlign.Start) + .padding({ + top: DefaultConstants.DIALOG_TITLE_TOP, + bottom: DefaultConstants.DIALOG_TITLE_TOP, + left: DefaultConstants.DIALOG_PADDING, + right: DefaultConstants.DIALOG_PADDING + }) + } +} + +@CustomDialog +struct UnlockDialog { + @Link num: number + controller: CustomDialogController; + @State booleans: boolean[] = [false, false, false] + + aboutToAppear() { + this.booleans[this.num] = true + } + + isChecked(num) { + for (let i = 0;i < this.booleans.length; i++) { + if (i != num) { + this.booleans[i] = false + } else { + this.booleans[i] = true + } + } + } + + build() { + Column() { + Text($r('app.string.face_unlock_method')) + .fontSize(DefaultConstants.OVERSIZE_FONT_SIZE) + .margin({ bottom: DefaultConstants.DIALOG_TITLE_BOTTOM }) + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) { + Text($r('app.string.face_recognize_unlock_title')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_4 }) + Text($r('app.string.face_recognize_unlock_summary_3d')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + } + + Toggle({ type: ToggleType.Checkbox, isOn: this.booleans[0] }) + .width(DefaultConstants.RADIO_SIZE) + .height(DefaultConstants.RADIO_SIZE) + .onChange(() => { + this.isChecked(0) + this.num = 0 + mFaceSettingsPresenter.chooseUnlockMethod(this.num); + this.controller.close(); + }) + }.height(DefaultConstants.DOUBLE_HEIGHT_) + + Divider() + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.GREY_BACKGROUND_COLOR) + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) { + Text($r('app.string.face_recognize_slideunlock_title')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + .margin({ bottom: DefaultConstants.PADDING_4 }) + Text($r('app.string.face_recognize_slideunlock_summary_3d')) + .fontColor(DefaultConstants.GREY_FONT_COLOR) + .fontSize(DefaultConstants.MEDIUM_FONT_SIZE) + } + + Toggle({ type: ToggleType.Checkbox, isOn: this.booleans[1] }) + .width(DefaultConstants.RADIO_SIZE) + .height(DefaultConstants.RADIO_SIZE) + .onChange(() => { + this.isChecked(1) + this.num = 1 + mFaceSettingsPresenter.chooseUnlockMethod(this.num); + this.controller.close() + }) + }.height(DefaultConstants.DOUBLE_HEIGHT_) + + Divider() + .strokeWidth(DefaultConstants.DIVIDER) + .color(DefaultConstants.GREY_BACKGROUND_COLOR) + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.face_unlock_method_close')) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + Toggle({ type: ToggleType.Checkbox, isOn: this.booleans[2] }) + .width(DefaultConstants.RADIO_SIZE) + .height(DefaultConstants.RADIO_SIZE) + .onChange(() => { + this.isChecked(2) + this.num = 2; + mFaceSettingsPresenter.chooseUnlockMethod(this.num); + this.controller.close() + }) + }.height(DefaultConstants.SINGLE_HEIGHT_) + + Button() { + Text($r('app.string.face_record_cancel')) + .fontColor(DefaultConstants.BLUE_FONT_COLOR) + .fontSize(DefaultConstants.LARGE_FONT_SIZE) + } + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .type(ButtonType.Capsule) + .width(DefaultConstants.DIALOG_BUTTON_WIDTH2) + .height(DefaultConstants.DIALOG_BUTTON_HEIGHT) + .onClick(() => { + this.controller.close(); + }) + } + .width(DefaultConstants.DIALOG_WIDTH) + .borderRadius(DefaultConstants.BORDER_RADIUS) + .backgroundColor(DefaultConstants.WHITE_BACKGROUND_COLOR) + .alignItems(HorizontalAlign.Start) + .padding({ + top: DefaultConstants.DIALOG_TITLE_TOP, + bottom: DefaultConstants.DIALOG_TITLE_TOP, + left: DefaultConstants.DIALOG_PADDING, + right: DefaultConstants.DIALOG_PADDING + }) + } +} \ No newline at end of file diff --git a/ui/faceenroll/feature/faceSettingsPad/src/main/resources/base/element/string.json b/ui/faceenroll/feature/faceSettingsPad/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ed637ac0ef9166a2df6ced8e61d1389d41898bf4 --- /dev/null +++ b/ui/faceenroll/feature/faceSettingsPad/src/main/resources/base/element/string.json @@ -0,0 +1,129 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "ETS_Empty Ability" + }, + { + "name": "face_checker", + "value": "人脸识别" + }, + + { + "name": "face_unlock_method", + "value": "解锁屏幕" + }, + { + "name": "face_recognize_slideunlock_title", + "value": "滑动解锁" + }, + { + "name": "title_apps_security_pref", + "value": "访问应用锁" + }, + { + "name": "title_fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "recommend_preference_title", + "value": "是否在寻找其他设置项?" + }, + { + "name": "face_config_light_01_universal", + "value": "拿起手机亮屏" + }, + { + "name": "multiface_list_title", + "value": "面部列表" + }, + { + "name": "multiface_default_face_name_1", + "value": "面部 1" + }, + { + "name": "multiface_default_face_name", + "value": "面部" + }, + { + "name": "multiface_enroll_new_face", + "value": "新建面部数据" + }, + { + "name": "multiface_face_name_title", + "value": "面部名称" + }, + { + "name": "delete_face", + "value": "删除面部" + }, + { + "name": "multiface_save", + "value": "保存" + }, + { + "name": "face_unlock_method_close", + "value": "关闭" + }, + { + "name": "face_recognize_unlock_title", + "value": "直接解锁" + }, + { + "name": "face_3dguide_info_2", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + { + "name": "face_guide_2d_announce_link", + "value": "关于人脸识别的声明。" + }, + { + "name": "activate_app_lock", + "value": "启用应用锁" + }, + { + "name": "face_inform_open_applock_msg", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启用应用锁?" + }, + { + "name": "face_record_cancel", + "value": "取消" + }, + { + "name": "enable", + "value": "启用" + }, + { + "name": "face_recognize_unlock_summary_3d", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "face_recognize_slideunlock_summary_3d", + "value": "人脸识别成功后,滑动屏幕解锁" + }, + { + "name": "face_recognition_is_used", + "value": "人脸识别用于" + }, + { + "name": "face_introdution_title", + "value": "解锁时需连接可信设备" + }, + { + "name": "face_enterance_off", + "value": "已关闭" + }, + { + "name": "face_fingerprint_settings_switch_title", + "value": "自动填充账号和密码" + }, + { + "name": "face_fingerprint_settings_switch_summary", + "value": "使用密码保险箱保存的帐号和密码" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/feature/faceSettingsPad/src/main/resources/base/media/back.png b/ui/faceenroll/feature/faceSettingsPad/src/main/resources/base/media/back.png new file mode 100644 index 0000000000000000000000000000000000000000..85dcc6ad6895ff1b4ef599be169e0df24a7b01b5 Binary files /dev/null and b/ui/faceenroll/feature/faceSettingsPad/src/main/resources/base/media/back.png differ diff --git a/ui/faceenroll/feature/faceSettingsPad/src/main/resources/base/media/ic_settings_arrow.svg b/ui/faceenroll/feature/faceSettingsPad/src/main/resources/base/media/ic_settings_arrow.svg new file mode 100644 index 0000000000000000000000000000000000000000..6aebbe7b504aa070dafcb5df58347bc151f0237e --- /dev/null +++ b/ui/faceenroll/feature/faceSettingsPad/src/main/resources/base/media/ic_settings_arrow.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/ui/faceenroll/feature/faceSettingsPad/src/main/resources/base/media/icon.png b/ui/faceenroll/feature/faceSettingsPad/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ui/faceenroll/feature/faceSettingsPad/src/main/resources/base/media/icon.png differ diff --git a/ui/faceenroll/feature/faceSettingsPad/src/main/resources/en_US/element/string.json b/ui/faceenroll/feature/faceSettingsPad/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f0c1fc2e1c53b7d268908b68c43c9f04e043e057 --- /dev/null +++ b/ui/faceenroll/feature/faceSettingsPad/src/main/resources/en_US/element/string.json @@ -0,0 +1,131 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "ETS_Empty Ability" + }, + { + "name": "face_checker", + "value": "Face Recognition" + }, + + { + "name": "face_unlock_method", + "value": "Unlock device" + }, + { + "name": "face_recognize_slideunlock_title", + "value": "Slide to unlock" + }, + { + "name": "title_apps_security_pref", + "value": "Access App Lock" + }, + { + "name": "title_fill_light", + "value": "Low light compensation" + }, + { + "name": "recommend_preference_title", + "value": "Looking for other settings?" + }, + { + "name": "face_config_light_01_universal", + "value": "Raise to wake" + }, + { + "name": "multiface_list_title", + "value": "Facial profiles" + }, + { + "name": "multiface_default_face_name_1", + "value": "Profile 1" + }, + { + "name": "multiface_default_face_name", + "value": "Profile " + }, + { + "name": "multiface_enroll_new_face", + "value": "Add facial profile" + }, + { + "name": "multiface_face_name_title", + "value": "Name" + }, + { + "name": "multiface_save", + "value": "Save" + }, + { + "name": "face_unlock_method_close", + "value": "Off" + }, + { + "name": "face_recognize_unlock_title", + "value": "Direct unlock" + }, + { + "name": "face_3dguide_info_2", + "value": "Face Recognition verifies your identity based on your facial features. To learn more, see the" + }, + { + "name": "face_guide_2d_announce_link", + "value": "Statement About Face Recognition" + }, + + { + "name": "face_inform_open_applock_msg", + "value": "App Lock is not enabled. Enable now?" + }, + { + "name": "face_record_cancel", + "value": "Cancel" + }, + { + "name": "face_recognize_unlock_summary_3d", + "value": "Unlock directly after successful facial recognition." + }, + { + "name": "face_recognize_slideunlock_summary_3d", + "value": "Slide to unlock after successful facial recognition." + }, + + { + "name": "face_introdution_title", + "value": "Require trusted device" + }, + { + "name": "face_enterance_off", + "value": "Off" + }, + { + "name": "face_fingerprint_settings_switch_title", + "value": "Autofill usernames and passwords" + }, + { + "name": "face_fingerprint_settings_switch_summary", + "value": "Usernames and passwords are accessed from Password Vault." + }, + { + "name": "face_recognition_is_used", + "value": "人脸识别用于" + }, + { + "name": "delete_face", + "value": "删除面容" + }, + { + "name": "enable", + "value": "启用" + }, + { + "name": "activate_app_lock", + "value": "启用应用锁" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/feature/faceSettingsPad/src/main/resources/zh_CN/element/string.json b/ui/faceenroll/feature/faceSettingsPad/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ed637ac0ef9166a2df6ced8e61d1389d41898bf4 --- /dev/null +++ b/ui/faceenroll/feature/faceSettingsPad/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,129 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "ETS_Empty Ability" + }, + { + "name": "face_checker", + "value": "人脸识别" + }, + + { + "name": "face_unlock_method", + "value": "解锁屏幕" + }, + { + "name": "face_recognize_slideunlock_title", + "value": "滑动解锁" + }, + { + "name": "title_apps_security_pref", + "value": "访问应用锁" + }, + { + "name": "title_fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "recommend_preference_title", + "value": "是否在寻找其他设置项?" + }, + { + "name": "face_config_light_01_universal", + "value": "拿起手机亮屏" + }, + { + "name": "multiface_list_title", + "value": "面部列表" + }, + { + "name": "multiface_default_face_name_1", + "value": "面部 1" + }, + { + "name": "multiface_default_face_name", + "value": "面部" + }, + { + "name": "multiface_enroll_new_face", + "value": "新建面部数据" + }, + { + "name": "multiface_face_name_title", + "value": "面部名称" + }, + { + "name": "delete_face", + "value": "删除面部" + }, + { + "name": "multiface_save", + "value": "保存" + }, + { + "name": "face_unlock_method_close", + "value": "关闭" + }, + { + "name": "face_recognize_unlock_title", + "value": "直接解锁" + }, + { + "name": "face_3dguide_info_2", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + { + "name": "face_guide_2d_announce_link", + "value": "关于人脸识别的声明。" + }, + { + "name": "activate_app_lock", + "value": "启用应用锁" + }, + { + "name": "face_inform_open_applock_msg", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启用应用锁?" + }, + { + "name": "face_record_cancel", + "value": "取消" + }, + { + "name": "enable", + "value": "启用" + }, + { + "name": "face_recognize_unlock_summary_3d", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "face_recognize_slideunlock_summary_3d", + "value": "人脸识别成功后,滑动屏幕解锁" + }, + { + "name": "face_recognition_is_used", + "value": "人脸识别用于" + }, + { + "name": "face_introdution_title", + "value": "解锁时需连接可信设备" + }, + { + "name": "face_enterance_off", + "value": "已关闭" + }, + { + "name": "face_fingerprint_settings_switch_title", + "value": "自动填充账号和密码" + }, + { + "name": "face_fingerprint_settings_switch_summary", + "value": "使用密码保险箱保存的帐号和密码" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/feature/trustedDevice/build.gradle b/ui/faceenroll/feature/trustedDevice/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..9c61acd41924b5720e5b559e79b5f46c27c4f69e --- /dev/null +++ b/ui/faceenroll/feature/trustedDevice/build.gradle @@ -0,0 +1,19 @@ +apply plugin: 'com.huawei.ohos.library' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 7 + defaultConfig { + compatibleSdkVersion 7 + } + arkEnabled false + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } +} +dependencies { +} diff --git a/ui/faceenroll/feature/trustedDevice/src/main/config.json b/ui/faceenroll/feature/trustedDevice/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..484b6c8fc721abf96073cb2b1c7259eed6967b26 --- /dev/null +++ b/ui/faceenroll/feature/trustedDevice/src/main/config.json @@ -0,0 +1,22 @@ +{ + "app": { + "bundleName": "com.ohos.faceEnroll", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.faceEnroll", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "trustedDevice", + "moduleType": "har" + } + } +} \ No newline at end of file diff --git a/ui/faceenroll/feature/trustedDevice/src/main/ets/default/common/DefaultConstants.ets b/ui/faceenroll/feature/trustedDevice/src/main/ets/default/common/DefaultConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f07eacf449a21c7e5bd5d647e95a069ae777dc7 --- /dev/null +++ b/ui/faceenroll/feature/trustedDevice/src/main/ets/default/common/DefaultConstants.ets @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default class StyleConstants { + public static MAX_WIDTH: string = '100%'; + public static MAX_HEIGHT: string = '100%'; + public static ITEM_WIDTH: string = '93%'; + public static BACK_WIDTH: string = '15%'; + public static TITLE_TEXT_WIDTH: string = '60%'; + public static TITLE_HEIGHT: string = '10%'; + public static PHONE_WIDTH: string = '33%'; + public static PHONE_HEIGHT: string = '30%'; + public static LIST_TEXT_HEIGHT: string = '50%'; + public static INTO_ARROW_WIDTH: string = '5%'; + public static INTO_ARROW_HEIGHT: number = 50; + public static CONTENT_TIPS_WIDTH: string = '85%'; + public static CONTENT_TIPS_HEIGHT: number = 84 ; + public static PADDING: number = 18; + public static PADDING_30: number = 30; + public static PADDING_4: number = 4; + public static UNLOCK_TEXT_WIDTH: string = '75%'; + public static UNLOCK_TEXT_HEIGHT: number = 84; + public static ITEM_BORDER_RADIO: number = 30; + public static TRUSTED_TEXT_HEIGHT: number = 50; + public static TRUSTED_TEXT_MARGIN_LEFT: number = 30; + public static TRUSTED_TEXT_MARGIN_TOP: number = 32 ; + public static TRUSTED_TEXT_MARGIN_BOTTOM: number = 18; + public static LIST_ITEM_MARGIN_BOTTOM: number = 18 ; + public static LIST_ITEM_MARGIN_TOP: number = 18; + public static LIST_ITEM_MARGIN_LEFT: number = 18; + public static ADD_TEXT_HEIGHT: number = 88; + public static ADD_TEXT_MARGIN_BOTTOM: number = 10; + public static ADD_TEXT_MARGIN_TOP: number = 10; + public static ADD_TEXT_MARGIN_LEFT: number = 25; + public static LIST_ITEM_HEIGHT: number = 100; + public static LIST_SPACE: number = 10; + public static SCROLLBAR_WIDTH: number = 0; + public static BACK_PADDING: number = 15; + public static PHONE_MARGIN_TOP: number = 30; + public static PHONE_MARGIN_BOTTOM: number = 15; + public static DIALOG_TITLE_HEIGHT: number = 65; + public static DIALOG_TITLE_MARGIN_BOTTOM: number = 30; + public static DIALOG_TITLE_MARGIN_TOP: number = 25; + public static DIALOG_TEXT_MARGIN_BOTTOM: number = 20; + public static DIALOG_OPTION_TEXT_HEIGHT: number = 55; + public static DIALOG_OPTION_MARGIN: number = 15; + public static DIALOG_DRIVER_HEIGHT: number = 30; + public static DIALOG_DRIVER_STROKE_WIDTH: number = 2; + public static DIALOG_LIST_MARGIN: number = 10; + public static DIALOG_ADD_TIPS_HEIGHT: number = 150; + public static DIALOG_IS_ADD_HEIGHT: number = 50; + public static REMOVE_DIALOG_HEIGHT: number = 250; + public static USER_TIPS_DIALOG_HEIGHT: number = 350; + public static ADD_DIALOG_HEIGHT: number = 410; + public static WHITE_BACKGROUND_COLOR: string = '#FFFFFF'; + public static GREY_BACKGROUND_COLOR: string = '#F2F3F5'; + public static DARK_GREY_BACKGROUND_COLOR: string = '#E5E6E8'; + public static DARK_GREY_FONT_COLOR: string = '#5B5C5E'; + public static GREY_FONT_COLOR: string = '#808080'; + public static BLUE_FONT_COLOR: string = '#0A58F6'; + public static RED_FONT_COLOR: string = '#FF4500'; + public static RED_BACKGROUND_COLOR: string = '#F0E9E9'; + public static BLACK_FONT_COLOR: string = "#000000"; + public static MIN_FONT_SIZE: number = 20; + public static TITLE_FONT_SIZE: number = 30; + public static TEXT_FONT_SIZE: number = 23; + public static OPTION_FONT_SIZE: number = 25; +} diff --git a/ui/faceenroll/feature/trustedDevice/src/main/ets/default/pages/index.ets b/ui/faceenroll/feature/trustedDevice/src/main/ets/default/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..5924af873532cd714b10aafd7349847329896166 --- /dev/null +++ b/ui/faceenroll/feature/trustedDevice/src/main/ets/default/pages/index.ets @@ -0,0 +1,431 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import trustedModel from "../../../../../../../common/src/main/ets/default/common/model/DeviceModel"; +import userAuthModel from "../../../../../../../common/src/main/ets/default/common/model/userAuthModel"; +import constants from "../common/DefaultConstants.ets"; +import router from '@system.router'; + +@CustomDialog +struct useTipDialog { + controller: CustomDialogController; + cancel: () => void; + confirm: () => void; + + + build() { + Column() { + Text($r('app.string.using_tips')) + .fontSize(constants.TITLE_FONT_SIZE) + .margin({ bottom: constants.DIALOG_TITLE_MARGIN_BOTTOM }) + Text($r('app.string.add_device_tip')) + .fontSize(constants.TEXT_FONT_SIZE) + .margin({ bottom: constants.DIALOG_TEXT_MARGIN_BOTTOM }) + Text($r("app.string.add_device_or_not_tip")) + .fontSize(constants.TEXT_FONT_SIZE) + .margin({ bottom: constants.DIALOG_TEXT_MARGIN_BOTTOM }) + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Text($r('app.string.cancel_button')) + .fontColor(Color.Blue) + .fontSize(constants.OPTION_FONT_SIZE) + .onClick(() => { + this.controller.close(); + this.cancel(); + }) + Divider() + .vertical(true) + .strokeWidth(constants.DIALOG_DRIVER_STROKE_WIDTH) + .color(constants.GREY_BACKGROUND_COLOR) + .height(constants.DIALOG_DRIVER_HEIGHT) + Text($r('app.string.add_device_button')) + .fontColor(Color.Blue) + .fontSize(constants.OPTION_FONT_SIZE) + .onClick(() => { + this.controller.close(); + this.confirm(); + }) + } + } + .width(constants.ITEM_WIDTH) + .borderRadius(constants.ITEM_BORDER_RADIO) + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .alignItems(HorizontalAlign.Start) + .padding({ + bottom: constants.PADDING_30, + top: constants.DIALOG_TITLE_MARGIN_TOP, + left: constants.PADDING_30, + right: constants.PADDING_30 + }) + } +} + +@CustomDialog +struct addDeviceDialog { + private trustedDeviceModel: trustedModel; + useTipDialogController: CustomDialogController = new CustomDialogController({ + builder: useTipDialog({ confirm: this.isAddDevice.bind(this) }), + autoCancel: false, + alignment: DialogAlignment.Bottom + }) + @State addDeviceList: [{ + name: string, + isLock: boolean + }]= [{ name: 'test', isLock: true }]; + @Link addDevice: { + name: string, + isLock: boolean + } + private selectDevice; + controller: CustomDialogController; + confirm: () => void; + + aboutToAppear() { + this.trustedDeviceModel = trustedModel.getInstance(); + this.trustedDeviceModel.getAddDeviceList(this.getAddDeviceList.bind(this)); + } + + isAddDevice() { + this.addDevice = this.selectDevice; + this.confirm(); + } + + getAddDeviceList(addList) { + this.addDeviceList = addList; + + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text($r("app.string.face_introdution_button")) + .fontSize(constants.TITLE_FONT_SIZE) + .textAlign(TextAlign.Start) + .width(constants.ITEM_WIDTH) + .margin({ bottom: constants.DIALOG_TEXT_MARGIN_BOTTOM }) + + + List() { + ForEach(this.addDeviceList, (item) => { + ListItem() { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) { + Text(item.name) + .fontSize(constants.TEXT_FONT_SIZE) + .fontColor(item.isLock ? constants.BLACK_FONT_COLOR : constants.GREY_FONT_COLOR) + .margin({ bottom: constants.PADDING_4 }) + Text(item.isLock ? $r("app.string.connect_tip") : $r("app.string.disconnect_tip")) + .fontColor(item.isLock ? constants.BLACK_FONT_COLOR : constants.GREY_FONT_COLOR) + .fontSize(constants.MIN_FONT_SIZE) + } + + Image($r("app.media.into_arrow")) + .width(constants.INTO_ARROW_WIDTH) + .objectFit(ImageFit.Contain) + } + .height(constants.CONTENT_TIPS_HEIGHT) + + }.editable(false) + .onClick(() => { + if (item.isLock) { + this.selectDevice = item; + this.controller.close(); + this.useTipDialogController.open(); + } + }) + }) + } + .width(constants.ITEM_WIDTH) + .divider({ color: constants.GREY_BACKGROUND_COLOR, strokeWidth: constants.DIALOG_DRIVER_STROKE_WIDTH }) + } + .margin({ top: constants.DIALOG_TITLE_MARGIN_TOP, left: constants.PADDING_30, right: constants.PADDING_30 }) + .constraintSize({ maxHeight: constants.ADD_DIALOG_HEIGHT }) + } +} + + +@CustomDialog +struct removeDeviceDialog { + controller: CustomDialogController; + cancel: () => void; + confirm: () => void; +//@Prop device:string + + build() { + Column() { + Text($r('app.string.remove_device_title')) + .fontSize(constants.TITLE_FONT_SIZE) + .margin({ bottom: constants.DIALOG_TITLE_MARGIN_BOTTOM }) + Text($r('app.string.remove_device_tip')) + .fontSize(constants.TEXT_FONT_SIZE) + .margin({ bottom: constants.DIALOG_TEXT_MARGIN_BOTTOM }) + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Text($r('app.string.cancel_button')) + .fontColor(Color.Blue) + .fontSize(constants.OPTION_FONT_SIZE) + .onClick(() => { + this.controller.close(); + this.cancel(); + }) + Divider() + .vertical(true) + .strokeWidth(constants.DIALOG_DRIVER_STROKE_WIDTH) + .color(constants.GREY_BACKGROUND_COLOR) + .height(constants.DIALOG_DRIVER_HEIGHT) + Text($r('app.string.remove_device_button')) + .fontColor(Color.Red) + .fontSize(constants.OPTION_FONT_SIZE) + .onClick(() => { + this.controller.close(); + this.confirm(); + }) + } + } + .width(constants.ITEM_WIDTH) + .borderRadius(constants.ITEM_BORDER_RADIO) + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .alignItems(HorizontalAlign.Start) + .padding({ + bottom: constants.PADDING_30, + top: constants.DIALOG_TITLE_MARGIN_TOP, + left: constants.PADDING_30, + right: constants.PADDING_30 + }) + } +} + +@Component +export default struct trustedDevice { + private trustedDeviceModel: trustedModel; + private userAuthModel: userAuthModel; + @State isUpdate: boolean = false; + @State ifCallback: boolean = false; + Scroll: Scroller = new Scroller(); + @State isCheck: boolean = false; + @State isBlueTooth: boolean = true; + @State deviceList: [{ + name: string, + isLock: boolean + }]= [{ name: 'test', isLock: true }]; + @StorageLink('deviceListLength') deviceListLength: number = 1; + @State addDevice: { + name: string, + isLock: boolean + } = { name: "", isLock: true } + delDevice: { + name: string, + isLock: boolean + } = { name: "", isLock: true } + + removeDeviceDialogController: CustomDialogController = new CustomDialogController({ + builder: removeDeviceDialog({ cancel: this.onCancel, confirm: this.removeDevice.bind(this) }), + cancel: this.onCancel, + autoCancel: false, + alignment: DialogAlignment.Bottom + }) + + addDeviceDialogController: CustomDialogController = new CustomDialogController({ + builder: addDeviceDialog({ addDevice: $addDevice, confirm: this.isAddDevice.bind(this) }), + cancel: this.onCancel, + autoCancel: true, + alignment: DialogAlignment.Bottom + }) + + aboutToAppear() { + this.trustedDeviceModel = trustedModel.getInstance(); + this.userAuthModel = userAuthModel.getInstance(); + this.userAuthModel.getIsCheck(this.getIsCheck.bind(this)); + } + + getIsCheck(isCheck) { + this.isCheck = isCheck + } + + getDeviceList(deviceList) { + this.deviceList = deviceList; + this.ifCallback = true; + AppStorage.SetOrCreate('deviceListLength', deviceList.length); + } + + onCancel() { + } + + isAddDevice() { + this.deviceList.push(this.addDevice); + AppStorage.SetOrCreate("deviceListLength", this.deviceList.length); + this.trustedDeviceModel.addDevice(this.addDevice); + } + + removeDevice() { + let index = this.deviceList.indexOf(this.delDevice); + this.deviceList.splice(index, index + 1); + AppStorage.SetOrCreate("deviceListLength", this.deviceList.length); + this.trustedDeviceModel.removeDevice(this.delDevice); + if (this.deviceListLength == 0) { + this.isCheck = false; + } + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { + Scroll(this.Scroll) { + Column() { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { + Image($r("app.media.back")) + .width(constants.BACK_WIDTH) + .height(constants.MAX_HEIGHT) + .padding({ left: constants.BACK_PADDING, right: constants.BACK_PADDING }) + .onClick(() => { + router.push({ + uri: 'pages/entryView' + }) + }) + Text($r("app.string.face_introdution_title")) + .fontSize(constants.TEXT_FONT_SIZE) + .width(constants.TITLE_TEXT_WIDTH) + } + .width(constants.ITEM_WIDTH) + .height(constants.TITLE_HEIGHT) + + Image($r("app.media.phone")) + .width(constants.PHONE_WIDTH) + .height(constants.PHONE_HEIGHT) + .objectFit(ImageFit.Contain) + .margin({ top: constants.PHONE_MARGIN_TOP, bottom: constants.PHONE_MARGIN_BOTTOM }) + + Text($r("app.string.face_introdution_tip")) + .width(constants.CONTENT_TIPS_WIDTH) + .height(constants.CONTENT_TIPS_HEIGHT) + .fontSize(constants.MIN_FONT_SIZE) + .fontColor(constants.GREY_FONT_COLOR) + .textAlign(TextAlign.Center) + .margin({ + top: constants.ADD_TEXT_MARGIN_TOP, + bottom: constants.ADD_TEXT_MARGIN_TOP, + }) + Flex({ + direction: FlexDirection.Row, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.SpaceBetween + }) { + Text($r("app.string.face_introdution_title")) + + .fontSize(constants.TEXT_FONT_SIZE) + Toggle({ type: ToggleType.Switch, isOn: this.isCheck }) + .onChange((isOn: boolean) => { + this.trustedDeviceModel.getDeviceList(this.getDeviceList.bind(this)); + this.isCheck = !this.isCheck; + }) + } + .borderRadius(constants.ITEM_BORDER_RADIO) + .width(constants.ITEM_WIDTH) + .height(constants.CONTENT_TIPS_HEIGHT) + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .padding({ left: constants.PADDING, right: constants.PADDING }) + + + if (this.isCheck) { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text($r("app.string.trusted_devices_title")) + .padding({ left: constants.PADDING, right: constants.PADDING }) + .width(constants.MAX_WIDTH) + .fontSize(constants.MIN_FONT_SIZE) + .fontColor(constants.GREY_FONT_COLOR) + .textAlign(TextAlign.Start) + .margin({ + top: constants.TRUSTED_TEXT_MARGIN_TOP, + bottom: constants.TRUSTED_TEXT_MARGIN_BOTTOM, + }) + if (this.ifCallback) { + List({ space: constants.LIST_SPACE }) { + ForEach(this.deviceList, (item, index) => { + + ListItem() { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text(item.name) + .width(constants.MAX_WIDTH) + .fontSize(constants.TEXT_FONT_SIZE) + .height(constants.LIST_TEXT_HEIGHT) + .textAlign(TextAlign.Start) + Text(item.isLock ? $r("app.string.connect_tip") : $r("app.string.disconnect_tip")) + .width(constants.MAX_WIDTH) + .fontSize(constants.MIN_FONT_SIZE) + .height(constants.LIST_TEXT_HEIGHT) + .fontColor(constants.GREY_FONT_COLOR) + .textAlign(TextAlign.Start) + } + .width(constants.ITEM_WIDTH) + .height(constants.MAX_HEIGHT) + + Image($r("app.media.into_arrow")) + .width(constants.INTO_ARROW_WIDTH) + .height(constants.INTO_ARROW_HEIGHT) + .objectFit(ImageFit.Contain) + } + .onClick(() => { + this.delDevice = item + this.removeDeviceDialogController.open() + }) + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .padding({ + top: constants.LIST_ITEM_MARGIN_TOP, + bottom: constants.LIST_ITEM_MARGIN_BOTTOM, + left: constants.LIST_ITEM_MARGIN_LEFT, + right: constants.LIST_ITEM_MARGIN_LEFT + }) + .borderRadius(constants.ITEM_BORDER_RADIO) + .width(constants.MAX_WIDTH) + .height(constants.LIST_ITEM_HEIGHT) + }.editable(false) + .width(constants.MAX_WIDTH) + }) + } + .width(constants.ITEM_WIDTH) + .listDirection(Axis.Vertical) + .editMode(false) + .edgeEffect(EdgeEffect.Spring) + } + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { + Text($r("app.string.face_introdution_button")) + .fontSize(constants.TEXT_FONT_SIZE) + .fontColor(constants.BLUE_FONT_COLOR) + .onClick(() => { + this.addDeviceDialogController.open() + }) + .height(constants.LIST_ITEM_HEIGHT) + } + .margin({ + top: constants.ADD_TEXT_MARGIN_TOP, + bottom: constants.ADD_TEXT_MARGIN_BOTTOM, + }) + .padding({ left: constants.PADDING, right: constants.PADDING }) + .borderRadius(constants.ITEM_BORDER_RADIO) + .width(constants.ITEM_WIDTH) + .height(constants.UNLOCK_TEXT_HEIGHT) + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + } + .width(constants.MAX_WIDTH) + } + } + } + .scrollBarWidth(constants.SCROLLBAR_WIDTH) + } + .width(constants.MAX_WIDTH) + .height(constants.MAX_HEIGHT) + .backgroundColor(constants.GREY_BACKGROUND_COLOR) + } +} + + + + diff --git a/ui/faceenroll/feature/trustedDevice/src/main/resources/base/element/string.json b/ui/faceenroll/feature/trustedDevice/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8b0287bc3eeca219570a01e0402fc37d40c2377c --- /dev/null +++ b/ui/faceenroll/feature/trustedDevice/src/main/resources/base/element/string.json @@ -0,0 +1,76 @@ +{ + "string": [ + { + "name": "face_introdution_title", + "value": "解锁时需连接可信设备" + }, + { + "name": "face_introdution_tip", + "value": "进行人脸识别解锁手机时,需连接可信设备以进一步提升安全性。" + }, + { + "name": "trusted_devices_title", + "value": "可信设备" + }, + { + "name": "face_introdution_button", + "value": "添加可信设备" + }, + { + "name": "connect_tip", + "value": "已连接" + }, + { + "name": "disconnect_tip", + "value": "未连接" + }, + { + "name": "cancel_button", + "value": "取消" + }, + { + "name": "remove_device_button", + "value": "移除" + }, + { + "name": "add_device_button", + "value": "添加" + }, + { + "name": "remove_device_tip", + "value": "移除后,人脸识别解锁本机时将不再需要连接可信设备。是否移除?" + }, + { + "name": "remove_device_title", + "value": "移除可信设备" + }, + { + "name": "add_device_or_not_tip", + "value": "是否添加" + }, + { + "name": "using_tips", + "value": "使用提示" + }, + { + "name": "add_device_tip", + "value": "添加后,当可信设备与本机断开连接时,将无法使用人脸识别解锁。您可以使用其他方式解锁。" + }, + { + "name": "open_bluetooth", + "value": "使用此功能需先开启蓝牙,点击设置" + }, + { + "name": "no_available_devices_title", + "value": "没有可添加的设备" + }, + { + "name": "no_available_devices_tip", + "value": "没有检测到可添加的配对设备。是否前往蓝牙设置配对?" + }, + { + "name": "pair_button", + "value": "去配对" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/feature/trustedDevice/src/main/resources/base/media/back.png b/ui/faceenroll/feature/trustedDevice/src/main/resources/base/media/back.png new file mode 100644 index 0000000000000000000000000000000000000000..85dcc6ad6895ff1b4ef599be169e0df24a7b01b5 Binary files /dev/null and b/ui/faceenroll/feature/trustedDevice/src/main/resources/base/media/back.png differ diff --git a/ui/faceenroll/feature/trustedDevice/src/main/resources/base/media/into_arrow.svg b/ui/faceenroll/feature/trustedDevice/src/main/resources/base/media/into_arrow.svg new file mode 100644 index 0000000000000000000000000000000000000000..d20cc39c31fe2f8bd414a84c678decd8383ac086 --- /dev/null +++ b/ui/faceenroll/feature/trustedDevice/src/main/resources/base/media/into_arrow.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui/faceenroll/feature/trustedDevice/src/main/resources/base/media/phone.svg b/ui/faceenroll/feature/trustedDevice/src/main/resources/base/media/phone.svg new file mode 100644 index 0000000000000000000000000000000000000000..b81e4e3637a98a33576cb875acb1fa9721b02e67 --- /dev/null +++ b/ui/faceenroll/feature/trustedDevice/src/main/resources/base/media/phone.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui/faceenroll/feature/trustedDevice/src/main/resources/en_US/element/string.json b/ui/faceenroll/feature/trustedDevice/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..5c7ef3508e55e97bacd850a7de86494ebc7d2894 --- /dev/null +++ b/ui/faceenroll/feature/trustedDevice/src/main/resources/en_US/element/string.json @@ -0,0 +1,77 @@ +{ + "string": [ + { + "name": "face_introdution_title", + "value": "Require trusted device" + }, + { + "name": "face_introdution_tip", + "value": "Add an extra layer of security by only allowing this device to be unlocked with facial recognition when a trusted device is connected." + }, + { + "name": "trusted_devices_title", + "value": "Trusted devices" + }, + { + "name": "face_introdution_button", + "value": "Add trusted device" + }, + { + "name": "connect_tip", + "value": "Connected" + }, + { + "name": "disconnect_tip", + "value": "Not connected" + }, + { + "name": "cancel_button", + "value": "Cancel" + }, + { + "name": "remove_device_button", + "value": "Remove" + }, + { + "name": "add_device_button", + "value": "Add" + }, + { + "name": "remove_device_tip", + "value": "Once removed, a trusted device will no longer be required to unlock this device with facial recognition." + }, + { + "name": "remove_device_title", + "value": "Remove trusted device" + }, + { + "name": "add_device_or_not_tip", + "value": "Add trusted device?" + }, + { + "name": "using_tips", + "value": "Note" + }, + { + "name": "add_device_tip", + "value": "You will only be able to unlock this device with facial recognition when a trusted device is connected over Bluetooth. Other unlock methods will not be affected." + }, + { + "name": "open_bluetooth", + "value": "Bluetooth must be enabled. Touch to enable" + }, + { + "name": "no_available_devices_title", + "value": "No available devices" + }, + { + "name": "no_available_devices_tip", + "value": "No paired devices found. Pair one now?" + }, + { + "name": "pair_button", + "value": "Go pair" + } + + ] +} \ No newline at end of file diff --git a/ui/faceenroll/feature/trustedDevice/src/main/resources/zh_CN/element/string.json b/ui/faceenroll/feature/trustedDevice/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8b0287bc3eeca219570a01e0402fc37d40c2377c --- /dev/null +++ b/ui/faceenroll/feature/trustedDevice/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,76 @@ +{ + "string": [ + { + "name": "face_introdution_title", + "value": "解锁时需连接可信设备" + }, + { + "name": "face_introdution_tip", + "value": "进行人脸识别解锁手机时,需连接可信设备以进一步提升安全性。" + }, + { + "name": "trusted_devices_title", + "value": "可信设备" + }, + { + "name": "face_introdution_button", + "value": "添加可信设备" + }, + { + "name": "connect_tip", + "value": "已连接" + }, + { + "name": "disconnect_tip", + "value": "未连接" + }, + { + "name": "cancel_button", + "value": "取消" + }, + { + "name": "remove_device_button", + "value": "移除" + }, + { + "name": "add_device_button", + "value": "添加" + }, + { + "name": "remove_device_tip", + "value": "移除后,人脸识别解锁本机时将不再需要连接可信设备。是否移除?" + }, + { + "name": "remove_device_title", + "value": "移除可信设备" + }, + { + "name": "add_device_or_not_tip", + "value": "是否添加" + }, + { + "name": "using_tips", + "value": "使用提示" + }, + { + "name": "add_device_tip", + "value": "添加后,当可信设备与本机断开连接时,将无法使用人脸识别解锁。您可以使用其他方式解锁。" + }, + { + "name": "open_bluetooth", + "value": "使用此功能需先开启蓝牙,点击设置" + }, + { + "name": "no_available_devices_title", + "value": "没有可添加的设备" + }, + { + "name": "no_available_devices_tip", + "value": "没有检测到可添加的配对设备。是否前往蓝牙设置配对?" + }, + { + "name": "pair_button", + "value": "去配对" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/feature/trusteddevicepad/build.gradle b/ui/faceenroll/feature/trusteddevicepad/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..00fb1aac97808e8d219c47e8ad6fd2112a188929 --- /dev/null +++ b/ui/faceenroll/feature/trusteddevicepad/build.gradle @@ -0,0 +1,24 @@ +apply plugin: 'com.huawei.ohos.hap' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 7 + defaultConfig { + compatibleSdkVersion 7 + } + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + entryModules "phone,pad" +} + +dependencies { + entryImplementation project(':phone') + entryImplementation project(':pad') + implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) + testImplementation 'junit:junit:4.13.1' +} diff --git a/ui/faceenroll/feature/trusteddevicepad/src/main/config.json b/ui/faceenroll/feature/trusteddevicepad/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..12cfb7e93c81e9964a8714fde11af1a4b72ccb40 --- /dev/null +++ b/ui/faceenroll/feature/trusteddevicepad/src/main/config.json @@ -0,0 +1,22 @@ +{ + "app": { + "bundleName": "com.ohos.faceEnroll", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.faceEnroll", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "trustedDevicePad", + "moduleType": "har" + } + } +} \ No newline at end of file diff --git a/ui/faceenroll/feature/trusteddevicepad/src/main/ets/default/common/DefaultConstants.ets b/ui/faceenroll/feature/trusteddevicepad/src/main/ets/default/common/DefaultConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0f166c6a04431c6f307be0c7c4ac5e291e467e7 --- /dev/null +++ b/ui/faceenroll/feature/trusteddevicepad/src/main/ets/default/common/DefaultConstants.ets @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default class StyleConstants { + public static MAX_WIDTH: string = '100%'; + public static MAX_HEIGHT: string = '100%'; + public static ITEM_WIDTH: string = '93%'; + public static BACK_WIDTH: number = 30; + public static BACK_HEIGHT: number = 60; + public static PADDING_30: number = 30; + public static TITLE_TEXT_WIDTH: string = '60%'; + public static TITLE_HEIGHT: number = 70; + public static PADDING: number = 14; + public static PHONE_WIDTH: string = '50%'; + public static PHONE_HEIGHT: string = '30%'; + public static LIST_TEXT_HEIGHT: string = '50%'; + public static SMALL_INFO_ARROW_WIDTH: number = 15; + public static INTO_ARROW_WIDTH: number = 25; + public static INTO_ARROW_HEIGHT: number = 35; + public static CONTENT_TIPS_HEIGHT: number = 68; + public static ITEM_BORDER_RADIO: number = 20; + public static TRUSTED_TEXT_HEIGHT: number = 50; + public static TRUSTED_TEXT_MARGIN_LEFT: number = 30; + public static TRUSTED_TEXT_MARGIN_TOP: number = 25; + public static TRUSTED_TEXT_MARGIN_BOTTOM: number = 10; + public static LIST_ITEM_MARGIN_BOTTOM: number = 20; + public static LIST_ITEM_MARGIN_TOP: number = 20; + public static LIST_ITEM_MARGIN_LEFT: number = 25; + public static ADD_TEXT_HEIGHT: number = 88; + public static ADD_TEXT_MARGIN_BOTTOM: number = 10; + public static ADD_TEXT_MARGIN_TOP: number = 10; + public static ADD_TEXT_MARGIN_LEFT: number = 25; + public static LIST_ITEM_HEIGHT: number = 70; + public static LIST_ITEM_HEIGHT_: number = 68; + public static LIST_SPACE: number = 10; + public static SCROLLBAR_WIDTH: number = 0; + public static BACK_PADDING: number = 15; + public static PHONE_MARGIN_TOP: number = 10; + public static PHONE_MARGIN_BOTTOM: number = 10; + public static TEXT_MARGIN_TOP: number = 6; + public static TEXT_MARGIN_BOTTOM: number = 6; + + public static DIALOG_OPTION_TEXT_HEIGHT: number = 55; + public static DIALOG_OPTION_MARGIN: number = 15; + public static DIALOG_DRIVER_HEIGHT: number = 30; + public static DIALOG_DRIVER_STROKE_WIDTH: number = 1; + public static DIALOG_LIST_MARGIN: number = 10; + public static DIALOG_ADD_TIPS_HEIGHT: number = 150; + public static DIALOG_IS_ADD_HEIGHT: number = 50; + public static REMOVE_DIALOG_HEIGHT: number = 250; + public static USER_TIPS_DIALOG_HEIGHT: number = 350; + public static WHITE_BACKGROUND_COLOR: string = '#FFFFFF'; + public static GREY_BACKGROUND_COLOR: string = '#F2F3F5'; + public static DARK_GREY_BACKGROUND_COLOR: string = '#E5E6E8'; + public static DARK_GREY_FONT_COLOR: string = '#5B5C5E'; + public static GREY_FONT_COLOR: string = '#808080'; + public static LIGHT_GREY_FONT_COLOR: string = '#A1A1A1'; + public static LIGHT_GREY_FONT_COLOR2: string = '#CBCBCB'; + public static BLUE_FONT_COLOR: string = '#0A58F6'; + public static RED_FONT_COLOR: string = '#FF4500'; + public static BLACK_FONT_COLOR: string = "#000000"; + public static TOGGLE_SIZE: number = 40; + public static MIN_FONT_SIZE: number = 18; + public static TEXT_FONT_SIZE: number = 19; + public static OPTION_FONT_SIZE: number = 22; + public static DIALOG_WIDTH: number = 440; + public static DIALOG_PADDING: number = 24; + public static DIALOG_TITLE_TOP: number = 20; + public static DIALOG_TITLE_BOTTOM: number = 25; + public static DIALOG_TITLE_HEIGHT: number = 40; + public static DIALOG_TITLE_MARGIN_TOP: number = 10; + public static DIALOG_TITLE_MARGIN_BOTTOM: number = 10; + public static DIALOG_TEXT_BOTTOM: number = 16; + public static DIALOG_BUTTON_WIDTH: number = 196; + public static DIALOG_BUTTON_HEIGHT: number = 45; + public static PADDING_4: number = 4; +} diff --git a/ui/faceenroll/feature/trusteddevicepad/src/main/ets/default/pages/index.ets b/ui/faceenroll/feature/trusteddevicepad/src/main/ets/default/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d1677ea7f2822df6c21c56b057d23141049cd33 --- /dev/null +++ b/ui/faceenroll/feature/trusteddevicepad/src/main/ets/default/pages/index.ets @@ -0,0 +1,436 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import trustedModel from "../../../../../../../common/src/main/ets/default/common/model/DeviceModel"; +import userAuthModel from "../../../../../../../common/src/main/ets/default/common/model/userAuthModel"; +import constants from "../common/DefaultConstants.ets"; +import router from '@system.router'; + +@CustomDialog +struct useTipDialog { + controller: CustomDialogController; + cancel: () => void; + confirm: () => void; + + build() { + Column() { + Text($r('app.string.using_tips')) + .fontSize(constants.OPTION_FONT_SIZE) + .margin({ bottom: constants.DIALOG_TITLE_BOTTOM }) + Text($r('app.string.add_device_tip')) + .fontSize(constants.TEXT_FONT_SIZE) + .margin({ bottom: constants.DIALOG_TITLE_TOP }) + Text($r("app.string.add_device_or_not_tip")) + .fontSize(constants.TEXT_FONT_SIZE) + .margin({ bottom: constants.DIALOG_TEXT_BOTTOM }) + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Button() { + Text($r('app.string.cancel_button')) + .fontColor(constants.BLUE_FONT_COLOR) + .fontSize(constants.TEXT_FONT_SIZE) + } + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .type(ButtonType.Capsule) + .width(constants.DIALOG_BUTTON_WIDTH) + .height(constants.DIALOG_BUTTON_HEIGHT) + .onClick(() => { + this.controller.close() + this.cancel() + }) + + Divider() + .vertical(true) + .strokeWidth(constants.DIALOG_DRIVER_STROKE_WIDTH) + .color(constants.GREY_BACKGROUND_COLOR) + .height(constants.DIALOG_DRIVER_HEIGHT) + Button() { + Text($r('app.string.add_device_button')) + .fontColor(constants.BLUE_FONT_COLOR) + .fontSize(constants.TEXT_FONT_SIZE) + } + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .type(ButtonType.Capsule) + .width(constants.DIALOG_BUTTON_WIDTH) + .height(constants.DIALOG_BUTTON_HEIGHT) + .onClick(() => { + this.controller.close() + this.confirm() + }) + } + } + // .width(constants.DIALOG_WIDTH) + .width(constants.MAX_WIDTH) + .borderRadius(constants.ITEM_BORDER_RADIO) + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .alignItems(HorizontalAlign.Start) + .padding({ + top: constants.DIALOG_TITLE_TOP, + bottom: constants.DIALOG_TITLE_TOP, + left: constants.DIALOG_PADDING, + right: constants.DIALOG_PADDING + }) + } +} + +@CustomDialog +struct addDeviceDialog { + private trustedDeviceModel: trustedModel; + useTipDialogController: CustomDialogController = new CustomDialogController({ + builder: useTipDialog({ confirm: this.isAddDevice.bind(this) }), + autoCancel: false + }) + @State addDeviceList: [{ + name: string, + isLock: boolean + }]= [{ name: 'test', isLock: true }]; + @Link addDevice: { + name: string, + isLock: boolean + } + private selectDevice; + controller: CustomDialogController; + confirm: () => void; + + aboutToAppear() { + this.trustedDeviceModel = trustedModel.getInstance(); + this.trustedDeviceModel.getAddDeviceList(this.getAddDeviceList.bind(this)); + } + + isAddDevice() { + this.addDevice = this.selectDevice; + this.confirm(); + } + + getAddDeviceList(addList) { + this.addDeviceList = addList; + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) { + Text($r("app.string.face_introdution_button")) + .fontSize(constants.OPTION_FONT_SIZE) + .height(constants.DIALOG_TITLE_HEIGHT) + List() { + ForEach(this.addDeviceList, (item) => { + ListItem() { + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) { + Text(item.name) + .fontSize(constants.TEXT_FONT_SIZE) + .fontColor(item.isLock ? constants.BLACK_FONT_COLOR : constants.LIGHT_GREY_FONT_COLOR) + .margin({ bottom: constants.PADDING_4 }) + Text(item.isLock ? $r("app.string.connect_tip") : $r("app.string.disconnect_tip")) + .fontColor(item.isLock ? constants.GREY_FONT_COLOR : constants.LIGHT_GREY_FONT_COLOR2) + .fontSize(constants.MIN_FONT_SIZE) + } + + Image($r("app.media.into_arrow")) + .width(constants.SMALL_INFO_ARROW_WIDTH) + .objectFit(ImageFit.Contain) + } + .height(constants.CONTENT_TIPS_HEIGHT) + }.editable(false) + .width(constants.MAX_WIDTH) + .onClick(() => { + if (item.isLock) { + this.selectDevice = item; + this.controller.close(); + this.useTipDialogController.open(); + } + }) + }) + } + .divider({ color: constants.GREY_BACKGROUND_COLOR, strokeWidth: constants.DIALOG_DRIVER_STROKE_WIDTH }) + } + .width(constants.MAX_WIDTH) + .borderRadius(constants.ITEM_BORDER_RADIO) + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .height(this.addDeviceList.length * constants.LIST_ITEM_HEIGHT_ + constants.DIALOG_TITLE_HEIGHT + 2*constants.DIALOG_TITLE_TOP) + .constraintSize({ maxHeight: 4 * constants.LIST_ITEM_HEIGHT_ + constants.DIALOG_TITLE_HEIGHT + 2*constants.DIALOG_TITLE_TOP }) + .padding({ + bottom: constants.DIALOG_TITLE_TOP, + top: constants.DIALOG_TITLE_TOP, + left: constants.DIALOG_PADDING, + right: constants.DIALOG_PADDING + }) + } +} + + +@CustomDialog +struct removeDeviceDialog { + controller: CustomDialogController + cancel: () => void + confirm: () => void + build() { + Column() { + Text($r('app.string.remove_device_title')) + .fontSize(constants.OPTION_FONT_SIZE) + .margin({ bottom: constants.DIALOG_TITLE_BOTTOM }) + Text($r('app.string.remove_device_tip')) + .fontSize(constants.TEXT_FONT_SIZE) + .margin({ bottom: constants.DIALOG_TEXT_BOTTOM }) + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Button() { + Text($r('app.string.cancel_button')) + .fontColor(constants.BLUE_FONT_COLOR) + .fontSize(constants.TEXT_FONT_SIZE) + } + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .type(ButtonType.Capsule) + .width(constants.DIALOG_BUTTON_WIDTH) + .height(constants.DIALOG_BUTTON_HEIGHT) + .onClick(() => { + this.controller.close() + this.cancel() + }) + + Divider() + .vertical(true) + .strokeWidth(constants.DIALOG_DRIVER_STROKE_WIDTH) + .color(constants.GREY_BACKGROUND_COLOR) + .height(constants.DIALOG_DRIVER_HEIGHT) + Button() { + Text($r('app.string.remove_device_button')) + .fontColor(constants.RED_FONT_COLOR) + .fontSize(constants.TEXT_FONT_SIZE) + } + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .type(ButtonType.Capsule) + .width(constants.DIALOG_BUTTON_WIDTH) + .height(constants.DIALOG_BUTTON_HEIGHT) + .onClick(() => { + this.controller.close() + this.confirm() + }) + } + } + // .width(constants.DIALOG_WIDTH) + .width(constants.MAX_WIDTH) + .borderRadius(constants.ITEM_BORDER_RADIO) + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .alignItems(HorizontalAlign.Start) + .padding({ + top: constants.DIALOG_TITLE_TOP, + bottom: constants.DIALOG_TITLE_TOP, + left: constants.DIALOG_PADDING, + right: constants.DIALOG_PADDING + }) + } +} + +@Component +export default struct trustedDevice { + private trustedDeviceModel: trustedModel; + private userAuthModel: userAuthModel; + @State isUpdate: boolean = false; + Scroll: Scroller = new Scroller(); + @State isCheck: boolean = false; + @State deviceList: [{ + name: string, + isLock: boolean + }]= [{ name: 'test', isLock: true }]; + @State ifCallback: boolean = false; + @StorageLink('deviceListLength') deviceListLength: number = 1; + @State addDevice: { + name: string, + isLock: boolean + } = { name: "", isLock: true }; + delDevice: { + name: string, + isLock: boolean + } = { name: "", isLock: true }; + removeDeviceDialogController: CustomDialogController = new CustomDialogController({ + builder: removeDeviceDialog({ cancel: this.onCancel, confirm: this.removeDevice.bind(this) }), + cancel: this.onCancel, + autoCancel: false, + // customStyle: true + + }) + addDeviceDialogController: CustomDialogController = new CustomDialogController({ + builder: addDeviceDialog({ addDevice: $addDevice, confirm: this.isAddDevice.bind(this) }), + cancel: this.onCancel, + autoCancel: true, + // customStyle: true + }) + + aboutToAppear() { + this.trustedDeviceModel = trustedModel.getInstance(); + this.userAuthModel = userAuthModel.getInstance(); + this.userAuthModel.getIsCheck(this.getIsCheck.bind(this)); + } + + getIsCheck(isCheck) { + this.isCheck = isCheck; + } + + getDeviceList(deviceList) { + this.deviceList = deviceList; + this.ifCallback = true; + AppStorage.SetOrCreate('deviceListLength', deviceList.length); + } + + onCancel() { + } + + isAddDevice() { + this.deviceList.push(this.addDevice); + this.trustedDeviceModel.addDevice(this.addDevice); + } + + removeDevice() { + let index = this.deviceList.indexOf(this.delDevice); + this.deviceList.splice(index, index + 1); + AppStorage.SetOrCreate("deviceListLength", this.deviceList.length); + this.trustedDeviceModel.removeDevice(this.delDevice); + if (this.deviceListLength == 0) { + this.isCheck = false; + } + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { + Scroll(this.Scroll) { + Column() { + Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { + Image($r("app.media.back")) + .width(constants.BACK_WIDTH) + .height(constants.BACK_HEIGHT) + .onClick(() => { + router.push({ + uri: 'pages/entryView' + }) + }) + Text($r("app.string.face_introdution_title")) + .fontSize(constants.OPTION_FONT_SIZE) + .margin({ left: constants.PADDING_30 }) + } + .height(constants.TITLE_HEIGHT) + .padding({ left: constants.PADDING, right: constants.PADDING }) + + Image($r("app.media.pad")) + .width(constants.PHONE_WIDTH) + .height(constants.PHONE_HEIGHT) + .objectFit(ImageFit.Contain) + .margin({ top: constants.PHONE_MARGIN_TOP, bottom: constants.PHONE_MARGIN_BOTTOM }) + + Text($r("app.string.face_introdution_tip")) + .fontSize(constants.MIN_FONT_SIZE) + .fontColor(constants.GREY_FONT_COLOR) + .padding({ left: constants.PADDING, right: constants.PADDING }) + .width(constants.MAX_WIDTH) + .textAlign(TextAlign.Start) + .margin({ top: constants.TEXT_MARGIN_TOP, bottom: constants.TEXT_MARGIN_BOTTOM }) + + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text($r('app.string.face_introdution_title')) + .fontSize(constants.TEXT_FONT_SIZE) + Toggle({ type: ToggleType.Switch, isOn: this.isCheck }) + .width(constants.TOGGLE_SIZE) + .onChange((isOn: boolean) => { + this.trustedDeviceModel.getDeviceList(this.getDeviceList.bind(this)); + this.isCheck = !this.isCheck; + }) + } + .borderRadius(constants.ITEM_BORDER_RADIO) + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .margin({ top: constants.PADDING_30 }) + .padding({ left: constants.PADDING, right: constants.PADDING }) + .height(constants.TITLE_HEIGHT) + + if (this.isCheck) { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text($r("app.string.trusted_devices_title")) + .width(constants.MAX_WIDTH) + .padding({ left: constants.PADDING, right: constants.PADDING }) + .fontSize(constants.MIN_FONT_SIZE) + .fontColor(constants.GREY_FONT_COLOR) + .textAlign(TextAlign.Start) + .margin({ + top: constants.TRUSTED_TEXT_MARGIN_TOP, + bottom: constants.TRUSTED_TEXT_MARGIN_BOTTOM, + }) + if (this.ifCallback) { + List({ space: constants.LIST_SPACE }) { + ForEach(this.deviceList, (item, index) => { + ListItem() { + Flex({ + direction: FlexDirection.Row, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.SpaceBetween, + }) { + Flex({ + direction: FlexDirection.Column, + justifyContent: FlexAlign.Center, + alignItems: ItemAlign.Start + }) { + Text(item.name) + .fontSize(constants.TEXT_FONT_SIZE) + .margin({ bottom: constants.PADDING_4 }) + Text(item.isLock ? $r("app.string.connect_tip") : $r("app.string.disconnect_tip")) + .fontSize(constants.MIN_FONT_SIZE) + .fontColor(constants.GREY_FONT_COLOR) + } + + Image($r("app.media.into_arrow")) + .width(constants.INTO_ARROW_WIDTH) + .height(constants.INTO_ARROW_HEIGHT) + .objectFit(ImageFit.Contain) + } + .padding({ left: constants.PADDING, right: constants.PADDING }) + .onClick(() => { + this.delDevice = item; + this.removeDeviceDialogController.open(); + }) + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .borderRadius(constants.ITEM_BORDER_RADIO) + .height(constants.LIST_ITEM_HEIGHT) + }.editable(false) + }) + } + .width(constants.MAX_WIDTH) + .listDirection(Axis.Vertical) + .editMode(false) + .edgeEffect(EdgeEffect.Spring) + } + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Text($r('app.string.face_introdution_button')) + .fontSize(constants.TEXT_FONT_SIZE) + .fontColor(constants.BLUE_FONT_COLOR) + } + .borderRadius(constants.ITEM_BORDER_RADIO) + .backgroundColor(constants.WHITE_BACKGROUND_COLOR) + .padding({ left: constants.PADDING, right: constants.PADDING }) + .height(constants.TITLE_HEIGHT) + .margin({ top: constants.PADDING }) + .onClick(() => { + this.addDeviceDialogController.open(); + }) + } + .width(constants.MAX_WIDTH) + } + } + .padding({ + left: constants.PADDING, + right: constants.PADDING + }) + } + .scrollBarWidth(constants.SCROLLBAR_WIDTH) + } + .width(constants.MAX_WIDTH) + .height(constants.MAX_HEIGHT) + .backgroundColor(constants.GREY_BACKGROUND_COLOR) + } +} \ No newline at end of file diff --git a/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/element/string.json b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8b0287bc3eeca219570a01e0402fc37d40c2377c --- /dev/null +++ b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/element/string.json @@ -0,0 +1,76 @@ +{ + "string": [ + { + "name": "face_introdution_title", + "value": "解锁时需连接可信设备" + }, + { + "name": "face_introdution_tip", + "value": "进行人脸识别解锁手机时,需连接可信设备以进一步提升安全性。" + }, + { + "name": "trusted_devices_title", + "value": "可信设备" + }, + { + "name": "face_introdution_button", + "value": "添加可信设备" + }, + { + "name": "connect_tip", + "value": "已连接" + }, + { + "name": "disconnect_tip", + "value": "未连接" + }, + { + "name": "cancel_button", + "value": "取消" + }, + { + "name": "remove_device_button", + "value": "移除" + }, + { + "name": "add_device_button", + "value": "添加" + }, + { + "name": "remove_device_tip", + "value": "移除后,人脸识别解锁本机时将不再需要连接可信设备。是否移除?" + }, + { + "name": "remove_device_title", + "value": "移除可信设备" + }, + { + "name": "add_device_or_not_tip", + "value": "是否添加" + }, + { + "name": "using_tips", + "value": "使用提示" + }, + { + "name": "add_device_tip", + "value": "添加后,当可信设备与本机断开连接时,将无法使用人脸识别解锁。您可以使用其他方式解锁。" + }, + { + "name": "open_bluetooth", + "value": "使用此功能需先开启蓝牙,点击设置" + }, + { + "name": "no_available_devices_title", + "value": "没有可添加的设备" + }, + { + "name": "no_available_devices_tip", + "value": "没有检测到可添加的配对设备。是否前往蓝牙设置配对?" + }, + { + "name": "pair_button", + "value": "去配对" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/back.png b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/back.png new file mode 100644 index 0000000000000000000000000000000000000000..85dcc6ad6895ff1b4ef599be169e0df24a7b01b5 Binary files /dev/null and b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/back.png differ diff --git a/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/iPad.png b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/iPad.png new file mode 100644 index 0000000000000000000000000000000000000000..d48706b244bcb700d5af35c3d599b2c9228501e1 Binary files /dev/null and b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/iPad.png differ diff --git a/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/icon.png b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/icon.png differ diff --git a/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/into_arrow.svg b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/into_arrow.svg new file mode 100644 index 0000000000000000000000000000000000000000..d20cc39c31fe2f8bd414a84c678decd8383ac086 --- /dev/null +++ b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/into_arrow.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/pad.png b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/pad.png new file mode 100644 index 0000000000000000000000000000000000000000..d2147588d2884bbb85495be345bef5ada69bb5f6 Binary files /dev/null and b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/pad.png differ diff --git a/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/phone.svg b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/phone.svg new file mode 100644 index 0000000000000000000000000000000000000000..b81e4e3637a98a33576cb875acb1fa9721b02e67 --- /dev/null +++ b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/base/media/phone.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui/faceenroll/feature/trusteddevicepad/src/main/resources/en_US/element/string.json b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..5c7ef3508e55e97bacd850a7de86494ebc7d2894 --- /dev/null +++ b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/en_US/element/string.json @@ -0,0 +1,77 @@ +{ + "string": [ + { + "name": "face_introdution_title", + "value": "Require trusted device" + }, + { + "name": "face_introdution_tip", + "value": "Add an extra layer of security by only allowing this device to be unlocked with facial recognition when a trusted device is connected." + }, + { + "name": "trusted_devices_title", + "value": "Trusted devices" + }, + { + "name": "face_introdution_button", + "value": "Add trusted device" + }, + { + "name": "connect_tip", + "value": "Connected" + }, + { + "name": "disconnect_tip", + "value": "Not connected" + }, + { + "name": "cancel_button", + "value": "Cancel" + }, + { + "name": "remove_device_button", + "value": "Remove" + }, + { + "name": "add_device_button", + "value": "Add" + }, + { + "name": "remove_device_tip", + "value": "Once removed, a trusted device will no longer be required to unlock this device with facial recognition." + }, + { + "name": "remove_device_title", + "value": "Remove trusted device" + }, + { + "name": "add_device_or_not_tip", + "value": "Add trusted device?" + }, + { + "name": "using_tips", + "value": "Note" + }, + { + "name": "add_device_tip", + "value": "You will only be able to unlock this device with facial recognition when a trusted device is connected over Bluetooth. Other unlock methods will not be affected." + }, + { + "name": "open_bluetooth", + "value": "Bluetooth must be enabled. Touch to enable" + }, + { + "name": "no_available_devices_title", + "value": "No available devices" + }, + { + "name": "no_available_devices_tip", + "value": "No paired devices found. Pair one now?" + }, + { + "name": "pair_button", + "value": "Go pair" + } + + ] +} \ No newline at end of file diff --git a/ui/faceenroll/feature/trusteddevicepad/src/main/resources/zh_CN/element/string.json b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8b0287bc3eeca219570a01e0402fc37d40c2377c --- /dev/null +++ b/ui/faceenroll/feature/trusteddevicepad/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,76 @@ +{ + "string": [ + { + "name": "face_introdution_title", + "value": "解锁时需连接可信设备" + }, + { + "name": "face_introdution_tip", + "value": "进行人脸识别解锁手机时,需连接可信设备以进一步提升安全性。" + }, + { + "name": "trusted_devices_title", + "value": "可信设备" + }, + { + "name": "face_introdution_button", + "value": "添加可信设备" + }, + { + "name": "connect_tip", + "value": "已连接" + }, + { + "name": "disconnect_tip", + "value": "未连接" + }, + { + "name": "cancel_button", + "value": "取消" + }, + { + "name": "remove_device_button", + "value": "移除" + }, + { + "name": "add_device_button", + "value": "添加" + }, + { + "name": "remove_device_tip", + "value": "移除后,人脸识别解锁本机时将不再需要连接可信设备。是否移除?" + }, + { + "name": "remove_device_title", + "value": "移除可信设备" + }, + { + "name": "add_device_or_not_tip", + "value": "是否添加" + }, + { + "name": "using_tips", + "value": "使用提示" + }, + { + "name": "add_device_tip", + "value": "添加后,当可信设备与本机断开连接时,将无法使用人脸识别解锁。您可以使用其他方式解锁。" + }, + { + "name": "open_bluetooth", + "value": "使用此功能需先开启蓝牙,点击设置" + }, + { + "name": "no_available_devices_title", + "value": "没有可添加的设备" + }, + { + "name": "no_available_devices_tip", + "value": "没有检测到可添加的配对设备。是否前往蓝牙设置配对?" + }, + { + "name": "pair_button", + "value": "去配对" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/build.gradle b/ui/faceenroll/product/pad/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..97db3b745050b624665e9b1d85ae36023cde20be --- /dev/null +++ b/ui/faceenroll/product/pad/build.gradle @@ -0,0 +1,23 @@ +apply plugin: 'com.huawei.ohos.hap' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 +ohos { + compileSdkVersion 7 + defaultConfig { + compatibleSdkVersion 7 + } + arkEnabled false + + buildTypes { + release { + proguardOpt { + proguardEnabled false + rulesFiles 'proguard-rules.pro' + } + } + } + +} + +dependencies { +} + diff --git a/ui/faceenroll/product/pad/src/main/config.json b/ui/faceenroll/product/pad/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d34306d44d454558f8d135936a03e58141fec9b0 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/config.json @@ -0,0 +1,81 @@ +{ + "app": { + "bundleName": "com.ohos.faceEnroll", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.faceEnroll", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "pad", + "moduleType": "entry", + "installationFree": true + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home", + "flag.home.intent.from.system" + ], + "actions": [ + "action.system.home", + "com.ohos.action.main" + ] + } + ], + "visible": true, + "name": "com.ohos.faceEnroll.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "singleton", + "srcPath": "default", + "srcLanguage": "ets", + "metaData": { + "customizeData": [ + { + "name": "hwc-theme" + } + ] + } + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/entryView", + "pages/userAuth", + "pages/userSettings", + "pages/index", + "pages/enroll_2D", + "pages/success", + "pages/enroll_3D", + "pages/declare", + "pages/startViews_2D", + "pages/startViews_3D" + ], + "name": "default", + "window": { + "designWidth": 1280, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/app.ets b/ui/faceenroll/product/pad/src/main/ets/default/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..7536e16b36e3040f10061a96fe9eabd1bcfc929e --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/app.ets @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + onCreate() { + console.info('FaceEnroll entry Application onCreate') + }, + onDestroy() { + console.info('FaceEnroll entry Application onDestroy') + }, + +} diff --git a/ui/faceenroll/product/pad/src/main/ets/default/common/Log.ets b/ui/faceenroll/product/pad/src/main/ets/default/common/Log.ets new file mode 100644 index 0000000000000000000000000000000000000000..d50e6d275079139f69a041591e8a17d43be3c9f0 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/common/Log.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const TAG = 'SystemUI_Default'; + +/** + * Basic log class + */ +export default class Log { + + /** + * print info level log + * + * @param {string} tag - Page or class tag + * @param {string} log - Log needs to be printed + */ + static showInfo(tag, log) { + console.info(`${TAG} tag: ${tag} --> ${log}`); + } + + /** + * print debug level log + * + * @param {string} tag - Page or class tag + * @param {string} log - Log needs to be printed + */ + static showDebug(tag, log) { + console.debug(`${TAG} tag: ${tag} --> ${log}`); + } + + /** + * print error level log + * + * @param {string} tag - Page or class tag + * @param {string} log - Log needs to be printed + */ + static showError(tag, log) { + console.error(`${TAG} tag: ${tag} --> ${log}`); + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/common/constant.ets b/ui/faceenroll/product/pad/src/main/ets/default/common/constant.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f6d6677df80214d6db9068c10bec54414c3ed6c --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/common/constant.ets @@ -0,0 +1,429 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; +import Log from '../common/Log.ets' + +const TAG = 'constant' + +async function routeSuccess() { + let options = { + uri: 'pages/success' + } + try { + await router.push(options) + } catch (err) { + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) + } +} + +async function route_back() { + let options = { + uri: 'pages/index' + } + try { + await router.push(options) + } catch (err) { + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) + } +} + +export default class Constants { + + //code and errorCode + static CODE_RESULT = 1 + static CODE_CANCEL = 2 + static CODE_ACQUIRE = 3 + static ERROR_CODE_SUCCESS = 0 + static ERROR_CODE_FAIL = 1 + static ERROR_CODE_CANCEL = 2 + static ERROR_CODE_TIMEOUT = 4 + static ERROR_CODE_ALGORITHM_NOT_INIT = 5 + static ERROR_CODE_HAL_INVALID = 6 + static ERROR_CODE_OVER_MAX_FACES = 7 + static ERROR_CODE_INVALID_PARAMETERS = 9 + static ERROR_CODE_BUSY = 13 + static ERROR_CODE_ENROLL_HAS_REGISTERED = 16 + static ERROR_CODE_FACE_DETECTED = 38 + static ERROR_CODE_BAD_QUALITY = 4 + static ERROR_CODE_NOT_FOUND = 5 + static ERROR_CODE_TOO_SMALL = 6 + static ERROR_CODE_TOO_LARGE = 7 + static ERROR_CODE_OFFSET_LEFT = 8 + static ERROR_CODE_OFFSET_TOP = 9 + static ERROR_CODE_OFFSET_RIGHT = 10 + static ERROR_CODE_OFFSET_BOTTOM = 11 + static ERROR_CODE_LIVENESS_WARNING = 13 + static ERROR_CODE_LIVENESS_FAILURE = 14 + static ERROR_CODE_ROTATED_LEFT = 15 + static ERROR_CODE_RISE = 16 + static ERROR_CODE_ROTATED_RIGHT = 17 + static ERROR_CODE_DOWN = 18 + static ERROR_CODE_EYE_OCCLUSION = 21 + static ERROR_CODE_EYE_CLOSE = 22 + static ERROR_CODE_MOUTH_OCCLUSION = 23 + static ERROR_CODE_MULTI = 27 + static ERROR_CODE_BLUR = 28 + static ERROR_CODE_NOT_COMPLETE = 29 + static ERROR_CODE_DARKLIGHT = 30 + static ERROR_CODE_HIGHTLIGHT = 31 + static ERROR_CODE_HALF_SHADOW = 32 + static ERROR_CODE_HAS_REGISTERED = 37 + static ERROR_CODE_DARKPIC = 39 + static ERROR_CODE_ROTATE_TOP_RIGHT = 40 + static ERROR_CODE_ROTATE_TOP_LEFT = 41 + static ERROR_CODE_ROTATE_BOTTOM_RIGHT = 42 + static ERROR_CODE_ROTATE_BOTTOM_LEFT = 43 + static ERROR_CODE_OPEN_CAMERA_FAILED = 46 + static ERROR_CODE_PROGRESS_FIRST = 1004 + static ERROR_CODE_PROGRESS_SECOND = 1008 + static ERROR_CODE_PROGRESS_THIRD = 1012 + static PARAM_TOKEN = "check" + static FLAGS = 0 + static FACEID = 0 + static PREVIEWID = 2 + + + //setTimeout + static TIMEOUT_100 = 100 + static TIMEOUT_200 = 200 + static TIMEOUT_300 = 300 + static TIMEOUT_400 = 400 + static TIMEOUT_500 = 500 + static TIMEOUT_600 = 600 + static TIMEOUT_700 = 700 + static TIMEOUT_800 = 800 + static TIMEOUT_900 = 900 + static TIMEOUT_1000 = 1000 + static TIMEOUT_1100 = 1100 + static TIMEOUT_1200 = 1200 + static TIMEOUT_1300 = 1300 + static TIMEOUT_1400 = 1400 + static TIMEOUT_1500 = 1500 + static TIMEOUT_1600 = 1600 + static TIMEOUT_1700 = 1700 + static TIMEOUT_1800 = 1800 + static TIMEOUT_1900 = 1900 + static TIMEOUT_2000 = 2000 + static TIMEOUT_3000 = 3000 + + //UI + static SHELTER_ANIMATOR = 1000 + static PROGRESS_START = 0 + static PROGRESS_TOTAL = 100 + static FONT_WEIGHT = 500 + static ENROll_TITLE = 600 + static SHELTER_START_WIDTH = 1100 + static SHELTER_END_WIDTH = '100%' + static CENTER_HEIGHT = '620lpx' + static SHELTER_START_HEIGHT = '2000lpx' + static SHELTER_END_HEIGHT = '640lpx' + static SHELTER_3D_END_HEIGHT = '640lpx' + static PROGRESS_VALUE_FIRST = 30 + static PROGRESS_VALUE_SECOND = 60 + static PROGRESS_VALUE_THIRD = 100 + static SPACE = 20 + static INITIAL_INDEX = 0 + static HEIGHT_LIST = 60 + static FONTSIZE_16 = 16 + static BORDER_RADIUS = 10 + static STROKE_WIDTH = 2 + static START_MARGIN = 20 + static END_MARGIN = 20 + static SHOW_START_VIEWS_3D = '3D' + static SHOW_START_VIEWS_2D = '2D' + static LIST_PADDING = 5 + static BLUR_START = 0 + static BLUR_END = 40 + static CENTER_POSITION_Y = 5 + static BUTTON_POSITION = '92%' + static ENROLL_INFO_POSITION = '918lpx' + static ENROLL_INFO_WIDTH = '90%' + static CHECKBOX_POSITION_X = '5%' + static CHECKBOX_POSITION_Y = '85%' + static CHECKBOX_TEXT_POSITION_X = '18%' + static CHECKBOX_TEXT_POSITION_Y = '87%' + + + static PROGRESS_WIDTH = '460lpx' + static BACK_WIDTH = '136lpx' + static BACK_HEIGHT = '110lpx' + static TITLE_FONT_SIZE = '48lpx' + static TITLE_MARGIN = '24lpx' + static TITLE_ENROLLING_MARGIN = '140lpx' + static IMAGE_MARGIN = '96lpx' + static IMAGE_3D_MARGIN = '48lpx' + static FONT_SIZE = '28lpx' + static SMALL_TITLE_FONT_SIZE = '36lpx' + static CONTENT1_MARGIN = '16lpx' + static CONTENT2_MARGIN = '8lpx' + static BUTTON_FONT_SIZE = '32lpx' + static BUTTON_WIDTH = '384lpx' + static BUTTON_HEIGHT = '80lpx' + static IMAGE_2D_HEIGHT = '480lpx' + static IMAGE_3D_WIDTH = '512lpx' + static ERROR_CODE_INFO_SIZE = '32lpx' + static ENROLL_CENTER_POSITION_Y = '240lpx' + static SUCCESS_WIDTH = '204lpx' + static CHECKBOX_SIZE = '70lpx' + static APERTURE1_WIDTH = '266lpx' + static APERTURE2_WIDTH = '264lpx' + static APERTURE34_WIDTH = '284lpx' + static APERTURE5_WIDTH = '466lpx' + + + + //PROGRESS + static PROGRESS_VALUE_5 = 5 + static PROGRESS_VALUE_10 = 10 + static PROGRESS_VALUE_15 = 15 + static PROGRESS_VALUE_20 = 20 + static PROGRESS_VALUE_25 = 25 + static PROGRESS_VALUE_30 = 30 + static PROGRESS_VALUE_35 = 35 + static PROGRESS_VALUE_40 = 40 + static PROGRESS_VALUE_45 = 45 + static PROGRESS_VALUE_50 = 50 + static PROGRESS_VALUE_55 = 55 + static PROGRESS_VALUE_60 = 60 + static PROGRESS_VALUE_65 = 65 + static PROGRESS_VALUE_70 = 70 + static PROGRESS_VALUE_75 = 75 + static PROGRESS_VALUE_80 = 80 + static PROGRESS_VALUE_85 = 85 + static PROGRESS_VALUE_90 = 90 + static PROGRESS_VALUE_95 = 95 + static PROGRESS_VALUE_100 = 100 + + static DECLARE_WIDTH = '90%' + static DECLARE_MAX_WIDTH = '100%' + static DECLARE_TITLE_FONT_SIZE = 25 + static DECLARE_SECONDARY_TITLE_FONT_SIZE = 23 + static DECLARE_TEXT_FONT_SIZE = 22 + static DECLARE_ITEM_MARGIN_BOTTOM = 10 + static DECLARE_TITLE_MARGIN_TOP = 20 + static DECLARE_TITLE_MARGIN_BOTTOM = 20 + static DECLARE_TEXT_LINE_HEIGHT = 33 + static DECLARE_SCROLL_BAR_WIDTH = 0 + static DECLARE_BACKGROUND_COLOR = "#F2F3F5" + static DECLARE_TITLE_2 = "2." + static DECLARE_TITLE_3 = "3." + static DECLARE_TITLE_4 = "4." + static DECLARE_TITLE_5 = "5." + + + + + //errorCode value + static value(){ + const info = new Map() + info.set(Constants.ERROR_CODE_BAD_QUALITY,$r('app.string.enroll_info_bad_quality')) + info.set(Constants.ERROR_CODE_NOT_FOUND,$r('app.string.enroll_info_not_found')) + info.set(Constants.ERROR_CODE_TOO_SMALL,$r('app.string.face_record_3d_tip_close')) + info.set(Constants.ERROR_CODE_TOO_LARGE,$r('app.string.face_record_3d_tip_far')) + info.set(Constants.ERROR_CODE_OFFSET_LEFT,$r('app.string.face_enroll_too_left')) + info.set(Constants.ERROR_CODE_OFFSET_TOP,$r('app.string.face_enroll_too_high')) + info.set(Constants.ERROR_CODE_OFFSET_RIGHT,$r('app.string.face_enroll_too_right')) + info.set(Constants.ERROR_CODE_OFFSET_BOTTOM,$r('app.string.face_enroll_too_low')) + info.set(Constants.ERROR_CODE_LIVENESS_WARNING,$r('app.string.enroll_info_liveness_warning')) + info.set(Constants.ERROR_CODE_LIVENESS_FAILURE,$r('app.string.enroll_info_liveness_failure')) + info.set(Constants.ERROR_CODE_ROTATED_LEFT,$r('app.string.face_rotate_too_left')) + info.set(Constants.ERROR_CODE_RISE,$r('app.string.face_rotate_too_high')) + info.set(Constants.ERROR_CODE_ROTATED_RIGHT,$r('app.string.face_rotate_too_right')) + info.set(Constants.ERROR_CODE_DOWN,$r('app.string.face_rotate_too_low')) + info.set(Constants.ERROR_CODE_EYE_OCCLUSION,$r('app.string.enroll_info_eye_occlusion')) + info.set(Constants.ERROR_CODE_EYE_CLOSE,$r('app.string.enroll_info_eye_close')) + info.set(Constants.ERROR_CODE_MOUTH_OCCLUSION,$r('app.string.enroll_info_mouth_occlusion')) + info.set(Constants.ERROR_CODE_MULTI,$r('app.string.face_record_3d_tip_multi')) + info.set(Constants.ERROR_CODE_BLUR,$r('app.string.enroll_info_blur')) + info.set(Constants.ERROR_CODE_NOT_COMPLETE,$r('app.string.enroll_info_not_complete')) + info.set(Constants.ERROR_CODE_DARKLIGHT,$r('app.string.enroll_info_darklight')) + info.set(Constants.ERROR_CODE_HIGHTLIGHT,$r('app.string.enroll_info_highlight')) + info.set(Constants.ERROR_CODE_HALF_SHADOW,$r('app.string.enroll_info_half_shadow')) + info.set(Constants.ERROR_CODE_HAS_REGISTERED,$r('app.string.enroll_info_face_has_registered')) + info.set(Constants.ERROR_CODE_DARKPIC,$r('app.string.enroll_info_darkpic')) + info.set(Constants.ERROR_CODE_ROTATE_TOP_RIGHT,$r('app.string.enroll_info_rotate_top_right')) + info.set(Constants.ERROR_CODE_ROTATE_TOP_LEFT,$r('app.string.enroll_info_rotate_top_left')) + info.set(Constants.ERROR_CODE_ROTATE_BOTTOM_RIGHT,$r('app.string.enroll_info_rotate_bottom_right')) + info.set(Constants.ERROR_CODE_ROTATE_BOTTOM_LEFT,$r('app.string.enroll_info_rotate_bottom_left')) + info.set(Constants.ERROR_CODE_OPEN_CAMERA_FAILED,$r('app.string.enroll_info_open_camera_failed')) + + return info + } + + //face progress_3D + static progress() { + const pro = new Map() + pro.set(Constants.ERROR_CODE_PROGRESS_FIRST,Constants.PROGRESS_VALUE_FIRST) + pro.set(Constants.ERROR_CODE_PROGRESS_SECOND,Constants.PROGRESS_VALUE_SECOND) + pro.set(Constants.ERROR_CODE_PROGRESS_THIRD,Constants.PROGRESS_VALUE_THIRD) + + return pro + } + static result() { + const res = new Map() + res.set(Constants.ERROR_CODE_FAIL,'') + res.set(Constants.ERROR_CODE_CANCEL,$r('app.string.enroll_info_cancel')) + res.set(Constants.ERROR_CODE_ALGORITHM_NOT_INIT,$r('app.string.enroll_info_algorithm_not_init')) + res.set(Constants.ERROR_CODE_HAL_INVALID,$r('app.string.enroll_info_hal_invalid')) + res.set(Constants.ERROR_CODE_OVER_MAX_FACES,$r('app.string.enroll_info_over_max_faces')) + res.set(Constants.ERROR_CODE_INVALID_PARAMETERS,$r('app.string.enroll_info_invalid_parameters')) + res.set(Constants.ERROR_CODE_BUSY,$r('app.string.enroll_info_busy')) + res.set(Constants.ERROR_CODE_ENROLL_HAS_REGISTERED,$r('app.string.enroll_info_has_registered')) + + return res + } + + //face progress_2D + static progress_2D(){ + Log.showInfo(TAG,'progress_2D') + + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_5) + },Constants.TIMEOUT_100); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_10) + },Constants.TIMEOUT_200); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_15) + },Constants.TIMEOUT_300); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_20) + },Constants.TIMEOUT_400); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_25) + },Constants.TIMEOUT_500); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_30) + },Constants.TIMEOUT_600); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_35) + },Constants.TIMEOUT_700); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_40) + },Constants.TIMEOUT_800); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_45) + },Constants.TIMEOUT_900); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_50) + },Constants.TIMEOUT_1000); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_55) + },Constants.TIMEOUT_1100); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_60) + },Constants.TIMEOUT_1200); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_65) + },Constants.TIMEOUT_1300); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_70) + },Constants.TIMEOUT_1400); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_75) + },Constants.TIMEOUT_1500); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_80) + },Constants.TIMEOUT_1600); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_85) + },Constants.TIMEOUT_1700); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_90) + },Constants.TIMEOUT_1800); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_95) + },Constants.TIMEOUT_1900); + setTimeout(()=>{ + AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_100) + routeSuccess() + },Constants.TIMEOUT_2000) + } + + static aperture(){ + setTimeout(() => { + AppStorage.Set('showAperture1',false) + AppStorage.Set('showAperture2',true) + }, Constants.TIMEOUT_1000) + setTimeout(() => { + AppStorage.Set('showAperture2',false) + AppStorage.Set('showAperture3',true) + }, Constants.TIMEOUT_1300) + setTimeout(() => { + AppStorage.Set('showAperture3',false) + AppStorage.Set('showAperture4',true) + }, Constants.TIMEOUT_1600) + setTimeout(() => { + AppStorage.Set('showAperture4',false) + AppStorage.Set('showAperture5',true) + }, Constants.TIMEOUT_1900) + } + + static RESULT_CODE_SUCCESS = 0 + static RESULT_CODE_FAIL = 1 + static RESULT_CODE_GENERAL_ERROR = 2 + static RESULT_CODE_CANCELED = 3 + static RESULT_CODE_TIMEOUT = 4 + static RESULT_CODE_TYPE_NOT_SUPPORT = 5 + static RESULT_CODE_TRUST_LEVEL_NOT_SUPPORT = 6 + static RESULT_CODE_BUSY = 7 + static RESULT_CODE_INVALID_PARAMETERS = 8 + static RESULT_CODE_LOCKED = 9 + static RESULT_CODE_NOT_ENROLLED = 10 + + static resultCode(){ + const Code = new Map() + Code.set(Constants.RESULT_CODE_SUCCESS,$r('app.string.enroll_success')) + Code.set(Constants.RESULT_CODE_FAIL,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_GENERAL_ERROR,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_CANCELED,$r('app.string.enroll_info_cancel')) + Code.set(Constants.RESULT_CODE_TIMEOUT,$r('app.string.enrolling_timeout')) + Code.set(Constants.RESULT_CODE_TYPE_NOT_SUPPORT,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_TRUST_LEVEL_NOT_SUPPORT,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_BUSY,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_INVALID_PARAMETERS,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_LOCKED,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_NOT_ENROLLED,$r('app.string.enrolling_fail')) + return Code + } + + static FACE_AUTH_TIP_TOO_BRIGHT = 1 + static FACE_AUTH_TIP_TOO_DARK = 2 + static FACE_AUTH_TIP_TOO_CLOSE = 3 + static FACE_AUTH_TIP_TOO_FAR = 4 + static FACE_AUTH_TIP_TOO_HIGH = 5 + static FACE_AUTH_TIP_TOO_LOW = 6 + static FACE_AUTH_TIP_TOO_RIGHT = 7 + static FACE_AUTH_TIP_TOO_LEFT = 8 + static FACE_AUTH_TIP_TOO_MUCH_MOTION = 9 + static FACE_AUTH_TIP_POOR_GAZE = 10 + static FACE_AUTH_TIP_NOT_DETECTED = 11 + + static FaceTips(){ + const Tips = new Map() + Tips.set(Constants.FACE_AUTH_TIP_TOO_BRIGHT,$r('app.string.enroll_info_highlight')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_DARK,$r('app.string.enroll_info_darklight')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_CLOSE,$r('app.string.enroll_info_scale_too_large')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_FAR,$r('app.string.enroll_info_scale_too_small')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_HIGH,$r('app.string.enroll_info_offset_top')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_LOW,$r('app.string.enroll_info_offset_bottom')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_RIGHT,$r('app.string.enroll_info_offset_right')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_LEFT,$r('app.string.enroll_info_offset_left')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_MUCH_MOTION,$r('app.string.enroll_info_blur')) + Tips.set(Constants.FACE_AUTH_TIP_POOR_GAZE,$r('app.string.enroll_info_eye_occlusion')) + Tips.set(Constants.FACE_AUTH_TIP_NOT_DETECTED,$r('app.string.enroll_info_not_found')) + return Tips + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/model_2D.ets b/ui/faceenroll/product/pad/src/main/ets/default/model_2D.ets new file mode 100644 index 0000000000000000000000000000000000000000..794b2a179fa55a3129dc1ec5ab5ca44a558a0d35 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/model_2D.ets @@ -0,0 +1,273 @@ +// @ts-nocheck +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Constants from './common/constant.ets'; +import UserIDM from '@ohos.useridm'; + +var mPrgvalue; +var mResultCode = Constants.resultCode(); +var mFaceTips = Constants.FaceTips(); + +export class model_2D { + private UserIDM; + + constructor() { + this.UserIDM = UserIDM.constructor(); + } + /** + * init FaceModel + */ + initFaceModel(credentialInfo) { + console.info("FaceEnroll model_2D initFaceModel start"); + AppStorage.Link('width'); + AppStorage.Link('showBack'); + AppStorage.Link('height'); + AppStorage.Link('showAperture'); + AppStorage.Link('blur'); + AppStorage.Link('showPrg'); + mPrgvalue = AppStorage.Link('prgValue'); + AppStorage.Link('enrollInfo'); + AppStorage.Link('showBtn'); + AppStorage.Link('enrollTitle'); + this.startEnroll(credentialInfo); + console.info("FaceEnroll model_2D initFaceModel end"); + } + + /** + * Open session and get challenge. + * @param callback + */ + openSession(callback) { + console.info("FaceEnroll model_2D openSession start"); + this.UserIDM.openSession((data) => { + try { + console.info("FaceEnroll model_2D openSession data", data); + callback(data); + } + catch (e) { + console.info("FaceEnroll model_2D openSession error", e); + } + }) + callback(); + console.info("FaceEnroll model_2D openSession end"); + } + + /** + * resume page, unInit FaceModel + */ + uninitFaceModel() { + console.info(" FaceEnroll model_2D uninitFaceModel start"); + if (mPrgvalue != Constants.PROGRESS_TOTAL) { + this.cancelEnroll(); + } + setTimeout(() => { + AppStorage.Set('width', Constants.SHELTER_START_WIDTH) + AppStorage.Set('height', Constants.SHELTER_START_HEIGHT) + AppStorage.Set('showBtn', false) + AppStorage.Set('showPrg', false) + AppStorage.Set('showBack', true) + AppStorage.Set('blur', Constants.BLUR_START) + AppStorage.Set('showAperture', true) + mPrgvalue = AppStorage.Set('prgValue', $r('app.float.progress_value_start')) + AppStorage.Set('enrollInfo', $r('app.string.enroll_info')) + AppStorage.Set('enrollTitle', $r('app.string.face_record')) + }, Constants.TIMEOUT_500) + console.info(" FaceEnroll model_2D uninitFaceModel end"); + } + + /** + * start enroll, get callback value + */ + startEnroll(credentialInfo) { + console.info(" FaceEnroll model_2D startEnroll 2d start "); + this.UserIDM.addCredential(credentialInfo, { + onResult: (result, extraInfo) => { + if (result == Constants.RESULT_CODE_SUCCESS) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('showPrg', true); + Constants.progress_2D(); + this.endEnroll(); + } + if (result == Constants.RESULT_CODE_FAIL) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_GENERAL_ERROR) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_CANCELED) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + } + if (result == Constants.RESULT_CODE_TIMEOUT) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.enrolling_timeout')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_TYPE_NOT_SUPPORT) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_TRUST_LEVEL_NOT_SUPPORT) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_BUSY) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_INVALID_PARAMETERS) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_LOCKED) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_NOT_ENROLLED) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + }, + onAcquireInfo: (callbackModule, acquire, extraInfo) => { + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.enrolling')); + AppStorage.Set('enrollInfo', mFaceTips.get(acquire)); + } + }) + this.endEnroll(); + } + + /** + * end enroll + */ + endEnroll() { + console.info("FaceEnroll model_2D endEnroll start"); + this.UserIDM.closeSession(); + console.info("FaceEnroll model_2D endEnroll userEnroll.closeSession()"); + AppStorage.Delete('faceSession'); + console.info("FaceEnroll model_2D endEnroll end"); + } + + /** + * cancel enroll + */ + cancelEnroll() { + console.info("FaceEnroll model_2D cancelEnroll start"); + let can = this.UserIDM.cancel(AppStorage.Get('faceSession')); + console.info("FaceEnroll model_2D cancelEnroll userEnroll.cancel()", can); + this.endEnroll(); + console.info("FaceEnroll model_2D cancelEnroll end"); + } + + /** + * change index 3d + */ + change_3D() { + AppStorage.Set('show_startViews', '3D'); + } + + /** + * change index 2d + */ + change_2D() { + AppStorage.Set('show_startViews', '2D'); + } + + /** + * init index + */ + init() { + AppStorage.SetAndLink('show_startViews', '2D'); + } +} + +let mFaceModel = new model_2D(); + +export default mFaceModel as model_2D; diff --git a/ui/faceenroll/product/pad/src/main/ets/default/model_3D.ets b/ui/faceenroll/product/pad/src/main/ets/default/model_3D.ets new file mode 100644 index 0000000000000000000000000000000000000000..59745d1656cb3e9b61c75405a11bc1a219e26f6a --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/model_3D.ets @@ -0,0 +1,255 @@ +// @ts-nocheck +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Constants from '../default/common/constant.ets'; +import UserIDM from '@ohos.useridm'; + +var mPrgvalue; +var mResultCode = Constants.resultCode(); +var mFaceTips = Constants.FaceTips(); + + +export class model_3D { + private UserIDM; + + constructor() { + this.UserIDM = UserIDM.constructor(); + } + /** + * init FaceModel + */ + initFaceModel(credentialInfo) { + console.info("FaceEnroll model_3D initFaceModel start"); + AppStorage.Link('width'); + AppStorage.Link('height'); + AppStorage.Link('showPrg'); + mPrgvalue = AppStorage.Link('prgValue'); + AppStorage.Link('showBtn'); + AppStorage.Link('blur'); + AppStorage.Link('showBack'); + AppStorage.Set('enrollInfo', $r('app.string.enroll_info')) + AppStorage.Set('enrollTitle', $r('app.string.face_record')) + AppStorage.Link('showAperture1') + this.startEnroll(credentialInfo); + console.info("FaceEnroll model_3D initFaceModel end"); + } + + /** + * resume page, unInit FaceModel + */ + uninitFaceModel() { + console.info(" FaceEnroll model_3D uninitFaceModel start"); + if (mPrgvalue != Constants.PROGRESS_TOTAL) { + this.cancelEnroll(); + } + setTimeout(() => { + AppStorage.Set('width', Constants.SHELTER_START_WIDTH); + AppStorage.Set('height', Constants.SHELTER_START_HEIGHT); + AppStorage.Set('showPrg', false) + mPrgvalue = AppStorage.Set('prgValue', $r('app.float.progress_value_start')) + AppStorage.Set('showBack', true) + AppStorage.Set('blur', Constants.BLUR_START) + AppStorage.Set('showBtn', false) + AppStorage.Set('enrollInfo', $r('app.string.enroll_info')) + AppStorage.Set('enrollTitle', $r('app.string.face_record')) + AppStorage.Set('showAperture1',true) + AppStorage.Set('showAperture2',false) + AppStorage.Set('showAperture3',false) + AppStorage.Set('showAperture4',false) + AppStorage.Set('showAperture5',false) + + },Constants.TIMEOUT_500) + } + + /** + * Open session and get challenge. + * @param callback + */ + openSession(callback) { + console.info("FaceEnroll model_3D openSession start"); + this.UserIDM.openSession((data) => { + try { + console.info("FaceEnroll model_3D openSession data", data); + callback(data); + } + catch (e) { + console.info("FaceEnroll model_3D openSession error", e); + } + }) + callback(); + console.info("FaceEnroll model_3D openSession end"); + } + + /** + * start enroll, get callback value + */ + startEnroll(credentialInfo) { + console.info(" FaceEnroll model_3D startEnroll 3d start "); + this.UserIDM.addCredential(credentialInfo, { + onResult: (result, extraInfo) => { + if (result == Constants.RESULT_CODE_SUCCESS) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('showPrg', true); + Constants.progress_2D(); + this.endEnroll(); + } + if (result == Constants.RESULT_CODE_FAIL) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_GENERAL_ERROR) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_CANCELED) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + } + if (result == Constants.RESULT_CODE_TIMEOUT) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.enrolling_timeout')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_TYPE_NOT_SUPPORT) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_TRUST_LEVEL_NOT_SUPPORT) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_BUSY) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_INVALID_PARAMETERS) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_LOCKED) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_NOT_ENROLLED) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + }, + onAcquireInfo: (callbackModule, acquire, extraInfo) => { + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.enrolling')); + AppStorage.Set('enrollInfo', mFaceTips.get(acquire)); + } + }) + this.endEnroll(); + } + + /** + * end enroll + */ + endEnroll() { + console.info("FaceEnroll model_3D endEnroll start"); + this.UserIDM.closeSession(); + console.info("FaceEnroll model_3D endEnroll userEnroll.closeSession()"); + AppStorage.Delete('faceSession'); + console.info("FaceEnroll model_3D endEnroll end"); + } + + /** + * cancel enroll + */ + cancelEnroll() { + console.info("FaceEnroll model_3D cancelEnroll start"); + let can = this.UserIDM.cancel(AppStorage.Get('faceSession')); + console.info("FaceEnroll model_2D cancelEnroll userEnroll.cancel()", can); + this.endEnroll(); + console.info("FaceEnroll model_3D cancelEnroll end"); + } +} +let mFaceModel = new model_3D(); +export default mFaceModel as model_3D; \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/pages/aperture.ets b/ui/faceenroll/product/pad/src/main/ets/default/pages/aperture.ets new file mode 100644 index 0000000000000000000000000000000000000000..08d56d73ad05859deaa5d9e842b6e09a0f4df9a2 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/pages/aperture.ets @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Constants from '../common/constant.ets'; + +@Entry +@Component + +export default + +struct Aperture { + + @StorageLink('showAperture1') showAperture1:boolean = true; + @StorageLink('showAperture2') showAperture2:boolean = false; + @StorageLink('showAperture3') showAperture3:boolean = false; + @StorageLink('showAperture4') showAperture4:boolean = false; + @StorageLink('showAperture5') showAperture5:boolean = false; + + build() { + Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { + if (this.showAperture1) { + Image($r('app.media.aperture1')) + .width(Constants.APERTURE1_WIDTH) + .height(Constants.APERTURE1_WIDTH) + .align(Alignment.Center) + } + if (this.showAperture2) { + Image($r('app.media.aperture2')) + .width(Constants.APERTURE2_WIDTH) + .height(Constants.APERTURE2_WIDTH) + .align(Alignment.Center) + } + if (this.showAperture3) { + Image($r('app.media.aperture3')) + .width(Constants.APERTURE34_WIDTH) + .height(Constants.APERTURE34_WIDTH) + .align(Alignment.Center) + } + if (this.showAperture4) { + Image($r('app.media.aperture4')) + .width(Constants.APERTURE34_WIDTH) + .height(Constants.APERTURE34_WIDTH) + .align(Alignment.Center) + } + if (this.showAperture5) { + Image($r('app.media.aperture5')) + .width(Constants.APERTURE5_WIDTH) + .height(Constants.APERTURE5_WIDTH) + .align(Alignment.Center) + } + }.position({x: $r('app.float.enroll_center_position_X'),y:Constants.ENROLL_CENTER_POSITION_Y}) + .width('100%') + .height(Constants.CENTER_HEIGHT) + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/pages/declare.ets b/ui/faceenroll/product/pad/src/main/ets/default/pages/declare.ets new file mode 100644 index 0000000000000000000000000000000000000000..08d56d73ad05859deaa5d9e842b6e09a0f4df9a2 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/pages/declare.ets @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Constants from '../common/constant.ets'; + +@Entry +@Component + +export default + +struct Aperture { + + @StorageLink('showAperture1') showAperture1:boolean = true; + @StorageLink('showAperture2') showAperture2:boolean = false; + @StorageLink('showAperture3') showAperture3:boolean = false; + @StorageLink('showAperture4') showAperture4:boolean = false; + @StorageLink('showAperture5') showAperture5:boolean = false; + + build() { + Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { + if (this.showAperture1) { + Image($r('app.media.aperture1')) + .width(Constants.APERTURE1_WIDTH) + .height(Constants.APERTURE1_WIDTH) + .align(Alignment.Center) + } + if (this.showAperture2) { + Image($r('app.media.aperture2')) + .width(Constants.APERTURE2_WIDTH) + .height(Constants.APERTURE2_WIDTH) + .align(Alignment.Center) + } + if (this.showAperture3) { + Image($r('app.media.aperture3')) + .width(Constants.APERTURE34_WIDTH) + .height(Constants.APERTURE34_WIDTH) + .align(Alignment.Center) + } + if (this.showAperture4) { + Image($r('app.media.aperture4')) + .width(Constants.APERTURE34_WIDTH) + .height(Constants.APERTURE34_WIDTH) + .align(Alignment.Center) + } + if (this.showAperture5) { + Image($r('app.media.aperture5')) + .width(Constants.APERTURE5_WIDTH) + .height(Constants.APERTURE5_WIDTH) + .align(Alignment.Center) + } + }.position({x: $r('app.float.enroll_center_position_X'),y:Constants.ENROLL_CENTER_POSITION_Y}) + .width('100%') + .height(Constants.CENTER_HEIGHT) + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/pages/enroll_2D.ets b/ui/faceenroll/product/pad/src/main/ets/default/pages/enroll_2D.ets new file mode 100644 index 0000000000000000000000000000000000000000..4808d29dcf315709082adf253ada6ac2548cfc33 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/pages/enroll_2D.ets @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import router from '@system.router'; +import mFaceModel from "../model_2D.ets"; +import Constants from '../common/constant.ets'; +const SUBTYPE_FACE_2D = 20000; +const AUTHTYPE_FACE = 2; + +async function route_back() { + let options = { + uri: 'pages/entryView' + } + try { + await router.push(options); + } catch (err) { + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); + } +} + +@Entry +@Component +export default struct Enroll_2D { + @StorageLink('showAperture') showAperture: boolean = true; + @StorageLink('blur') blur: number = Constants.BLUR_START; + @StorageLink('width') width: any = Constants.SHELTER_START_WIDTH; + @StorageLink('height') height: any = Constants.SHELTER_START_HEIGHT; + @StorageLink('showPrg') showPrg: boolean = false; + @StorageLink('prgValue') prgValue: number = Constants.PROGRESS_START; + @StorageLink('enrollInfo') enrollInfo: any = $r('app.string.enroll_info'); + @StorageLink('enrollTitle') enrollTitle: any = $r('app.string.face_record'); + @StorageLink('showBtn') showBtn: boolean = false; + @StorageLink('showBack') showBack: boolean = true; + private credentialInfo; + + private aboutToAppear(): void { + setTimeout(()=> { + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView' + }); + }, 180000) + this.credentialInfo = { + credType:AUTHTYPE_FACE, + credSubType:SUBTYPE_FACE_2D, + token:AppStorage.Get('token') + }; + mFaceModel.initFaceModel(this.credentialInfo); + } + + private onPageHide() { + mFaceModel.uninitFaceModel(); + } + + private onBackPress(): void{ + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Image($r('app.media.image')) + .width('100%') + .height(Constants.CENTER_HEIGHT) + .align(Alignment.Center) + .position({x: $r('app.float.enroll_center_position_X'),y:Constants.ENROLL_CENTER_POSITION_Y}) + + Flex() + .width('100%') + .height(Constants.CENTER_HEIGHT) + .align(Alignment.Center) + .blur(this.blur) + .position({x:$r('app.float.enroll_center_position_X'),y: Constants.ENROLL_CENTER_POSITION_Y}) + .animation({ duration: Constants.SHELTER_ANIMATOR, curve: Curve.Linear }) + + if (this.showAperture) { + Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { + Image($r('app.media.aperture1')) + .width(Constants.APERTURE1_WIDTH) + .height(Constants.APERTURE1_WIDTH) + .align(Alignment.Center) + } + .position({x:$r('app.float.enroll_center_position_X'),y:Constants.ENROLL_CENTER_POSITION_Y}) + .height(Constants.CENTER_HEIGHT) + .width('100%') + } + + Flex() + .width('100%') + .height(Constants.ENROLL_CENTER_POSITION_Y) + + Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { + Image($r('app.media.shelter')) + .width(this.width) + .height(this.height) + .animation({ duration: Constants.SHELTER_ANIMATOR, curve: Curve.Linear }) + }.width('100%') + .height(Constants.CENTER_HEIGHT) + + + if(this.showPrg) { + Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { + Progress({ value: Constants.PROGRESS_START, total: Constants.PROGRESS_TOTAL, style: ProgressStyle.Capsule }) + .value(this.prgValue) + .width(Constants.PROGRESS_WIDTH) + .color(Color.Red) + }.position({x:$r('app.float.enroll_center_position_X'),y:Constants.ENROLL_CENTER_POSITION_Y}) + .height(Constants.CENTER_HEIGHT) + .width('100%') + } + + if(this.showBack) { + Flex() { + Image($r('app.media.back')) + .width(Constants.BACK_WIDTH) + .height(Constants.BACK_HEIGHT) + .onClick(() => { + router.back() + }) + }.position({ x: $r('app.float.enroll_center_position_X'), y: Constants.CENTER_POSITION_Y }) + } + + Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { + Text(this.enrollTitle) + .fontSize(Constants.TITLE_FONT_SIZE) + .fontWeight(Constants.ENROll_TITLE) + }.position({x:$r('app.float.enroll_title_position_X'),y:Constants.TITLE_ENROLLING_MARGIN}) + + Flex({justifyContent:FlexAlign.Center}) { + Text(this.enrollInfo) + .fontSize(Constants.ERROR_CODE_INFO_SIZE) + .textAlign(TextAlign.Center) + } + .position({ x:$r('app.float.enroll_info_X'), y: Constants.ENROLL_INFO_POSITION}) + .width(Constants.ENROLL_INFO_WIDTH) + + if(this.showBtn){ + Flex({justifyContent:FlexAlign.Center}) { + Button({ type: ButtonType.Capsule, stateEffect: true }) { + Text($r('app.string.enroll_button_content')) + .fontSize(Constants.BUTTON_FONT_SIZE) + .fontColor($r('app.color.startView_color')) + } + .backgroundColor($r('app.color.newBtn_color')) + .width(Constants.BUTTON_WIDTH) + .height(Constants.BUTTON_HEIGHT) + .onClick(() => { + route_back() + }) + }.position({ x:$r('app.float.enroll_center_position_X'), y: Constants.BUTTON_POSITION}) + } + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/pages/enroll_3D.ets b/ui/faceenroll/product/pad/src/main/ets/default/pages/enroll_3D.ets new file mode 100644 index 0000000000000000000000000000000000000000..4aaa6712799b8ec300b2389cf23433fd58ff6b36 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/pages/enroll_3D.ets @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import router from '@system.router'; +import mFaceModel from "../model_3D.ets"; +import Constants from '../common/constant.ets'; +const SUBTYPE_FACE_2D = 20000; +const AUTHTYPE_FACE = 2; + +async function route_back() { + let options = { + uri: 'pages/entryView' + } + try { + await router.push(options); + } catch (err) { + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); + } +} + +@Entry +@Component +export default struct Enroll_3D { + @StorageLink('showAperture') showAperture: boolean = true; + @StorageLink('blur') blur: number = Constants.BLUR_START; + @StorageLink('width') width: any = Constants.SHELTER_START_WIDTH; + @StorageLink('height') height: any = Constants.SHELTER_START_HEIGHT; + @StorageLink('showPrg') showPrg: boolean = false; + @StorageLink('prgValue') prgValue: number = Constants.PROGRESS_START; + @StorageLink('enrollInfo') enrollInfo: any = $r('app.string.enroll_info'); + @StorageLink('enrollTitle') enrollTitle: any = $r('app.string.face_record'); + @StorageLink('showBtn') showBtn: boolean = false; + @StorageLink('showBack') showBack: boolean = true; + private credentialInfo; + + private aboutToAppear(): void { + setTimeout(()=> { + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView' + }); + }, 180000) + this.credentialInfo = { + credType:AUTHTYPE_FACE, + credSubType:SUBTYPE_FACE_2D, + token:AppStorage.Get('token') + }; + mFaceModel.initFaceModel(this.credentialInfo); + } + + private onPageHide() { + mFaceModel.uninitFaceModel(); + } + + private onBackPress(): void{ + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Image($r('app.media.image')) + .width('100%') + .height(Constants.CENTER_HEIGHT) + .align(Alignment.Center) + .position({x: $r('app.float.enroll_center_position_X'),y:Constants.ENROLL_CENTER_POSITION_Y}) + + Flex() + .width('100%') + .height(Constants.CENTER_HEIGHT) + .align(Alignment.Center) + .blur(this.blur) + .position({x:$r('app.float.enroll_center_position_X'),y: Constants.ENROLL_CENTER_POSITION_Y}) + .animation({ duration: Constants.SHELTER_ANIMATOR, curve: Curve.Linear }) + + if (this.showAperture) { + Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { + Image($r('app.media.aperture1')) + .width(Constants.APERTURE1_WIDTH) + .height(Constants.APERTURE1_WIDTH) + .align(Alignment.Center) + } + .position({x:$r('app.float.enroll_center_position_X'),y:Constants.ENROLL_CENTER_POSITION_Y}) + .height(Constants.CENTER_HEIGHT) + .width('100%') + } + + Flex() + .width('100%') + .height(Constants.ENROLL_CENTER_POSITION_Y) + + Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { + Image($r('app.media.shelter')) + .width(this.width) + .height(this.height) + .animation({ duration: Constants.SHELTER_ANIMATOR, curve: Curve.Linear }) + }.width('100%') + .height(Constants.CENTER_HEIGHT) + + + if(this.showPrg) { + Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { + Progress({ value: Constants.PROGRESS_START, total: Constants.PROGRESS_TOTAL, style: ProgressStyle.Capsule }) + .value(this.prgValue) + .width(Constants.PROGRESS_WIDTH) + .color(Color.Red) + }.position({x:$r('app.float.enroll_center_position_X'),y:Constants.ENROLL_CENTER_POSITION_Y}) + .height(Constants.CENTER_HEIGHT) + .width('100%') + } + + if(this.showBack) { + Flex() { + Image($r('app.media.back')) + .width(Constants.BACK_WIDTH) + .height(Constants.BACK_HEIGHT) + .onClick(() => { + router.back() + }) + }.position({ x: $r('app.float.enroll_center_position_X'), y: Constants.CENTER_POSITION_Y }) + } + + Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { + Text(this.enrollTitle) + .fontSize(Constants.TITLE_FONT_SIZE) + .fontWeight(Constants.ENROll_TITLE) + }.position({x:$r('app.float.enroll_title_position_X'),y:Constants.TITLE_ENROLLING_MARGIN}) + + Flex({justifyContent:FlexAlign.Center}) { + Text(this.enrollInfo) + .fontSize(Constants.ERROR_CODE_INFO_SIZE) + .textAlign(TextAlign.Center) + } + .position({ x:$r('app.float.enroll_info_X'), y: Constants.ENROLL_INFO_POSITION}) + .width(Constants.ENROLL_INFO_WIDTH) + + if(this.showBtn){ + Flex({justifyContent:FlexAlign.Center}) { + Button({ type: ButtonType.Capsule, stateEffect: true }) { + Text($r('app.string.enroll_button_content')) + .fontSize(Constants.BUTTON_FONT_SIZE) + .fontColor($r('app.color.startView_color')) + } + .backgroundColor($r('app.color.newBtn_color')) + .width(Constants.BUTTON_WIDTH) + .height(Constants.BUTTON_HEIGHT) + .onClick(() => { + route_back() + }) + }.position({ x:$r('app.float.enroll_center_position_X'), y: Constants.BUTTON_POSITION}) + } + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/pages/entryView.ets b/ui/faceenroll/product/pad/src/main/ets/default/pages/entryView.ets new file mode 100644 index 0000000000000000000000000000000000000000..4e8b9d317cf332e938967f64cde53c20e891e3e2 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/pages/entryView.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; +import UserAuthPresenter from '../../../../../../../common/src/main/ets/default/common/presenter/UserAuthPresenter.ets' + +let mUserAuthPresenter: UserAuthPresenter; + +@Entry +@Component +struct entryView { + + @State open_userAuth: boolean = false; + + private aboutToAppear(): void { + AppStorage.Delete('faceInfo'); + AppStorage.Delete('authLength'); + AppStorage.Delete('userMode'); + AppStorage.Delete('faceToken'); + mUserAuthPresenter = UserAuthPresenter.getInstance(); + } + build() { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('人脸识别', { type: ButtonType.Normal, stateEffect: true}) + .onClick(() => { + mUserAuthPresenter.jumpToUserAuth(this.getTokenCallBack.bind(this)); + }) + } + } + + public getTokenCallBack() { + let faceToken = AppStorage.Get('faceToken'); + if (faceToken != undefined) { + this.jumpToUserAuth(); + } + } + + private jumpToUserAuth() { + router.push({ + uri: 'pages/userAuth', + }) + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/pages/index.ets b/ui/faceenroll/product/pad/src/main/ets/default/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..26b14d1de8ac90a67de2453f2a90f76d702fc3d3 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/pages/index.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import StartViews_2D from "./startViews_2D.ets"; +import StartViews_3D from "./startViews_3D.ets"; +import Constants from "../common/constant.ets"; +import router from '@system.router'; + +@Entry +@Component +struct Index { + @StorageLink('show_startViews') show_startViews: string = Constants.SHOW_START_VIEWS_2D; + private onBackPress(): void{ + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) + } + build() { + + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + if (this.show_startViews == Constants.SHOW_START_VIEWS_3D) { + StartViews_3D(); + } + else if(this.show_startViews == Constants.SHOW_START_VIEWS_2D) + { + StartViews_2D(); + } + } + .width('100%') + .height('100%') + } +} diff --git a/ui/faceenroll/product/pad/src/main/ets/default/pages/startViews_2D.ets b/ui/faceenroll/product/pad/src/main/ets/default/pages/startViews_2D.ets new file mode 100644 index 0000000000000000000000000000000000000000..e8f5db2a6ad70b3499334cb67cefc2ddb5c230a1 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/pages/startViews_2D.ets @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import router from '@system.router'; +import Constants from '../common/constant.ets'; +import mFaceModel from "../model_2D.ets"; + +async function routeDeclare() { + let options = { + uri: 'pages/declare' + } + try { + await router.push(options); + } catch (err) { + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); + } +} +async function routeEnroll_2D() { + let options = { + uri: 'pages/enroll_2D' + } + try { + await router.push(options); + } catch (err) { + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); + } +} + +@Entry +@Component +export default +struct StartViews_2D { + @StorageLink('checkbox_color') checkbox_color : any = $r('app.color.startView_color'); + private pageHideFlag: number = 0; + + public openSessionCallBack() { + routeEnroll_2D(); + } + + private onPageHide(): void { + if (this.pageHideFlag == 0) { + router.push({ + uri: 'pages/entryView' + }) + } + } + private onBackPress(): void{ + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + + Flex() { + Image($r('app.media.back')) + .width(Constants.BACK_WIDTH) + .height(Constants.BACK_HEIGHT) + .onClick(()=>{ + }) + }.margin({ top: $r('app.float.back_margin') }) + .width('100%') + + Text($r('app.string.face_checker')) + .fontSize(Constants.TITLE_FONT_SIZE) + .fontWeight(FontWeight.Bold) + .margin({ top: Constants.TITLE_MARGIN }) + + Image($r('app.media.startImage_2D')) + .width('100%') + .height(Constants.IMAGE_2D_HEIGHT) + .margin({ top: Constants.IMAGE_MARGIN}) + + Column() { + Text($r('app.string.enroll_face_guide_title')) + .fontSize(Constants.SMALL_TITLE_FONT_SIZE) + .fontWeight(Constants.FONT_WEIGHT) + .textAlign(TextAlign.Center) + + Text($r('app.string.face_guide_2d_way')) + .fontSize(Constants.FONT_SIZE) + .fontColor($r('app.color.font_color')) + .textAlign(TextAlign.Center) + .margin({ top: Constants.CONTENT1_MARGIN }) + + Text() { + Span($r('app.string.face_guide_2d_announce')) + .fontColor($r('app.color.font_color')) + .textCase(TextCase.UpperCase) + .fontSize(Constants.FONT_SIZE) + Span($r('app.string.face_guide_2d_announce_link')) + .textCase(TextCase.UpperCase) + .fontSize(Constants.FONT_SIZE) + .fontColor($r('app.color.startView_color')) + }.margin({ top: Constants.CONTENT2_MARGIN }) + .textAlign(TextAlign.Center) + .onClick(() => { + routeDeclare() + }) + + }.width(Constants.ENROLL_INFO_WIDTH) + .margin({ top: Constants.IMAGE_MARGIN }) + + Flex() { + Toggle({ type: ToggleType.Checkbox, isOn: true }) + .size({ width: Constants.CHECKBOX_SIZE, height: Constants.CHECKBOX_SIZE }) + .selectedColor(this.checkbox_color) + .onChange((isOn: boolean) => {console.info('Component status:' + isOn) + }) + }.position({x:Constants.CHECKBOX_POSITION_X,y:Constants.CHECKBOX_POSITION_Y}) + + Text($r('app.string.face_2dguide_light_notify_universal')) + .fontSize(Constants.FONT_SIZE) + .fontColor(Color.Black) + .position({x:Constants.CHECKBOX_TEXT_POSITION_X,y:Constants.CHECKBOX_TEXT_POSITION_Y}) + + Flex({justifyContent:FlexAlign.Center}) { + Button({ type: ButtonType.Capsule, stateEffect: true }) { + Text($r('app.string.face_record')).fontSize(Constants.BUTTON_FONT_SIZE).fontColor(0xffffff) + } + .backgroundColor($r('app.color.startView_color')).width(Constants.BUTTON_WIDTH).height(Constants.BUTTON_HEIGHT) + .onClick(() => { + this.pageHideFlag = 1; + mFaceModel.openSession(this.openSessionCallBack.bind(this)); + }) + }.position({ x:$r('app.float.enroll_center_position_X'), y: Constants.BUTTON_POSITION}) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/pages/startViews_3D.ets b/ui/faceenroll/product/pad/src/main/ets/default/pages/startViews_3D.ets new file mode 100644 index 0000000000000000000000000000000000000000..db833ab26dab92b72026e716c6d10a6a4b714991 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/pages/startViews_3D.ets @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import router from '@system.router'; +import Constants from '../common/constant.ets'; +import mFaceModel from "../model_3D.ets"; + +async function routeEnroll_3D() { + let options = { + uri: 'pages/enroll_3D' + } + try { + await router.push(options); + } catch (err) { + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); + } +} +async function routeDeclare() { + let options = { + uri: 'pages/declare' + } + try { + await router.push(options); + } catch (err) { + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); + } +} + + +@Entry +@Component + +export default + +struct StartViews_3D { + @StorageLink('checkbox_color') checkbox_color : any = $r('app.color.startView_color'); + private pageHideFlag: number = 0; + + public openSessionCallBack() { + routeEnroll_3D(); + } + + private onPageHide(): void { + if (this.pageHideFlag == 0) { + router.push({ + uri: 'pages/entryView' + }) + } + } + + private onBackPress(): void{ + console.info("FaceEnroll StartViews_3D onBackPress start"); + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) + console.info("FaceEnroll StartViews_3D onBackPress end"); + } + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center}) { + + Flex() { + Image($r('app.media.back')) + .width(Constants.BACK_WIDTH) + .height(Constants.BACK_HEIGHT) + .onClick(()=>{ + }) + }.margin({ top: $r('app.float.back_margin') }) + .width('100%') + + Text($r('app.string.face_checker')) + .fontSize(Constants.TITLE_FONT_SIZE) + .fontWeight(FontWeight.Bold) + .margin({ top: Constants.TITLE_MARGIN }) + + Stack(){ + Image($r('app.media.startImage1_3D')) + .width(Constants.IMAGE_3D_WIDTH) + .height(Constants.IMAGE_3D_WIDTH) + + Image($r('app.media.startImage2_3D')) + .width(Constants.IMAGE_3D_WIDTH) + .height(Constants.IMAGE_3D_WIDTH) + + }.margin({top:Constants.IMAGE_3D_MARGIN}) + .width('100%') + .height(Constants.IMAGE_3D_WIDTH) + + Column() { + Text($r('app.string.enroll_face_guide_title')) + .fontSize(Constants.SMALL_TITLE_FONT_SIZE) + .fontWeight(Constants.FONT_WEIGHT) + .textAlign(TextAlign.Center) + + Text($r('app.string.face_guide_3d_way')) + .fontSize(Constants.FONT_SIZE) + .fontColor($r('app.color.font_color')) + .textAlign(TextAlign.Center) + .margin({ top: Constants.CONTENT1_MARGIN }) + + Text() { + Span($r('app.string.face_guide_3d_announce')) + .fontColor($r('app.color.font_color')) + .textCase(TextCase.UpperCase) + .fontSize(Constants.FONT_SIZE) + Span($r('app.string.face_guide_3d_announce_link')) + .textCase(TextCase.UpperCase) + .fontSize(Constants.FONT_SIZE) + .fontColor($r('app.color.startView_color')) + } + .margin({ top: Constants.CONTENT2_MARGIN }) + .textAlign(TextAlign.Center) + .onClick(() => { + routeDeclare() + }) + }.width(Constants.ENROLL_INFO_WIDTH) + .margin({ top: Constants.IMAGE_MARGIN }) + + Flex() { + Toggle({ type: ToggleType.Checkbox, isOn: true }) + .size({ width: Constants.CHECKBOX_SIZE, height: Constants.CHECKBOX_SIZE }) + .selectedColor(this.checkbox_color) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + }.position({x:Constants.CHECKBOX_POSITION_X,y:Constants.CHECKBOX_POSITION_Y}) + + Text($r('app.string.face_2dguide_light_notify_universal')) + .fontSize(Constants.FONT_SIZE) + .fontColor(Color.Black) + .position({x:Constants.CHECKBOX_TEXT_POSITION_X,y:Constants.CHECKBOX_TEXT_POSITION_Y}) + + Flex({justifyContent:FlexAlign.Center}) { + Button({ type: ButtonType.Capsule, stateEffect: true }) { + Text($r('app.string.face_recognitin_guide')).fontSize(Constants.BUTTON_FONT_SIZE).fontColor(0xffffff) + } + .backgroundColor($r('app.color.startView_color')) .width(Constants.BUTTON_WIDTH).height(Constants.BUTTON_HEIGHT) + .onClick(() => { + this.pageHideFlag = 1; + mFaceModel.openSession(this.openSessionCallBack.bind(this)); + }) + }.position({ x:$r('app.float.enroll_center_position_X'), y: Constants.BUTTON_POSITION}) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/pages/success.ets b/ui/faceenroll/product/pad/src/main/ets/default/pages/success.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e6d620f488a59c83ffe2381e001ecc63dec00ea --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/pages/success.ets @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; +import Constants from '../common/constant.ets'; + +async function routeCase() { + let options = { + uri: 'pages/entryView' + } + try { + await router.push(options); + } catch (err) { + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); + } +} + +@Entry +@Component +struct Success { + + onPageShow(){ + setTimeout(()=>{ + router.push({ + uri: 'pages/userAuth' + }) + },Constants.TIMEOUT_2000) + } + private onBackPress(): void{ + console.info("FaceEnroll Success onBackPress start"); + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) + console.info("FaceEnroll Success onBackPress end"); + } + + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Flex() { + Image($r('app.media.back')) + .width(Constants.BACK_WIDTH) + .height(Constants.BACK_HEIGHT) + }.margin({ top: $r('app.float.back_margin') }) + .onClick(()=>{ + routeCase() + }) + + Text($r('app.string.face_record_success')) + .fontSize(Constants.TITLE_FONT_SIZE) + .fontWeight(FontWeight.Bold) + .margin({ top: Constants.TITLE_MARGIN}) + + Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}){ + Image($r('app.media.success')) + .width(Constants.SUCCESS_WIDTH) + .height(Constants.SUCCESS_WIDTH) + }.width('100%') + .height(Constants.SUCCESS_WIDTH) + .margin({ top: $r('app.float.success_margin') }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/pages/userAuth.ets b/ui/faceenroll/product/pad/src/main/ets/default/pages/userAuth.ets new file mode 100644 index 0000000000000000000000000000000000000000..b790f42132cab39b7fd2bdc82b64e5dc56e8c943 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/pages/userAuth.ets @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; +import userAuthModel from '../../../../../../../common/src/main/ets/default/common/model/userAuthModel.ets'; + +@Entry +@Component +struct userAuth { + @State authLength: number = 0; + @State userMode: string = ''; + private mUserAuthModel: userAuthModel; + private faceInfo ; + @State faceToken: string = ''; + @State getAllCallback: boolean = false; + + private aboutToAppear(): void { + this.mUserAuthModel = userAuthModel.getInstance(); + this.faceToken = AppStorage.Get('faceToken'); + if (this.mUserAuthModel != undefined) { + this.mUserAuthModel.getUserAuthInfo(this.getAuthInfoCallback.bind(this),this.getUserMode.bind(this)); + } + } + + public getUserMode() { + this.mUserAuthModel.getUserMode(this.getUserModeCallback.bind(this)); + } + + onPageShow() { + if (this.faceToken == '' || this.faceToken == undefined) { + router.push({ + uri: 'pages/entryView', + }) + } + } + + public getAuthInfoCallback(authInfo,getUserMode) { + this.faceInfo = authInfo; + this.authLength = authInfo.length; + AppStorage.SetOrCreate('authLength',this.authLength); + AppStorage.SetOrCreate('faceInfo',this.faceInfo); + AppStorage.SetOrCreate('facePageFlag',0); + getUserMode(); + } + + public getUserModeCallback(userMode) { + this.userMode = userMode; + AppStorage.SetOrCreate('userMode',this.userMode); + this.getAllCallback = true; + + } + + build() { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + if (this.getAllCallback) { + getRouter({ + authLength: this.authLength + }) + + } + } + } +} + +@Component +struct getRouter{ + @Prop authLength: number; + public aboutToAppear() { + if (this.authLength == 0) { + router.push({ + uri: 'pages/index', + }) + }else if(this.authLength > 0) { + router.push({ + uri: 'pages/userSettings', + }) + } + } + + build() { + Column() {} + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/ets/default/pages/userSettings.ets b/ui/faceenroll/product/pad/src/main/ets/default/pages/userSettings.ets new file mode 100644 index 0000000000000000000000000000000000000000..80e36c7337eb1895b33395d49b2a8874e1f4c81f --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/ets/default/pages/userSettings.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import faceSettings from '../../../../../../../feature/faceSettingsPad/src/main/ets/default/pages/index.ets' +import TrustedDevices from '../../../../../../../feature/trustedDevicePad/src/main/ets/default/pages/index.ets' +import router from '@system.router'; + +@Entry +@Component +struct userSettings { + @State authLength: number = 1; + @State userMode: string = ''; + @StorageLink('facePageFlag') facePageFlag: number = 0; + private faceInfo; + private faceToken; + + private aboutToAppear(): void { + this.faceInfo = AppStorage.Get('faceInfo'); + this.authLength = AppStorage.Get('authLength'); + this.userMode = AppStorage.Get('userMode'); + } + + private onPageHide(): void { + router.push({ + uri: 'pages/entryView' + }) + } + private onBackPress(): void{ + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) + } + + build() { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + if(this.authLength != 0) { + if (this.facePageFlag == 0) { + faceSettings({ + faceLength: this.authLength, + userMode: this.userMode + }); + }else if(this.facePageFlag == 1) { + TrustedDevices(); + } + } + } + .width('100%') + .height('100%') + .backgroundColor('#F2F3F5') + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/resources/base/element/color.json b/ui/faceenroll/product/pad/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..c7bec9183d66804c75c47fd257f9b7f460c848ed --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/resources/base/element/color.json @@ -0,0 +1,18 @@ +{ + "color": [ + { + "name": "font_color", + "value": "#99000000" + }, + { + "name": "startView_color", + "value": "#0A59F7" + }, + { + "name": "newBtn_color", + "value": "#efefef" + } + + + ] +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/resources/base/element/float.json b/ui/faceenroll/product/pad/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..4863becf2a5cb00953eb747eef61dd9841a8bd04 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/resources/base/element/float.json @@ -0,0 +1,70 @@ +{ + "float": [ + + { + "name": "back_margin", + "value": "5" + }, + { + "name": "enroll_title_position_X", + "value": "0" + }, + { + "name": "startImage_3D_width", + "value": "256" + }, + + { + "name": "checkbox_size", + "value": "25" + }, + { + "name": "enroll_center_position_X", + "value": "0" + }, + { + "name": "enroll_info_X", + "value": "20" + }, + { + "name": "progress_width", + "value": "230" + }, + { + "name": "progress_value_start", + "value": "0" + }, + { + "name": "blur_start", + "value": "0" + }, + { + "name": "blur_end", + "value": "40" + }, + { + "name": "aperture1_width", + "value": "133" + }, + { + "name": "aperture2_width", + "value": "132" + }, + { + "name": "aperture34_width", + "value": "142" + }, + { + "name": "aperture5_width", + "value": "233" + }, + { + "name": "success_image", + "value": "102" + }, + { + "name": "success_margin", + "value": "100" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/resources/base/element/string.json b/ui/faceenroll/product/pad/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3f4e5c813307a4ddd39620b9c2607ce4cb1e1ed3 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/resources/base/element/string.json @@ -0,0 +1,792 @@ +{ + "string": [ + { + "name": "app_name", + "value": "faceEnroll" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "description_product", + "value": "ETS_Empty Ability" + }, + { + "name": "entry_product", + "value": "entry_product" + }, + { + "name": "enrolling", + "value": "正在录入" + }, + { + "name": "enrolling_fail", + "value": "录入失败" + }, + { + "name": "enrolling_timeout", + "value": "录入超时" + }, + { + "name": "declare", + "value": "声明" + }, + { + "name": "declare_content", + "value": "如果您选择添加人脸数据,在亮屏状态,您将可以通过正面注视手机屏幕瞬间解锁。人脸数据储存在您的设备,而且不会通过云服务或者其他工具备份他处。" + }, + { + "name": "open_clock", + "value": "打开”拿起手机亮屏“,提升解锁体验" + }, + { + "name": "face_enroll", + "value": "人脸识别" + }, + { + "name": "enroll_success", + "value": "录入成功" + }, + { + "name": "start_title", + "value": "如何录入面部数据" + }, + { + "name": "start_2D_content1", + "value": "首先,确保摄像头清洁、面部无遮挡,录入环境光线充足、无阳光直射。然后,正对屏幕,将面部完整移入识别区。" + }, + { + "name": "start_2D_content2", + "value": "人脸识别可用于解锁屏幕及访问应用锁。点击“开始录入”即表示您同意" + }, + { + "name": "start_2D_content3", + "value": "关于人脸识别的声明。" + }, + { + "name": "start_3D_content1", + "value": "首先,请确保您的面部全部显示在识别区内。然后注视屏幕并缓缓转动头部以完成全方位采集。" + }, + { + "name": "start_3D_content2", + "value": "人脸识别可用于解锁屏幕,访问应用锁、保密柜及支付。点击“开始录入”即表示您同意" + }, + { + "name": "start_3D_content3", + "value": "关于3D人脸识别的声明。" + }, + { + "name": "button_content", + "value": "开始录入" + }, + { + "name": "enroll_info_fail", + "value": "请确保摄像头清洁,面部无遮挡,在光线充足、无阳光直射的环境里录入。" + }, + { + "name": "enroll_info", + "value": "请保持不动" + }, + { + "name": "enroll_info_cancel", + "value": "被取消" + }, + { + "name": "enroll_info_algorithm_not_init", + "value": "算法未初始化" + }, + { + "name": "enroll_info_hal_invalid", + "value": "人脸识别demon不可用" + }, + { + "name": "enroll_info_over_max_faces", + "value": "录入超过最大上限" + }, + { + "name": "enroll_info_invalid_parameters", + "value": "入参无效" + }, + { + "name": "enroll_info_busy", + "value": "人脸流程正在进行中,请求busy" + }, + { + "name": "enroll_info_has_registered", + "value": "当前人脸已经录入过" + }, + { + "name": "enroll_info_bad_quality", + "value": "图像质量太差" + }, + { + "name": "enroll_info_not_found", + "value": "没检测到人脸" + }, + { + "name": "enroll_info_scale_too_small", + "value": "人脸太小" + }, + { + "name": "enroll_info_scale_too_large", + "value": "人脸太大" + }, + { + "name": "enroll_info_offset_left", + "value": "人脸太靠左" + }, + { + "name": "enroll_info_offset_top", + "value": "人脸太靠上" + }, + { + "name": "enroll_info_offset_right", + "value": "人脸太靠右" + }, + { + "name": "enroll_info_offset_bottom", + "value": "人脸太靠下" + }, + { + "name": "enroll_info_liveness_warning", + "value": "活体检测有风险" + }, + { + "name": "enroll_info_liveness_failure", + "value": "活体检测失败" + }, + { + "name": "enroll_info_rotated_left", + "value": "头向左转的角度太大" + }, + { + "name": "enroll_info_rise", + "value": "头抬的角度太高" + }, + { + "name": "enroll_info_face_has_registered", + "value": "转动头部" + }, + { + "name": "enroll_info_rotated_right", + "value": "头向右转的角度太大" + }, + { + "name": "enroll_info_down", + "value": "头抬的角度太低" + }, + { + "name": "enroll_info_eye_occlusion", + "value": "眼睛不清晰" + }, + { + "name": "enroll_info_eye_close", + "value": "闭眼" + }, + { + "name": "enroll_info_mouth_occlusion", + "value": "嘴巴不清晰" + }, + { + "name": "enroll_info_mutlify", + "value": "出现多张脸" + }, + { + "name": "enroll_info_blur", + "value": "脸不清晰" + }, + { + "name": "enroll_info_not_complete", + "value": "脸不完整" + }, + { + "name": "enroll_info_darklight", + "value": "光线太暗" + }, + { + "name": "enroll_info_highlight", + "value": "光线太强" + }, + { + "name": "enroll_info_half_shadow", + "value": "阴阳脸" + }, + { + "name": "enroll_info_darkpic", + "value": "图片太暗" + }, + { + "name": "enroll_info_rotate_top_right", + "value": "人脸头顶朝右" + }, + { + "name": "enroll_info_rotate_top_left", + "value": "人脸头顶朝左" + }, + { + "name": "enroll_info_rotate_bottom_right", + "value": "人脸下巴朝右" + }, + { + "name": "enroll_info_rotate_bottom_left", + "value": "人脸下巴朝左" + }, + { + "name": "enroll_info_open_camera_failed", + "value": "打开Camera失败" + }, + { + "name": "enroll_button_content", + "value": "重新录入" + }, + { + "name": "deleteTitle", + "value": "删除数据" + } ,{ + "name": "face_introdution_title", + "value": "解锁时需连接可信设备" + }, + { + "name": "face_introdution_tip", + "value": "进行人脸识别解锁手机时,需连接可信设备以进一步提升安全性。" + }, + { + "name": "trusted_devices_title", + "value": "可信设备" + }, + { + "name": "face_introdution_button", + "value": "添加可信设备" + }, + { + "name": "connect_tip", + "value": "已连接" + }, + { + "name": "disconnect_tip", + "value": "未连接" + }, + { + "name": "cancel_button", + "value": "取消" + }, + { + "name": "remove_device_button", + "value": "移除" + }, + { + "name": "add_device_button", + "value": "添加" + }, + { + "name": "remove_device_tip", + "value": "移除后,人脸识别解锁本机时将不再需要连接可信设备。是否移除?" + }, + { + "name": "remove_device_title", + "value": "移除可信设备" + }, + { + "name": "add_device_or_not_tip", + "value": "是否添加" + }, + { + "name": "using_tips", + "value": "使用提示" + }, + { + "name": "add_device_tip", + "value": "添加后,当可信设备与本机断开连接时,将无法使用人脸识别解锁。您可以使用其他方式解锁。" + } + + + , + { + "name": "face_guide_2d_announce_link", + "value": "关于人脸识别的声明" + }, + { + "name": "face_feature_desc", + "value": "功能介绍" + }, + { + "name": "face_recognize_annouce_message_01", + "value": "人脸识别是一种基于人的脸部特征信息进行身份识别的生物识别技术。它通过手机前置摄像头捕捉人脸面部数据,进而快速完成面部特征比对和身份认证。可用于解锁屏幕、访问应用锁等场景。" + }, + { + "name": "face_recognize_annouce_message_02", + "value": "录入面部数据时,需注意以下事项:" + }, + { + "name": "face_recognize_annouce_message_03", + "value": "1.确保摄像头清洁;" + }, + { + "name": "face_recognize_annouce_message_04", + "value": "2.在光线充足的环境下录入,但需避免强光直射;" + }, + { + "name": "face_recognize_annouce_message_05", + "value": "3.勿用衣帽、头发、墨镜、口罩、浓妆等遮挡面部;" + }, + { + "name": "face_recognize_annouce_message_06", + "value": "4.确保面部正面完整清晰地出现在提示框内,不要闭眼、大幅度仰头或低头" + }, + { + "name": "face_recognize_annouce_message_07", + "value": "5.避免其他人出现在录入画面中。" + }, + { + "name": "face_recognize_annouce_message_08", + "value": "任何技术都存在一定局限和风险,使用人脸识别时,需注意以下事项:" + }, + { + "name": "face_recognize_annouce_message_09", + "value": "1.在暗光、强光、逆光或角度过大等场景下,人脸识别的成功率会有所降低;" + }, + { + "name": "face_annouce_tip1_item2_3d", + "value": "2.人脸识别的安全性低于图案密码、数字密码、混合密码。;" + }, + { + "name": "face_recognize_annouce_message_10", + "value": "您的设备可能会被容貌、外形与您相近的人或物品解锁;" + }, + { + "name": "face_recognize_annouce_message_11", + "value": "请勿将设备随意交给他人使用,避免人脸识别功能被恶意利用;" + }, + { + "name": "face_recognize_annouce_message_12", + "value": "除以上事项外,您还需注意其他可能影响人脸识别功能正常使用的情况。" + }, + { + "name": "face_recognize_annouce_message_13", + "value": "隐私声明" + }, + { + "name": "face_recognize_annouce_message_14_1", + "value": "您的" + }, + { + "name": "face_recognize_annouce_message_14_2", + "value": "将受到严格保护。该数据仅加密保存于本设备的安全隔离区域,华为不会进行备份,其他应用也无法访问或备份。例如,您使用人脸识别进行应用内认证时,应用仅能收到认证是否成功的通知,而无法访问、备份或录入" + }, + { + "name": "face_recognize_annouce_message_14_3", + "value": "面部数据。" + }, + { + "name": "face_recognize_annouce_message_15_1", + "value": "您拥有人脸识别的自主控制权,可灵活控制人脸识别的使用及适用范围。例如,您不想使用人脸识别访问应用锁,在“设置”中将其关闭即可,此时人脸识别仍可用于其他操作,但不可用于进入应用锁。您还可彻底删除" + }, + { + "name": "face_recognize_annouce_message_15_2", + "value": "删除后本设备将不再保存这些数据。" + }, + + { + "name": "face_recognize_annouce_message_15_3", + "value": "" + }, + { + "name": "face_recognize_annouce_message_15_4", + "value": "" + }, + { + "name": "face_guide_3d_announce_link", + "value": "关于3D人脸识别的声明" + }, + { + "name": "face_3drecognize_annouce_message_01", + "value": "3D人脸识别是新一代人脸识别技术。它通过深度感应技术,捕捉更丰富的面部数据,实现三维立体防伪识别。在暗光、逆光、无光等环境下,也可用于解锁屏幕,访问应用锁、保密柜及支付,其安全性、准确率和环境适应性较传统人脸识别技术大幅提升。" + } + + + + , + { + "name": "face_recognition", + "value": "人脸识别" + }, + { + "name": "face_recognition_is_used", + "value": "人脸识别用于" + }, + { + "name": "unlock_screen", + "value": "解锁屏幕" + }, + { + "name": "slide_to_unlock", + "value": "滑动解锁" + }, + { + "name": "smart_display_lock_screen_notification", + "value": "智能显示锁屏通知" + }, + { + "name": "access_safe", + "value": "访问保密柜" + }, + { + "name": "access_app_lock", + "value": "访问应用锁" + }, + { + "name": "automatically_fill_in_account", + "value": "自动填充账号和密码" + }, + { + "name": "use_password_safe_to_save_account", + "value": "使用密码保险箱保存账号和密码" + }, + { + "name": "delete_face_data", + "value": "删除面部数据" + }, + { + "name": "set_backup_face", + "value": "设置备用面容" + }, + { + "name": "recognize_another_face", + "value": "除继续学习您的长相外,还可识别另一种面容" + }, + { + "name": "main_and_backup_faces", + "value": "已设置主用及备用面容" + }, + { + "name": "trusted_device_be_connected_when_unlocking", + "value": "解锁时需连接可信设备" + }, + { + "name": "closed", + "value": "已关闭" + }, + { + "name": "look_at_screen_during_face_recognition", + "value": "人脸识别时需注视屏幕" + }, + { + "name": "fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "auxiliary_mode", + "value": "辅助模式" + }, + { + "name": "recognize_without_opening_eyes", + "value": "开启屏幕朗读后无需睁眼即可识别" + }, + { + "name": "be_based_on_facial_feature_information", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + { + "name": "statement_on_face_recognition", + "value": "关于人脸识别的声明。" + }, + { + "name": "statement3D_on_face_recognition", + "value": "关于3D人脸识别的声明。" + }, + { + "name": "looking_for_other_settings", + "value": "是否在寻找其设置项?" + }, + { + "name": "pick_up_phone_turn_on_screen", + "value": "拿起手机亮屏" + }, + { + "name": "annotation_screen_keeps_on", + "value": "注视屏幕不息屏" + }, + { + "name": "unlock_directly", + "value": "直接解锁" + }, + { + "name": "unlock_directly_after_successful_face_recognition", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "Slide_to_unlock_after_successful_face_recognition", + "value": "人脸识别成功后滑动屏幕解锁" + }, + { + "name": "close", + "value": "关闭" + }, + { + "name": "enable", + "value": "启用" + }, + { + "name": "activate_safe", + "value": "启动保密柜" + }, + { + "name": "whether_to_enable_safe", + "value": "需开启应用文件管理保密柜完成人脸关联。是否启用?" + }, + + { + "name": "activate_app_lock", + "value": "启动应用锁" + }, + { + "name": "Whether_to_activate_app_lock", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启动应用锁?" + }, + { + "name": "delete_all_face_data", + "value": "删除主用及备用面容" + }, + { + "name": "wether_delete_face_data", + "value": "删除后,基于面部数据的功能将不可用。是否删除?" + }, + { + "name": "pick_up_phone", + "value": "同时关闭拿起手机亮屏" + }, + + + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "face_lists", + "value": "面部列表" + }, + { + "name": "face_1", + "value": "面部1" + }, + { + "name": "face", + "value": "面部" + }, + { + "name": "new_face", + "value": "新建面部数据" + }, + { + "name": "face_name", + "value": "面部名称" + }, + { + "name": "delete_face", + "value": "删除面部" + }, + { + "name": "save", + "value": "保存" + }, + + { + "name": "face_checker", + "value": "人脸识别" + }, + + { + "name": "face_unlock_method", + "value": "解锁屏幕" + }, + { + "name": "face_recognize_slideunlock_title", + "value": "滑动解锁" + }, + { + "name": "title_apps_security_pref", + "value": "访问应用锁" + }, + { + "name": "title_fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "recommend_preference_title", + "value": "是否在寻找其他设置项?" + }, + { + "name": "face_config_light_01_universal", + "value": "拿起手机亮屏" + }, + { + "name": "multiface_list_title", + "value": "面部列表" + }, + { + "name": "multiface_default_face_name_1", + "value": "面部 1" + }, + { + "name": "multiface_default_face_name", + "value": "面部" + }, + { + "name": "multiface_enroll_new_face", + "value": "新建面部数据" + }, + { + "name": "multiface_face_name_title", + "value": "面部名称" + }, + + { + "name": "multiface_save", + "value": "保存" + }, + { + "name": "face_unlock_method_close", + "value": "关闭" + }, + { + "name": "face_recognize_unlock_title", + "value": "直接解锁" + }, + { + "name": "face_3dguide_info_2", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + + { + "name": "face_inform_open_applock_msg", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启用应用锁?" + }, + { + "name": "face_record_cancel", + "value": "取消" + }, + + { + "name": "face_recognize_unlock_summary_3d", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "face_recognize_slideunlock_summary_3d", + "value": "人脸识别成功后,滑动屏幕解锁" + }, + { + "name": "face_enterance_off", + "value": "已关闭" + }, + { + "name": "open_bluetooth", + "value": "使用此功能需先开启蓝牙,点击设置" + }, + { + "name": "no_available_devices_title", + "value": "没有可添加的设备" + }, + { + "name": "no_available_devices_tip", + "value": "没有检测到可添加的配对设备。是否前往蓝牙设置配对?" + }, + { + "name": "pair_button", + "value": "去配对" + }, + { + "name": "face_fingerprint_settings_switch_title", + "value": "自动填充账号和密码" + }, + { + "name": "face_fingerprint_settings_switch_summary", + "value": "使用密码保险箱保存的帐号和密码" + } + , + { + "name": "face_record", + "value": "正在录入" + }, + { + "name": "face_record_3d_record_fail", + "value": "录入失败" + }, + { + "name": "enroll_face_guide_title", + "value": "如何录入面部数据" + }, + { + "name": "face_guide_2d_way", + "value": "首先,确保摄像头清洁、面部无遮挡,录入环境光线充足、无阳光直射。然后,正对屏幕,将面部完整移入识别区。" + }, + { + "name": "face_guide_2d_announce", + "value": "人脸识别可用于解锁屏幕及访问应用锁。点击“开始录入”即表示您同意" + }, + { + "name": "face_2dguide_light_notify_universal", + "value": "打开”拿起手机亮屏“,提升解锁体验" + }, + { + "name": "face_guide_3d_way", + "value": "首先,请确保您的面部全部显示在识别区内。然后注视屏幕并缓缓转动头部以完成全方位采集。" + }, + { + "name": "face_guide_3d_announce", + "value": "人脸识别可用于解锁屏幕,访问应用锁、保密柜及支付。点击“开始录入”即表示您同意" + }, + { + "name": "face_recognitin_guide", + "value": "开始录入" + }, + { + "name": "face_record_success", + "value": "录入成功" + }, + { + "name": "face_record_3d_tip_close", + "value": "人脸太小" + }, + { + "name": "face_record_3d_tip_far", + "value": "人脸太大" + }, + { + "name": "face_enroll_too_left", + "value": "人脸太靠左" + }, + { + "name": "face_enroll_too_high", + "value": "人脸太靠上" + }, + { + "name": "face_enroll_too_right", + "value": "人脸太靠右" + }, + { + "name": "face_enroll_too_low", + "value": "人脸太靠下" + }, + { + "name": "face_record_3d_tip_multi", + "value": "出现多张脸" + }, + { + "name": "face_rotate_too_left", + "value": "头向左转的角度太大" + }, + { + "name": "face_rotate_too_high", + "value": "头抬的角度太高" + }, + { + "name": "face_rotate_too_right", + "value": "头向右转的角度太大" + }, + { + "name": "face_rotate_too_low", + "value": "头抬的角度太低" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/aperture1.png b/ui/faceenroll/product/pad/src/main/resources/base/media/aperture1.png new file mode 100644 index 0000000000000000000000000000000000000000..697d7cc06b4d07480e4be454deae5f01033a6af8 Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/aperture1.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/aperture2.png b/ui/faceenroll/product/pad/src/main/resources/base/media/aperture2.png new file mode 100644 index 0000000000000000000000000000000000000000..39ce11d0e8673ba3ffdf9fac2518c38e89b87296 Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/aperture2.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/aperture3.png b/ui/faceenroll/product/pad/src/main/resources/base/media/aperture3.png new file mode 100644 index 0000000000000000000000000000000000000000..a827aab272f21abf994a0ddce573575049d6cdf3 Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/aperture3.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/aperture4.png b/ui/faceenroll/product/pad/src/main/resources/base/media/aperture4.png new file mode 100644 index 0000000000000000000000000000000000000000..381693d5621ea4a4d25ac60a5786d7a5a1369870 Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/aperture4.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/aperture5.png b/ui/faceenroll/product/pad/src/main/resources/base/media/aperture5.png new file mode 100644 index 0000000000000000000000000000000000000000..4618da2077a8fd87707c0f1932c375efb18bdd5d Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/aperture5.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/back.png b/ui/faceenroll/product/pad/src/main/resources/base/media/back.png new file mode 100644 index 0000000000000000000000000000000000000000..85dcc6ad6895ff1b4ef599be169e0df24a7b01b5 Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/back.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/iPad.png b/ui/faceenroll/product/pad/src/main/resources/base/media/iPad.png new file mode 100644 index 0000000000000000000000000000000000000000..d48706b244bcb700d5af35c3d599b2c9228501e1 Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/iPad.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/ic_settings_arrow.svg b/ui/faceenroll/product/pad/src/main/resources/base/media/ic_settings_arrow.svg new file mode 100644 index 0000000000000000000000000000000000000000..6aebbe7b504aa070dafcb5df58347bc151f0237e --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/resources/base/media/ic_settings_arrow.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/icon.png b/ui/faceenroll/product/pad/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/icon.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/image.jpg b/ui/faceenroll/product/pad/src/main/resources/base/media/image.jpg new file mode 100644 index 0000000000000000000000000000000000000000..86fc07358eea5c1474bc833fca07c6d4d8698a89 Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/image.jpg differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/into_arrow.svg b/ui/faceenroll/product/pad/src/main/resources/base/media/into_arrow.svg new file mode 100644 index 0000000000000000000000000000000000000000..d20cc39c31fe2f8bd414a84c678decd8383ac086 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/resources/base/media/into_arrow.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/pad.png b/ui/faceenroll/product/pad/src/main/resources/base/media/pad.png new file mode 100644 index 0000000000000000000000000000000000000000..d2147588d2884bbb85495be345bef5ada69bb5f6 Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/pad.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/phone.svg b/ui/faceenroll/product/pad/src/main/resources/base/media/phone.svg new file mode 100644 index 0000000000000000000000000000000000000000..b81e4e3637a98a33576cb875acb1fa9721b02e67 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/resources/base/media/phone.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/shelter.png b/ui/faceenroll/product/pad/src/main/resources/base/media/shelter.png new file mode 100644 index 0000000000000000000000000000000000000000..dfb40a6ee32262d1b91c750425739d17dac9724f Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/shelter.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/startImage1_3D.png b/ui/faceenroll/product/pad/src/main/resources/base/media/startImage1_3D.png new file mode 100644 index 0000000000000000000000000000000000000000..aa04ba19585617d4f8bfabfffd433675f87a51a1 Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/startImage1_3D.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/startImage2_3D.png b/ui/faceenroll/product/pad/src/main/resources/base/media/startImage2_3D.png new file mode 100644 index 0000000000000000000000000000000000000000..cd40d2e1350de5d41a158ca7a59444bef0baa18f Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/startImage2_3D.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/startImage_2D.png b/ui/faceenroll/product/pad/src/main/resources/base/media/startImage_2D.png new file mode 100644 index 0000000000000000000000000000000000000000..891a47b849108f2e50d832be1849ad30fbada858 Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/startImage_2D.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/base/media/success.png b/ui/faceenroll/product/pad/src/main/resources/base/media/success.png new file mode 100644 index 0000000000000000000000000000000000000000..5b5ae5f6dd26f882a3c91c6435cd06ce2c23ba50 Binary files /dev/null and b/ui/faceenroll/product/pad/src/main/resources/base/media/success.png differ diff --git a/ui/faceenroll/product/pad/src/main/resources/en_AS/element/string.json b/ui/faceenroll/product/pad/src/main/resources/en_AS/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1111b15ca16a2b68954cb148b375f9628967e266 --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/resources/en_AS/element/string.json @@ -0,0 +1,562 @@ +{ + "string": [ + { + "name": "app_name", + "value": "faceEnroll" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "deleteTitle", + "value": "delete" + }, + { + "name": "face_fingerprint_settings_switch_title", + "value": "Autofill usernames and passwords" + }, + { + "name": "face_fingerprint_settings_switch_summary", + "value": "Usernames and passwords are accessed from Password Vault." + }, + { + "name": "face_guide_2d_announce_link", + "value": "Statement About Face Recognition" + }, + { + "name": "face_feature_desc", + "value": "Feature description" + }, + { + "name": "face_recognize_annouce_message_01", + "value": "Face Recognition is a biometric identification technology that allows your phone to recognize the features of your face. It uses the front camera to capture facial data, and then compares it to pre-stored data to quickly verify your identity. You can use this feature to unlock your device, open locked apps, and more." + }, + { + "name": "face_recognize_annouce_message_02", + "value": "Please note the following when setting up this feature:" + }, + { + "name": "face_recognize_annouce_message_03", + "value": "1.Make sure that the camera lens is clean." + }, + { + "name": "face_recognize_annouce_message_04", + "value": "2.Scan your face in a well-lit environment, avoiding direct sunlight.;" + }, + { + "name": "face_recognize_annouce_message_05", + "value": "3.Avoid covering your face with items of clothing, hair, sunglasses, masks, or thick makeup." + }, + { + "name": "face_recognize_annouce_message_06", + "value": "4.Make sure your face is completely displayed in the frame. Look straight at the camera, and avoid raising and lowering your head or closing your eyes." + }, + { + "name": "face_recognize_annouce_message_07", + "value": "5.Make sure that no one else appears in the frame." + }, + { + "name": "face_recognize_annouce_message_08", + "value": "Please note the following when using Face Recognition:" + }, + { + "name": "face_recognize_annouce_message_09", + "value": "1.Face Recognition may not work as well in dim, very bright, or backlit environments, or if the angle between your face and the camera is too great." + }, + { + "name": "face_annouce_tip1_item2_3d", + "value": "2.Face Recognition is less secure than other unlock methods such as Pattern, PIN, and Password." + }, + { + "name": "face_recognize_annouce_message_10", + "value": "There is a small chance that your device may be unlocked by people that closely resemble you or by objects that represent close depictions of your likeness." + }, + { + "name": "face_recognize_annouce_message_11", + "value": "To prevent Face Recognition from being used without your consent, please exercise caution before allowing other people to use your device." + }, + { + "name": "face_recognize_annouce_message_12", + "value": "The functionality of Face Recognition may also be affected in scenarios other than those described above." + }, + { + "name": "face_recognize_annouce_message_13", + "value": "Privacy Statement" + }, + { + "name": "face_recognize_annouce_message_14_1", + "value": "Your" + }, + { + "name": "face_recognize_annouce_message_14_2", + "value": "is rigorously protected. This data is encrypted and stored in an isolated zone on your device, where it will not be copied by Huawei, and cannot be copied or accessed by any app. When you use Face Recognition in an app, the app is only informed whether or not verification is successful, and cannot access your actual" + }, + { + "name": "face_recognize_annouce_message_14_3", + "value": "facial data" + }, + { + "name": "face_recognize_annouce_message_15_1", + "value": "As the owner of your" + }, + { + "name": "face_recognize_annouce_message_15_2", + "value": ", you are entitled to decide how you use the Face Recognition feature. For example, if you don't want to use Face Recognition to access App Lock, you can disable this feature in Settings. You can also choose to permanently delete your。" + }, + { + "name": "face_recognize_annouce_message_15_3", + "value": "facial data" + }, + { + "name": "face_recognize_annouce_message_15_4", + "value": "from your device." + }, + { + "name": "face_guide_3d_announce_link", + "value": "Statement About 3D Face Recognition" + }, + { + "name": "face_3drecognize_annouce_message_01", + "value": "3D Face Recognition uses depth-sensing technology to create a sophisticated, three-dimensional model of your face, which can be used to verify your identity. This lets you securely unlock your device, confirm payments, and access features such as App Lock and Safe by simply looking at the screen. 3D Face Recognition is more secure and robust than 2D face recognition technologies, and can even be used in the dark." + } + , + { + "name": "face_introdution_title", + "value": "Require trusted device" + }, + { + "name": "face_introdution_tip", + "value": "Add an extra layer of security by only allowing this device to be unlocked with facial recognition when a trusted device is connected." + }, + { + "name": "trusted_devices_title", + "value": "Trusted devices" + }, + { + "name": "face_introdution_button", + "value": "Add trusted device" + }, + { + "name": "connect_tip", + "value": "Connected" + }, + { + "name": "disconnect_tip", + "value": "Not connected" + }, + { + "name": "cancel_button", + "value": "Cancel" + }, + { + "name": "remove_device_button", + "value": "Remove" + }, + { + "name": "add_device_button", + "value": "Add" + }, + { + "name": "remove_device_tip", + "value": "Once removed, a trusted device will no longer be required to unlock this device with facial recognition." + }, + { + "name": "remove_device_title", + "value": "Remove trusted device" + }, + { + "name": "add_device_or_not_tip", + "value": "Add trusted device?" + }, + { + "name": "using_tips", + "value": "Note" + }, + { + "name": "add_device_tip", + "value": "You will only be able to unlock this device with facial recognition when a trusted device is connected over Bluetooth. Other unlock methods will not be affected." + } + + + + , + { + "name": "face_recognition", + "value": "人脸识别" + }, + { + "name": "face_recognition_is_used", + "value": "人脸识别用于" + }, + { + "name": "unlock_screen", + "value": "解锁屏幕" + }, + { + "name": "slide_to_unlock", + "value": "滑动解锁" + }, + { + "name": "smart_display_lock_screen_notification", + "value": "智能显示锁屏通知" + }, + { + "name": "access_safe", + "value": "访问保密柜" + }, + { + "name": "access_app_lock", + "value": "访问应用锁" + }, + { + "name": "automatically_fill_in_account", + "value": "自动填充账号和密码" + }, + { + "name": "use_password_safe_to_save_account", + "value": "使用密码保险箱保存账号和密码" + }, + { + "name": "delete_face_data", + "value": "删除面部数据" + }, + { + "name": "set_backup_face", + "value": "设置备用面容" + }, + { + "name": "recognize_another_face", + "value": "除继续学习您的长相外,还可识别另一种面容" + }, + { + "name": "main_and_backup_faces", + "value": "已设置主用及备用面容" + }, + { + "name": "trusted_device_be_connected_when_unlocking", + "value": "解锁时需连接可信设备" + }, + { + "name": "closed", + "value": "已关闭" + }, + { + "name": "look_at_screen_during_face_recognition", + "value": "人脸识别时需注视屏幕" + }, + { + "name": "fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "auxiliary_mode", + "value": "辅助模式" + }, + { + "name": "recognize_without_opening_eyes", + "value": "开启屏幕朗读后无需睁眼即可识别" + }, + { + "name": "be_based_on_facial_feature_information", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + { + "name": "statement_on_face_recognition", + "value": "关于人脸识别的声明。" + }, + { + "name": "statement3D_on_face_recognition", + "value": "关于3D人脸识别的声明。" + }, + { + "name": "looking_for_other_settings", + "value": "是否在寻找其设置项?" + }, + { + "name": "pick_up_phone_turn_on_screen", + "value": "拿起手机亮屏" + }, + { + "name": "annotation_screen_keeps_on", + "value": "注视屏幕不息屏" + }, + { + "name": "unlock_directly", + "value": "直接解锁" + }, + { + "name": "unlock_directly_after_successful_face_recognition", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "Slide_to_unlock_after_successful_face_recognition", + "value": "人脸识别成功后滑动屏幕解锁" + }, + { + "name": "close", + "value": "关闭" + }, + { + "name": "cancel", + "value": "取消" + }, + { + "name": "enable", + "value": "启用" + }, + { + "name": "activate_safe", + "value": "启动保密柜" + }, + { + "name": "whether_to_enable_safe", + "value": "需开启应用文件管理保密柜完成人脸关联。是否启用?" + }, + + { + "name": "activate_app_lock", + "value": "启动应用锁" + }, + { + "name": "Whether_to_activate_app_lock", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启动应用锁?" + }, + { + "name": "delete_all_face_data", + "value": "删除主用及备用面容" + }, + { + "name": "delete", + "value": "删除" + }, + { + "name": "wether_delete_face_data", + "value": "删除后,基于面部数据的功能将不可用。是否删除?" + }, + { + "name": "pick_up_phone", + "value": "同时关闭拿起手机亮屏" + }, + + + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "face_lists", + "value": "面部列表" + }, + { + "name": "face_1", + "value": "面部1" + }, + { + "name": "face", + "value": "面部" + }, + { + "name": "new_face", + "value": "新建面部数据" + }, + { + "name": "face_name", + "value": "面部名称" + }, + { + "name": "delete_face", + "value": "删除面容" + }, + { + "name": "save", + "value": "保存" + }, + { + "name": "face_checker", + "value": "Face Recognition" + }, + + { + "name": "face_unlock_method", + "value": "Unlock device" + }, + { + "name": "face_recognize_slideunlock_title", + "value": "Slide to unlock" + }, + { + "name": "title_apps_security_pref", + "value": "Access App Lock" + }, + { + "name": "title_fill_light", + "value": "Low light compensation" + }, + { + "name": "recommend_preference_title", + "value": "Looking for other settings?" + }, + { + "name": "face_config_light_01_universal", + "value": "Raise to wake" + }, + { + "name": "multiface_list_title", + "value": "Facial profiles" + }, + { + "name": "multiface_default_face_name_1", + "value": "Profile 1" + }, + { + "name": "multiface_default_face_name", + "value": "Profile " + }, + { + "name": "multiface_enroll_new_face", + "value": "Add facial profile" + }, + { + "name": "multiface_face_name_title", + "value": "Name" + }, + { + "name": "multiface_save", + "value": "Save" + }, + { + "name": "face_unlock_method_close", + "value": "Off" + }, + { + "name": "face_recognize_unlock_title", + "value": "Direct unlock" + }, + { + "name": "face_3dguide_info_2", + "value": "Face Recognition verifies your identity based on your facial features. To learn more, see the" + }, + { + "name": "face_inform_open_applock_msg", + "value": "App Lock is not enabled. Enable now?" + }, + { + "name": "face_record_cancel", + "value": "Cancel" + }, + { + "name": "face_recognize_unlock_summary_3d", + "value": "Unlock directly after successful facial recognition." + }, + { + "name": "face_recognize_slideunlock_summary_3d", + "value": "Slide to unlock after successful facial recognition." + }, + { + "name": "face_enterance_off", + "value": "Off" + }, + { + "name": "open_bluetooth", + "value": "Bluetooth must be enabled. Touch to enable" + }, + { + "name": "no_available_devices_title", + "value": "No available devices" + }, + { + "name": "no_available_devices_tip", + "value": "No paired devices found. Pair one now?" + }, + { + "name": "pair_button", + "value": "Go pair" + } + , + { + "name": "face_record", + "value": "Set up Face Recognition" + }, + { + "name": "face_record_3d_record_fail", + "value": "Setup failed" + }, + { + "name": "enroll_face_guide_title", + "value": "Set up Face Recognition" + }, + { + "name": "face_guide_2d_way", + "value": "Before starting, make sure the camera is clean, your face is unobstructed, and the environment is well-lit." + }, + { + "name": "face_guide_2d_announce", + "value": "You can use Face Recognition to unlock your device and open locked apps.Click \"Start typing\" to indicate your consent" + }, + { + "name": "face_2dguide_light_notify_universal", + "value": "Enable raise to wake" + }, + { + "name": "face_guide_3d_way", + "value": "First, position your face in the frame. Then slowly move your head in a circle while looking at the screen to show all angles of your face." + }, + { + "name": "face_guide_3d_announce", + "value": "You can use Face Recognition to unlock your device, confirm payments, open locked apps, and more.Click \"Start typing\" to indicate your consent" + }, + { + "name": "face_recognitin_guide", + "value": "Get started" + }, + { + "name": "face_record_success", + "value": "Setup complete" + }, + { + "name": "face_record_3d_tip_close", + "value": "The face is too small" + }, + { + "name": "face_record_3d_tip_far", + "value": "The face is too big" + }, + { + "name": "face_enroll_too_left", + "value": "Face too far to the left" + }, + { + "name": "face_enroll_too_high", + "value": "Face too close up" + }, + { + "name": "face_enroll_too_right", + "value": "Face too far to the right" + }, + { + "name": "face_enroll_too_low", + "value": "Face too far down " + }, + { + "name": "face_record_3d_tip_multi", + "value": "Multiple faces appear" + }, + { + "name": "face_rotate_too_left", + "value": "Too much head to the left " + }, + { + "name": "face_rotate_too_high", + "value": "Head raised at too high an Angle" + }, + { + "name": "face_rotate_too_right", + "value": "Head turned too far to the right" + }, + { + "name": "face_rotate_too_low", + "value": "Head raised too low" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/product/pad/src/main/resources/zh_CN/element/string.json b/ui/faceenroll/product/pad/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..cec1eb850e951d8af20165e89dfef2f0c8feca3a --- /dev/null +++ b/ui/faceenroll/product/pad/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,791 @@ +{ + "string": [ + { + "name": "app_name", + "value": "faceEnroll" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "description_product", + "value": "ETS_Empty Ability" + }, + { + "name": "entry_product", + "value": "entry_product" + }, + { + "name": "enrolling", + "value": "正在录入" + }, + { + "name": "enrolling_fail", + "value": "录入失败" + }, + { + "name": "enrolling_timeout", + "value": "录入超时" + }, + { + "name": "declare", + "value": "声明" + }, + { + "name": "declare_content", + "value": "如果您选择添加人脸数据,在亮屏状态,您将可以通过正面注视手机屏幕瞬间解锁。人脸数据储存在您的设备,而且不会通过云服务或者其他工具备份他处。" + }, + { + "name": "open_clock", + "value": "打开”拿起手机亮屏“,提升解锁体验" + }, + { + "name": "face_enroll", + "value": "人脸识别" + }, + { + "name": "enroll_success", + "value": "录入成功" + }, + { + "name": "start_title", + "value": "如何录入面部数据" + }, + { + "name": "start_2D_content1", + "value": "首先,确保摄像头清洁、面部无遮挡,录入环境光线充足、无阳光直射。然后,正对屏幕,将面部完整移入识别区。" + }, + { + "name": "start_2D_content2", + "value": "人脸识别可用于解锁屏幕及访问应用锁。点击“开始录入”即表示您同意" + }, + { + "name": "start_2D_content3", + "value": "关于人脸识别的声明。" + }, + { + "name": "start_3D_content1", + "value": "首先,请确保您的面部全部显示在识别区内。然后注视屏幕并缓缓转动头部以完成全方位采集。" + }, + { + "name": "start_3D_content2", + "value": "人脸识别可用于解锁屏幕,访问应用锁、保密柜及支付。点击“开始录入”即表示您同意" + }, + { + "name": "start_3D_content3", + "value": "关于3D人脸识别的声明。" + }, + { + "name": "button_content", + "value": "开始录入" + }, + { + "name": "enroll_info_fail", + "value": "请确保摄像头清洁,面部无遮挡,在光线充足、无阳光直射的环境里录入。" + }, + { + "name": "enroll_info", + "value": "请保持不动" + }, + { + "name": "enroll_info_cancel", + "value": "被取消" + }, + { + "name": "enroll_info_algorithm_not_init", + "value": "算法未初始化" + }, + { + "name": "enroll_info_hal_invalid", + "value": "人脸识别demon不可用" + }, + { + "name": "enroll_info_over_max_faces", + "value": "录入超过最大上限" + }, + { + "name": "enroll_info_invalid_parameters", + "value": "入参无效" + }, + { + "name": "enroll_info_busy", + "value": "人脸流程正在进行中,请求busy" + }, + { + "name": "enroll_info_has_registered", + "value": "当前人脸已经录入过" + }, + { + "name": "enroll_info_bad_quality", + "value": "图像质量太差" + }, + { + "name": "enroll_info_not_found", + "value": "没检测到人脸" + }, + { + "name": "enroll_info_scale_too_small", + "value": "人脸太小" + }, + { + "name": "enroll_info_scale_too_large", + "value": "人脸太大" + }, + { + "name": "enroll_info_offset_left", + "value": "人脸太靠左" + }, + { + "name": "enroll_info_offset_top", + "value": "人脸太靠上" + }, + { + "name": "enroll_info_offset_right", + "value": "人脸太靠右" + }, + { + "name": "enroll_info_offset_bottom", + "value": "人脸太靠下" + }, + { + "name": "enroll_info_liveness_warning", + "value": "活体检测有风险" + }, + { + "name": "enroll_info_liveness_failure", + "value": "活体检测失败" + }, + { + "name": "enroll_info_rotated_left", + "value": "头向左转的角度太大" + }, + { + "name": "enroll_info_rise", + "value": "头抬的角度太高" + }, + { + "name": "enroll_info_face_has_registered", + "value": "转动头部" + }, + { + "name": "enroll_info_rotated_right", + "value": "头向右转的角度太大" + }, + { + "name": "enroll_info_down", + "value": "头抬的角度太低" + }, + { + "name": "enroll_info_eye_occlusion", + "value": "眼睛不清晰" + }, + { + "name": "enroll_info_eye_close", + "value": "闭眼" + }, + { + "name": "enroll_info_mouth_occlusion", + "value": "嘴巴不清晰" + }, + { + "name": "enroll_info_mutlify", + "value": "出现多张脸" + }, + { + "name": "enroll_info_blur", + "value": "脸不清晰" + }, + { + "name": "enroll_info_not_complete", + "value": "脸不完整" + }, + { + "name": "enroll_info_darklight", + "value": "光线太暗" + }, + { + "name": "enroll_info_highlight", + "value": "光线太强" + }, + { + "name": "enroll_info_half_shadow", + "value": "阴阳脸" + }, + { + "name": "enroll_info_darkpic", + "value": "图片太暗" + }, + { + "name": "enroll_info_rotate_top_right", + "value": "人脸头顶朝右" + }, + { + "name": "enroll_info_rotate_top_left", + "value": "人脸头顶朝左" + }, + { + "name": "enroll_info_rotate_bottom_right", + "value": "人脸下巴朝右" + }, + { + "name": "enroll_info_rotate_bottom_left", + "value": "人脸下巴朝左" + }, + { + "name": "enroll_info_open_camera_failed", + "value": "打开Camera失败" + }, + { + "name": "enroll_button_content", + "value": "重新录入" + }, + { + "name": "deleteTitle", + "value": "删除数据" + } ,{ + "name": "face_introdution_title", + "value": "解锁时需连接可信设备" + }, + { + "name": "face_introdution_tip", + "value": "进行人脸识别解锁手机时,需连接可信设备以进一步提升安全性。" + }, + { + "name": "trusted_devices_title", + "value": "可信设备" + }, + { + "name": "face_introdution_button", + "value": "添加可信设备" + }, + { + "name": "connect_tip", + "value": "已连接" + }, + { + "name": "disconnect_tip", + "value": "未连接" + }, + { + "name": "cancel_button", + "value": "取消" + }, + { + "name": "remove_device_button", + "value": "移除" + }, + { + "name": "add_device_button", + "value": "添加" + }, + { + "name": "remove_device_tip", + "value": "移除后,人脸识别解锁本机时将不再需要连接可信设备。是否移除?" + }, + { + "name": "remove_device_title", + "value": "移除可信设备" + }, + { + "name": "add_device_or_not_tip", + "value": "是否添加" + }, + { + "name": "using_tips", + "value": "使用提示" + }, + { + "name": "add_device_tip", + "value": "添加后,当可信设备与本机断开连接时,将无法使用人脸识别解锁。您可以使用其他方式解锁。" + } + + + , + { + "name": "face_guide_2d_announce_link", + "value": "关于人脸识别的声明" + }, + { + "name": "face_feature_desc", + "value": "功能介绍" + }, + { + "name": "face_recognize_annouce_message_01", + "value": "人脸识别是一种基于人的脸部特征信息进行身份识别的生物识别技术。它通过手机前置摄像头捕捉人脸面部数据,进而快速完成面部特征比对和身份认证。可用于解锁屏幕、访问应用锁等场景。" + }, + { + "name": "face_recognize_annouce_message_02", + "value": "录入面部数据时,需注意以下事项:" + }, + { + "name": "face_recognize_annouce_message_03", + "value": "1.确保摄像头清洁;" + }, + { + "name": "face_recognize_annouce_message_04", + "value": "2.在光线充足的环境下录入,但需避免强光直射;" + }, + { + "name": "face_recognize_annouce_message_05", + "value": "3.勿用衣帽、头发、墨镜、口罩、浓妆等遮挡面部;" + }, + { + "name": "face_recognize_annouce_message_06", + "value": "4.确保面部正面完整清晰地出现在提示框内,不要闭眼、大幅度仰头或低头" + }, + { + "name": "face_recognize_annouce_message_07", + "value": "5.避免其他人出现在录入画面中。" + }, + { + "name": "face_recognize_annouce_message_08", + "value": "任何技术都存在一定局限和风险,使用人脸识别时,需注意以下事项:" + }, + { + "name": "face_recognize_annouce_message_09", + "value": "1.在暗光、强光、逆光或角度过大等场景下,人脸识别的成功率会有所降低;" + }, + { + "name": "face_annouce_tip1_item2_3d", + "value": "2.人脸识别的安全性低于图案密码、数字密码、混合密码。;" + }, + { + "name": "face_recognize_annouce_message_10", + "value": "您的设备可能会被容貌、外形与您相近的人或物品解锁;" + }, + { + "name": "face_recognize_annouce_message_11", + "value": "请勿将设备随意交给他人使用,避免人脸识别功能被恶意利用;" + }, + { + "name": "face_recognize_annouce_message_12", + "value": "除以上事项外,您还需注意其他可能影响人脸识别功能正常使用的情况。" + }, + { + "name": "face_recognize_annouce_message_13", + "value": "隐私声明" + }, + { + "name": "face_recognize_annouce_message_14_1", + "value": "您的" + }, + { + "name": "face_recognize_annouce_message_14_2", + "value": "将受到严格保护。该数据仅加密保存于本设备的安全隔离区域,华为不会进行备份,其他应用也无法访问或备份。例如,您使用人脸识别进行应用内认证时,应用仅能收到认证是否成功的通知,而无法访问、备份或录入" + }, + { + "name": "face_recognize_annouce_message_14_3", + "value": "面部数据。" + }, + { + "name": "face_recognize_annouce_message_15_1", + "value": "您拥有人脸识别的自主控制权,可灵活控制人脸识别的使用及适用范围。例如,您不想使用人脸识别访问应用锁,在“设置”中将其关闭即可,此时人脸识别仍可用于其他操作,但不可用于进入应用锁。您还可彻底删除" + }, + { + "name": "face_recognize_annouce_message_15_2", + "value": "删除后本设备将不再保存这些数据。" + }, + + { + "name": "face_recognize_annouce_message_15_3", + "value": "" + }, + { + "name": "face_recognize_annouce_message_15_4", + "value": "" + }, + { + "name": "face_guide_3d_announce_link", + "value": "关于3D人脸识别的声明" + }, + { + "name": "face_3drecognize_annouce_message_01", + "value": "3D人脸识别是新一代人脸识别技术。它通过深度感应技术,捕捉更丰富的面部数据,实现三维立体防伪识别。在暗光、逆光、无光等环境下,也可用于解锁屏幕,访问应用锁、保密柜及支付,其安全性、准确率和环境适应性较传统人脸识别技术大幅提升。" + } + + + + , + { + "name": "face_recognition", + "value": "人脸识别" + }, + { + "name": "face_recognition_is_used", + "value": "人脸识别用于" + }, + { + "name": "unlock_screen", + "value": "解锁屏幕" + }, + { + "name": "slide_to_unlock", + "value": "滑动解锁" + }, + { + "name": "smart_display_lock_screen_notification", + "value": "智能显示锁屏通知" + }, + { + "name": "access_safe", + "value": "访问保密柜" + }, + { + "name": "access_app_lock", + "value": "访问应用锁" + }, + { + "name": "automatically_fill_in_account", + "value": "自动填充账号和密码" + }, + { + "name": "use_password_safe_to_save_account", + "value": "使用密码保险箱保存账号和密码" + }, + { + "name": "delete_face_data", + "value": "删除面部数据" + }, + { + "name": "set_backup_face", + "value": "设置备用面容" + }, + { + "name": "recognize_another_face", + "value": "除继续学习您的长相外,还可识别另一种面容" + }, + { + "name": "main_and_backup_faces", + "value": "已设置主用及备用面容" + }, + { + "name": "trusted_device_be_connected_when_unlocking", + "value": "解锁时需连接可信设备" + }, + { + "name": "closed", + "value": "已关闭" + }, + { + "name": "look_at_screen_during_face_recognition", + "value": "人脸识别时需注视屏幕" + }, + { + "name": "fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "auxiliary_mode", + "value": "辅助模式" + }, + { + "name": "recognize_without_opening_eyes", + "value": "开启屏幕朗读后无需睁眼即可识别" + }, + { + "name": "be_based_on_facial_feature_information", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + { + "name": "statement_on_face_recognition", + "value": "关于人脸识别的声明。" + }, + { + "name": "statement3D_on_face_recognition", + "value": "关于3D人脸识别的声明。" + }, + { + "name": "looking_for_other_settings", + "value": "是否在寻找其设置项?" + }, + { + "name": "pick_up_phone_turn_on_screen", + "value": "拿起手机亮屏" + }, + { + "name": "annotation_screen_keeps_on", + "value": "注视屏幕不息屏" + }, + { + "name": "unlock_directly", + "value": "直接解锁" + }, + { + "name": "unlock_directly_after_successful_face_recognition", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "Slide_to_unlock_after_successful_face_recognition", + "value": "人脸识别成功后滑动屏幕解锁" + }, + { + "name": "close", + "value": "关闭" + }, + { + "name": "enable", + "value": "启用" + }, + { + "name": "activate_safe", + "value": "启动保密柜" + }, + { + "name": "whether_to_enable_safe", + "value": "需开启应用文件管理保密柜完成人脸关联。是否启用?" + }, + + { + "name": "activate_app_lock", + "value": "启动应用锁" + }, + { + "name": "Whether_to_activate_app_lock", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启动应用锁?" + }, + { + "name": "delete_all_face_data", + "value": "删除主用及备用面容" + }, + { + "name": "wether_delete_face_data", + "value": "删除后,基于面部数据的功能将不可用。是否删除?" + }, + { + "name": "pick_up_phone", + "value": "同时关闭拿起手机亮屏" + }, + + + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "face_lists", + "value": "面部列表" + }, + { + "name": "face_1", + "value": "面部1" + }, + { + "name": "face", + "value": "面部" + }, + { + "name": "new_face", + "value": "新建面部数据" + }, + { + "name": "face_name", + "value": "面部名称" + }, + { + "name": "delete_face", + "value": "删除面部" + }, + { + "name": "save", + "value": "保存" + }, + + { + "name": "face_checker", + "value": "人脸识别" + }, + + { + "name": "face_unlock_method", + "value": "解锁屏幕" + }, + { + "name": "face_recognize_slideunlock_title", + "value": "滑动解锁" + }, + { + "name": "title_apps_security_pref", + "value": "访问应用锁" + }, + { + "name": "title_fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "recommend_preference_title", + "value": "是否在寻找其他设置项?" + }, + { + "name": "face_config_light_01_universal", + "value": "拿起手机亮屏" + }, + { + "name": "multiface_list_title", + "value": "面部列表" + }, + { + "name": "multiface_default_face_name_1", + "value": "面部 1" + }, + { + "name": "multiface_default_face_name", + "value": "面部" + }, + { + "name": "multiface_enroll_new_face", + "value": "新建面部数据" + }, + { + "name": "multiface_face_name_title", + "value": "面部名称" + }, + + { + "name": "multiface_save", + "value": "保存" + }, + { + "name": "face_unlock_method_close", + "value": "关闭" + }, + { + "name": "face_recognize_unlock_title", + "value": "直接解锁" + }, + { + "name": "face_3dguide_info_2", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + + { + "name": "face_inform_open_applock_msg", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启用应用锁?" + }, + { + "name": "face_record_cancel", + "value": "取消" + }, + + { + "name": "face_recognize_unlock_summary_3d", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "face_recognize_slideunlock_summary_3d", + "value": "人脸识别成功后,滑动屏幕解锁" + }, + { + "name": "face_enterance_off", + "value": "已关闭" + }, + { + "name": "open_bluetooth", + "value": "使用此功能需先开启蓝牙,点击设置" + }, + { + "name": "no_available_devices_title", + "value": "没有可添加的设备" + }, + { + "name": "no_available_devices_tip", + "value": "没有检测到可添加的配对设备。是否前往蓝牙设置配对?" + }, + { + "name": "pair_button", + "value": "去配对" + }, + { + "name": "face_fingerprint_settings_switch_title", + "value": "自动填充账号和密码" + }, + { + "name": "face_fingerprint_settings_switch_summary", + "value": "使用密码保险箱保存的帐号和密码" + }, + { + "name": "face_record", + "value": "正在录入" + }, + { + "name": "face_record_3d_record_fail", + "value": "录入失败" + }, + { + "name": "enroll_face_guide_title", + "value": "如何录入面部数据" + }, + { + "name": "face_guide_2d_way", + "value": "首先,确保摄像头清洁、面部无遮挡,录入环境光线充足、无阳光直射。然后,正对屏幕,将面部完整移入识别区。" + }, + { + "name": "face_guide_2d_announce", + "value": "人脸识别可用于解锁屏幕及访问应用锁。点击“开始录入”即表示您同意" + }, + { + "name": "face_2dguide_light_notify_universal", + "value": "打开”拿起手机亮屏“,提升解锁体验" + }, + { + "name": "face_guide_3d_way", + "value": "首先,请确保您的面部全部显示在识别区内。然后注视屏幕并缓缓转动头部以完成全方位采集。" + }, + { + "name": "face_guide_3d_announce", + "value": "人脸识别可用于解锁屏幕,访问应用锁、保密柜及支付。点击“开始录入”即表示您同意" + }, + { + "name": "face_recognitin_guide", + "value": "开始录入" + }, + { + "name": "face_record_success", + "value": "录入成功" + }, + { + "name": "face_record_3d_tip_close", + "value": "人脸太小" + }, + { + "name": "face_record_3d_tip_far", + "value": "人脸太大" + }, + { + "name": "face_enroll_too_left", + "value": "人脸太靠左" + }, + { + "name": "face_enroll_too_high", + "value": "人脸太靠上" + }, + { + "name": "face_enroll_too_right", + "value": "人脸太靠右" + }, + { + "name": "face_enroll_too_low", + "value": "人脸太靠下" + }, + { + "name": "face_record_3d_tip_multi", + "value": "出现多张脸" + }, + { + "name": "face_rotate_too_left", + "value": "头向左转的角度太大" + }, + { + "name": "face_rotate_too_high", + "value": "头抬的角度太高" + }, + { + "name": "face_rotate_too_right", + "value": "头向右转的角度太大" + }, + { + "name": "face_rotate_too_low", + "value": "头抬的角度太低" + } + ] +} \ No newline at end of file diff --git a/ui/faceenroll/product/phone/src/main/config.json b/ui/faceenroll/product/phone/src/main/config.json index 2c347602c46222dbe6996313bbdab6d533a9bf2a..c66e027737e882c9ae931da3c10d8364059b6d23 100644 --- a/ui/faceenroll/product/phone/src/main/config.json +++ b/ui/faceenroll/product/phone/src/main/config.json @@ -1,15 +1,15 @@ { "app": { - "bundleName": "com.example.myapplication101", + "bundleName": "com.ohos.faceEnroll", "vendor": "ohos", "version": { - "code": 1, - "name": "1.0" + "code": 1000000, + "name": "1.0.0" } }, "deviceConfig": {}, "module": { - "package": "com.ohos.faceenroll", + "package": "com.ohos.faceEnroll", "name": ".MyApplication", "deviceType": [ "phone" @@ -25,37 +25,50 @@ "skills": [ { "entities": [ - "entity.system.home" + "entity.system.home", + "flag.home.intent.from.system" ], "actions": [ - "action.system.home" + "action.system.home", + "com.ohos.action.main" ] } ], "visible": true, - "name": "com.ohos.faceenroll.MainAbility", + "name": "com.ohos.faceEnroll.MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", "type": "page", "launchType": "singleton", "srcPath": "default", - "srcLanguage": "ets" + "srcLanguage": "ets", + "metaData": { + "customizeData": [ + { + "name": "hwc-theme" + } + ] + } } ], "js": [ - {"mode": { - "syntax": "ets", - "type": "pageAbility" - }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, "pages": [ + "pages/entryView", + "pages/userAuth", + "pages/userSettings", "pages/index", "pages/enroll_2D", "pages/success", "pages/enroll_3D", "pages/declare", "pages/startViews_2D", - "pages/startViews_3D", + "pages/startViews_3D" ], "name": "default", "window": { diff --git a/ui/faceenroll/product/phone/src/main/ets/default/app.ets b/ui/faceenroll/product/phone/src/main/ets/default/app.ets index dcda803670aae7356a312f848fe4576be4f2c843..7536e16b36e3040f10061a96fe9eabd1bcfc929e 100644 --- a/ui/faceenroll/product/phone/src/main/ets/default/app.ets +++ b/ui/faceenroll/product/phone/src/main/ets/default/app.ets @@ -13,13 +13,12 @@ * limitations under the License. */ - export default { onCreate() { - console.info('faceenroll entry Application onDestroy') + console.info('FaceEnroll entry Application onCreate') }, onDestroy() { - console.info('faceenroll entry Application onDestroy') + console.info('FaceEnroll entry Application onDestroy') }, } diff --git a/ui/faceenroll/product/phone/src/main/ets/default/common/constant.ets b/ui/faceenroll/product/phone/src/main/ets/default/common/constant.ets index f923ac38295f1d46ef16034094c45f3c574bd2f4..7451cc4a6cd05b20b7a1d9b3579b422b8ba9569f 100644 --- a/ui/faceenroll/product/phone/src/main/ets/default/common/constant.ets +++ b/ui/faceenroll/product/phone/src/main/ets/default/common/constant.ets @@ -13,9 +13,6 @@ * limitations under the License. */ import router from '@system.router'; -import Log from '../../../../../../../common/src/main/ets/default/Log.ets' - -const TAG = 'constant' async function routeSuccess() { let options = { @@ -30,7 +27,7 @@ async function routeSuccess() { async function route_back() { let options = { - uri: 'pages/index' + uri: 'pages/userAuth' } try { await router.push(options) @@ -41,7 +38,7 @@ async function route_back() { export default class Constants { -//code and errorCode + //code and errorCode static CODE_RESULT = 1 static CODE_CANCEL = 2 static CODE_ACQUIRE = 3 @@ -94,6 +91,7 @@ export default class Constants { static FACEID = 0 static PREVIEWID = 2 + //setTimeout static TIMEOUT_100 = 100 static TIMEOUT_200 = 200 @@ -154,6 +152,7 @@ export default class Constants { static CHECKBOX_TEXT_POSITION_X = '18%' static CHECKBOX_TEXT_POSITION_Y = '87%' + static PROGRESS_WIDTH = '460lpx' static BACK_WIDTH = '136lpx' static BACK_HEIGHT = '110lpx' @@ -174,13 +173,15 @@ export default class Constants { static ERROR_CODE_INFO_SIZE = '32lpx' static ENROLL_CENTER_POSITION_Y = '240lpx' static SUCCESS_WIDTH = '204lpx' - static CHECKBOX_SIZE = '70lpx' + static CHECKBOX_SIZE = '60lpx' static APERTURE1_WIDTH = '266lpx' static APERTURE2_WIDTH = '264lpx' static APERTURE34_WIDTH = '284lpx' static APERTURE5_WIDTH = '466lpx' - //PROGRESS + + + //PROGRESS static PROGRESS_VALUE_5 = 5 static PROGRESS_VALUE_10 = 10 static PROGRESS_VALUE_15 = 15 @@ -202,42 +203,62 @@ export default class Constants { static PROGRESS_VALUE_95 = 95 static PROGRESS_VALUE_100 = 100 -//errorCode value - static value(){ - const info = new Map() - info.set(Constants.ERROR_CODE_BAD_QUALITY,$r('app.string.enroll_info_bad_quality')) - info.set(Constants.ERROR_CODE_NOT_FOUND,$r('app.string.enroll_info_not_found')) - info.set(Constants.ERROR_CODE_TOO_SMALL,$r('app.string.face_record_3d_tip_close')) - info.set(Constants.ERROR_CODE_TOO_LARGE,$r('app.string.face_record_3d_tip_far')) - info.set(Constants.ERROR_CODE_OFFSET_LEFT,$r('app.string.face_enroll_too_left')) - info.set(Constants.ERROR_CODE_OFFSET_TOP,$r('app.string.face_enroll_too_high')) - info.set(Constants.ERROR_CODE_OFFSET_RIGHT,$r('app.string.face_enroll_too_right')) - info.set(Constants.ERROR_CODE_OFFSET_BOTTOM,$r('app.string.face_enroll_too_low')) - info.set(Constants.ERROR_CODE_LIVENESS_WARNING,$r('app.string.enroll_info_liveness_warning')) - info.set(Constants.ERROR_CODE_LIVENESS_FAILURE,$r('app.string.enroll_info_liveness_failure')) - info.set(Constants.ERROR_CODE_ROTATED_LEFT,$r('app.string.face_rotate_too_left')) - info.set(Constants.ERROR_CODE_RISE,$r('app.string.face_rotate_too_high')) - info.set(Constants.ERROR_CODE_ROTATED_RIGHT,$r('app.string.face_rotate_too_right')) - info.set(Constants.ERROR_CODE_DOWN,$r('app.string.face_rotate_too_low')) - info.set(Constants.ERROR_CODE_EYE_OCCLUSION,$r('app.string.enroll_info_eye_occlusion')) - info.set(Constants.ERROR_CODE_EYE_CLOSE,$r('app.string.enroll_info_eye_close')) - info.set(Constants.ERROR_CODE_MOUTH_OCCLUSION,$r('app.string.enroll_info_mouth_occlusion')) - info.set(Constants.ERROR_CODE_MULTI,$r('app.string.face_record_3d_tip_multi')) - info.set(Constants.ERROR_CODE_BLUR,$r('app.string.enroll_info_blur')) - info.set(Constants.ERROR_CODE_NOT_COMPLETE,$r('app.string.enroll_info_not_complete')) - info.set(Constants.ERROR_CODE_DARKLIGHT,$r('app.string.enroll_info_darklight')) - info.set(Constants.ERROR_CODE_HIGHTLIGHT,$r('app.string.enroll_info_highlight')) - info.set(Constants.ERROR_CODE_HALF_SHADOW,$r('app.string.enroll_info_half_shadow')) - info.set(Constants.ERROR_CODE_HAS_REGISTERED,$r('app.string.enroll_info_face_has_registered')) - info.set(Constants.ERROR_CODE_DARKPIC,$r('app.string.enroll_info_darkpic')) - info.set(Constants.ERROR_CODE_ROTATE_TOP_RIGHT,$r('app.string.enroll_info_rotate_top_right')) - info.set(Constants.ERROR_CODE_ROTATE_TOP_LEFT,$r('app.string.enroll_info_rotate_top_left')) - info.set(Constants.ERROR_CODE_ROTATE_BOTTOM_RIGHT,$r('app.string.enroll_info_rotate_bottom_right')) - info.set(Constants.ERROR_CODE_ROTATE_BOTTOM_LEFT,$r('app.string.enroll_info_rotate_bottom_left')) - info.set(Constants.ERROR_CODE_OPEN_CAMERA_FAILED,$r('app.string.enroll_info_open_camera_failed')) + static DECLARE_WIDTH = '90%' + static DECLARE_MAX_WIDTH = '100%' + static DECLARE_TITLE_FONT_SIZE = 25 + static DECLARE_SECONDARY_TITLE_FONT_SIZE = 23 + static DECLARE_TEXT_FONT_SIZE = 22 + static DECLARE_ITEM_MARGIN_BOTTOM = 10 + static DECLARE_TITLE_MARGIN_TOP = 20 + static DECLARE_TITLE_MARGIN_BOTTOM = 20 + static DECLARE_TEXT_LINE_HEIGHT = 33 + static DECLARE_SCROLL_BAR_WIDTH = 0 + static DECLARE_BACKGROUND_COLOR = "#F2F3F5" + static DECLARE_TITLE_2 = "2." + static DECLARE_TITLE_3 = "3." + static DECLARE_TITLE_4 = "4." + static DECLARE_TITLE_5 = "5." + + + + + //errorCode value + static value(){ + const info = new Map() + info.set(Constants.ERROR_CODE_BAD_QUALITY,$r('app.string.enroll_info_bad_quality')) + info.set(Constants.ERROR_CODE_NOT_FOUND,$r('app.string.enroll_info_not_found')) + info.set(Constants.ERROR_CODE_TOO_SMALL,$r('app.string.face_record_3d_tip_close')) + info.set(Constants.ERROR_CODE_TOO_LARGE,$r('app.string.face_record_3d_tip_far')) + info.set(Constants.ERROR_CODE_OFFSET_LEFT,$r('app.string.face_enroll_too_left')) + info.set(Constants.ERROR_CODE_OFFSET_TOP,$r('app.string.face_enroll_too_high')) + info.set(Constants.ERROR_CODE_OFFSET_RIGHT,$r('app.string.face_enroll_too_right')) + info.set(Constants.ERROR_CODE_OFFSET_BOTTOM,$r('app.string.face_enroll_too_low')) + info.set(Constants.ERROR_CODE_LIVENESS_WARNING,$r('app.string.enroll_info_liveness_warning')) + info.set(Constants.ERROR_CODE_LIVENESS_FAILURE,$r('app.string.enroll_info_liveness_failure')) + info.set(Constants.ERROR_CODE_ROTATED_LEFT,$r('app.string.face_rotate_too_left')) + info.set(Constants.ERROR_CODE_RISE,$r('app.string.face_rotate_too_high')) + info.set(Constants.ERROR_CODE_ROTATED_RIGHT,$r('app.string.face_rotate_too_right')) + info.set(Constants.ERROR_CODE_DOWN,$r('app.string.face_rotate_too_low')) + info.set(Constants.ERROR_CODE_EYE_OCCLUSION,$r('app.string.enroll_info_eye_occlusion')) + info.set(Constants.ERROR_CODE_EYE_CLOSE,$r('app.string.enroll_info_eye_close')) + info.set(Constants.ERROR_CODE_MOUTH_OCCLUSION,$r('app.string.enroll_info_mouth_occlusion')) + info.set(Constants.ERROR_CODE_MULTI,$r('app.string.face_record_3d_tip_multi')) + info.set(Constants.ERROR_CODE_BLUR,$r('app.string.enroll_info_blur')) + info.set(Constants.ERROR_CODE_NOT_COMPLETE,$r('app.string.enroll_info_not_complete')) + info.set(Constants.ERROR_CODE_DARKLIGHT,$r('app.string.enroll_info_darklight')) + info.set(Constants.ERROR_CODE_HIGHTLIGHT,$r('app.string.enroll_info_highlight')) + info.set(Constants.ERROR_CODE_HALF_SHADOW,$r('app.string.enroll_info_half_shadow')) + info.set(Constants.ERROR_CODE_HAS_REGISTERED,$r('app.string.enroll_info_face_has_registered')) + info.set(Constants.ERROR_CODE_DARKPIC,$r('app.string.enroll_info_darkpic')) + info.set(Constants.ERROR_CODE_ROTATE_TOP_RIGHT,$r('app.string.enroll_info_rotate_top_right')) + info.set(Constants.ERROR_CODE_ROTATE_TOP_LEFT,$r('app.string.enroll_info_rotate_top_left')) + info.set(Constants.ERROR_CODE_ROTATE_BOTTOM_RIGHT,$r('app.string.enroll_info_rotate_bottom_right')) + info.set(Constants.ERROR_CODE_ROTATE_BOTTOM_LEFT,$r('app.string.enroll_info_rotate_bottom_left')) + info.set(Constants.ERROR_CODE_OPEN_CAMERA_FAILED,$r('app.string.enroll_info_open_camera_failed')) + + return info + } - return info - } //face progress_3D static progress() { const pro = new Map() @@ -247,7 +268,6 @@ export default class Constants { return pro } - static result() { const res = new Map() res.set(Constants.ERROR_CODE_FAIL,'') @@ -264,8 +284,6 @@ export default class Constants { //face progress_2D static progress_2D(){ - Log.showInfo(TAG,'progress_2D') - setTimeout(()=>{ AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_5) },Constants.TIMEOUT_100); @@ -326,10 +344,7 @@ export default class Constants { setTimeout(()=>{ AppStorage.Set('prgValue',Constants.PROGRESS_VALUE_100) routeSuccess() - },Constants.TIMEOUT_2000); - setTimeout(()=>{ - route_back() - },Constants.TIMEOUT_3000) + },Constants.TIMEOUT_2000) } static aperture(){ @@ -350,4 +365,59 @@ export default class Constants { AppStorage.Set('showAperture5',true) }, Constants.TIMEOUT_1900) } + static RESULT_CODE_SUCCESS = 0 + static RESULT_CODE_FAIL = 1 + static RESULT_CODE_GENERAL_ERROR = 2 + static RESULT_CODE_CANCELED = 3 + static RESULT_CODE_TIMEOUT = 4 + static RESULT_CODE_TYPE_NOT_SUPPORT = 5 + static RESULT_CODE_TRUST_LEVEL_NOT_SUPPORT = 6 + static RESULT_CODE_BUSY = 7 + static RESULT_CODE_INVALID_PARAMETERS = 8 + static RESULT_CODE_LOCKED = 9 + static RESULT_CODE_NOT_ENROLLED = 10 + + static resultCode(){ + const Code = new Map() + Code.set(Constants.RESULT_CODE_SUCCESS,$r('app.string.enroll_success')) + Code.set(Constants.RESULT_CODE_FAIL,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_GENERAL_ERROR,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_CANCELED,$r('app.string.enroll_info_cancel')) + Code.set(Constants.RESULT_CODE_TIMEOUT,$r('app.string.enrolling_timeout')) + Code.set(Constants.RESULT_CODE_TYPE_NOT_SUPPORT,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_TRUST_LEVEL_NOT_SUPPORT,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_BUSY,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_INVALID_PARAMETERS,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_LOCKED,$r('app.string.enrolling_fail')) + Code.set(Constants.RESULT_CODE_NOT_ENROLLED,$r('app.string.enrolling_fail')) + return Code + } + + static FACE_AUTH_TIP_TOO_BRIGHT = 1 + static FACE_AUTH_TIP_TOO_DARK = 2 + static FACE_AUTH_TIP_TOO_CLOSE = 3 + static FACE_AUTH_TIP_TOO_FAR = 4 + static FACE_AUTH_TIP_TOO_HIGH = 5 + static FACE_AUTH_TIP_TOO_LOW = 6 + static FACE_AUTH_TIP_TOO_RIGHT = 7 + static FACE_AUTH_TIP_TOO_LEFT = 8 + static FACE_AUTH_TIP_TOO_MUCH_MOTION = 9 + static FACE_AUTH_TIP_POOR_GAZE = 10 + static FACE_AUTH_TIP_NOT_DETECTED = 11 + + static FaceTips(){ + const Tips = new Map() + Tips.set(Constants.FACE_AUTH_TIP_TOO_BRIGHT,$r('app.string.enroll_info_highlight')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_DARK,$r('app.string.enroll_info_darklight')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_CLOSE,$r('app.string.enroll_info_scale_too_large')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_FAR,$r('app.string.enroll_info_scale_too_small')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_HIGH,$r('app.string.enroll_info_offset_top')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_LOW,$r('app.string.enroll_info_offset_bottom')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_RIGHT,$r('app.string.enroll_info_offset_right')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_LEFT,$r('app.string.enroll_info_offset_left')) + Tips.set(Constants.FACE_AUTH_TIP_TOO_MUCH_MOTION,$r('app.string.enroll_info_blur')) + Tips.set(Constants.FACE_AUTH_TIP_POOR_GAZE,$r('app.string.enroll_info_eye_occlusion')) + Tips.set(Constants.FACE_AUTH_TIP_NOT_DETECTED,$r('app.string.enroll_info_not_found')) + return Tips + } } \ No newline at end of file diff --git a/ui/faceenroll/product/phone/src/main/ets/default/model_2D.ets b/ui/faceenroll/product/phone/src/main/ets/default/model_2D.ets index 6d6bf28740c7741030b836f9c2430b9912232e48..541e25e7efb449653ddf8738eac2e9856e27228f 100644 --- a/ui/faceenroll/product/phone/src/main/ets/default/model_2D.ets +++ b/ui/faceenroll/product/phone/src/main/ets/default/model_2D.ets @@ -14,133 +14,260 @@ * limitations under the License. */ -import Log from '../../../../../../common/src/main/ets/default/Log.ets' -import userEnroll from '@ohos.enroll' -import Constants from './common/constant.ets' +import Constants from './common/constant.ets'; +import UserIDM from '@ohos.useridm'; -const TAG = 'faceenroll-faceModel_2D' - -var mPrgvalue -var mRes = Constants.result() +var mPrgvalue; +var mResultCode = Constants.resultCode(); +var mFaceTips = Constants.FaceTips(); export class model_2D { - // init page - initFaceModel() { - Log.showInfo(TAG, 'initFaceModel'); - AppStorage.Link('width') - AppStorage.Link('showBack') - AppStorage.Link('height') - AppStorage.Link('showAperture') - AppStorage.Link('blur') - AppStorage.Link('showPrg') - mPrgvalue = AppStorage.Link('prgValue') - AppStorage.Link('enrollInfo') - AppStorage.Link('showBtn') - AppStorage.Link('enrollTitle') - - var result = userEnroll.init() - Log.showInfo(TAG,'initFaceModel init result:' + result) - - var challenge = userEnroll.preEnroll() - Log.showInfo(TAG,'initFaceModel perEnroll challenge:'+ challenge) + private UserIDM; - this.startEnroll() + constructor() { + this.UserIDM = UserIDM.constructor(); + } + /** + * init FaceModel + */ + initFaceModel(credentialInfo) { + console.info("FaceEnroll model_2D initFaceModel start"); + AppStorage.Link('width'); + AppStorage.Link('showBack'); + AppStorage.Link('height'); + AppStorage.Link('showAperture'); + AppStorage.Link('blur'); + AppStorage.Link('showPrg'); + mPrgvalue = AppStorage.Link('prgValue'); + AppStorage.Link('enrollInfo'); + AppStorage.Link('showBtn'); + AppStorage.Link('enrollTitle'); + this.startEnroll(credentialInfo); + console.info("FaceEnroll model_2D initFaceModel end"); } -//resume page + + /** + * resume page, unInit FaceModel + */ uninitFaceModel() { - if(mPrgvalue != Constants.PROGRESS_TOTAL) - { - var cal = userEnroll.cancelEnroll() - Log.showInfo(TAG,'uninitFaceModel cancel cal:' + cal) + console.info(" FaceEnroll model_2D uninitFaceModel start"); + if (mPrgvalue != Constants.PROGRESS_TOTAL) { + this.cancelEnroll(); } - setTimeout(()=> { - Log.showInfo(TAG, 'uninitFaceModel'); - AppStorage.Set('width', Constants.SHELTER_START_WIDTH) - AppStorage.Set('height', Constants.SHELTER_START_HEIGHT) - AppStorage.Set('showBtn', false) - AppStorage.Set('showPrg', false) - AppStorage.Set('showBack', true) - AppStorage.Set('blur', Constants.BLUR_START) - AppStorage.Set('showAperture', true) - mPrgvalue = AppStorage.Set('prgValue', $r('app.float.progress_value_start')) - AppStorage.Set('enrollInfo', $r('app.string.enroll_info')) - AppStorage.Set('enrollTitle', $r('app.string.face_record')) - },Constants.TIMEOUT_500) + setTimeout(() => { + AppStorage.Set('width', Constants.SHELTER_START_WIDTH); + AppStorage.Set('height', Constants.SHELTER_START_HEIGHT); + AppStorage.Set('showBtn', false); + AppStorage.Set('showPrg', false); + AppStorage.Set('showBack', true); + AppStorage.Set('blur', Constants.BLUR_START); + AppStorage.Set('showAperture', true); + mPrgvalue = AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + AppStorage.Set('enrollTitle', $r('app.string.face_record')); + AppStorage.Set('enrollInfo', $r('app.string.enroll_info')); + }, Constants.TIMEOUT_500); + console.info(" FaceEnroll model_2D uninitFaceModel end"); } -//get callback value - startEnroll(){ - userEnroll.enroll({ - enrollParam:{ - token: Constants.PARAM_TOKEN, - flags: Constants.FLAGS, - faceId: Constants.FACEID, - previewId: Constants.PREVIEWID - } - },function(data) { - Log.showInfo(TAG,'startEnroll enroll data:' + data.code) - Log.showInfo(TAG,'startEnroll enroll data:' + data.errorCode) - if(data.code == Constants.CODE_ACQUIRE) { - if (data.errorCode == Constants.ERROR_CODE_FACE_DETECTED) { - setTimeout(() => { - AppStorage.Set('width', Constants.SHELTER_END_WIDTH) - AppStorage.Set('height', Constants.SHELTER_END_HEIGHT) - AppStorage.Set('showAperture', false) - }, Constants.TIMEOUT_900) - } + /** + * Open session and get challenge. + * @param callback + */ + openSession(callback) { + console.info("FaceEnroll model_2D openSession start"); + this.UserIDM.openSession((data) => { + try { + console.info("FaceEnroll model_2D openSession data", data); + callback(data); } - if(data.code == Constants.CODE_CANCEL) { - Log.showInfo(TAG,'startEnroll cancel data:' + data.errorCode) + catch (e) { + console.info("FaceEnroll model_2D openSession error", e); } - if(data.code == Constants.CODE_RESULT) { - Log.showInfo(TAG,'enter result') - if(data.errorCode == Constants.ERROR_CODE_SUCCESS){ - AppStorage.Set('showPrg',true) - Constants.progress_2D() - this.endEnroll() + }) + callback(); + console.info("FaceEnroll model_2D openSession end"); + } + + /** + * start enroll, get callback value + */ + startEnroll(credentialInfo) { + this.UserIDM.addCredential(credentialInfo, { + onResult: (result, extraInfo) => { + if (result == Constants.RESULT_CODE_SUCCESS) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('showPrg', true); + Constants.progress_2D(); + this.endEnroll(); + } + if (result == Constants.RESULT_CODE_FAIL) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_GENERAL_ERROR) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); } - var res = mRes.has(data.errorCode) - if(res){ - AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')) - AppStorage.Set('enrollInfo',mRes.get(data.errorCode)) - AppStorage.Set('blur',Constants.BLUR_END) - AppStorage.Set('showBtn',true) - AppStorage.Set('showBack',false) - AppStorage.Set('prgValue',$r('app.float.progress_value_start')) + if (result == Constants.RESULT_CODE_CANCELED) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); } - if(data.errorCode == Constants.ERROR_CODE_TIMEOUT){ - AppStorage.Set('enrollTitle', $r('app.string.enrolling_timeout')) - AppStorage.Set('enrollInfo','') - AppStorage.Set('blur',Constants.BLUR_END) - AppStorage.Set('showBtn',true) - AppStorage.Set('showBack',false) - AppStorage.Set('prgValue',$r('app.float.progress_value_start')) + if (result == Constants.RESULT_CODE_TIMEOUT) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.enrolling_timeout')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); } + if (result == Constants.RESULT_CODE_TYPE_NOT_SUPPORT) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_TRUST_LEVEL_NOT_SUPPORT) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_BUSY) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_INVALID_PARAMETERS) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_LOCKED) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_NOT_ENROLLED) { + console.info(" FaceEnroll model_2D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + }, + onAcquireInfo: (callbackModule, acquire, extraInfo) => { + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.enrolling')); + AppStorage.Set('enrollInfo', mFaceTips.get(acquire)); } }) - this.endEnroll() + this.endEnroll(); } -//post and release - private endEnroll(){ - var post = userEnroll.postEnroll() - Log.showInfo(TAG,'endEnroll postEnroll post:' + post) - var res = userEnroll.release() - Log.showInfo(TAG,'endEnroll release res:' + res) + /** + * end enroll + */ + endEnroll() { + console.info("FaceEnroll model_2D endEnroll start"); + this.UserIDM.closeSession(); + console.info("FaceEnroll model_2D endEnroll userEnroll.closeSession() close"); + AppStorage.Delete('faceSession'); + console.info("FaceEnroll model_2D endEnroll end"); } + /** + * cancel enroll + */ + cancelEnroll() { + console.info("FaceEnroll model_2D cancelEnroll start"); + let can = this.UserIDM.cancel(AppStorage.Get('faceSession')); + console.info("FaceEnroll model_2D cancelEnroll userEnroll.cancel() can" + can); + this.endEnroll(); + console.info("FaceEnroll model_2D cancelEnroll end"); + } + + /** + * change index 3d + */ change_3D() { - AppStorage.Set('show_startViews','3D') + AppStorage.Set('show_startViews', '3D'); } + /** + * change index 2d + */ change_2D() { - AppStorage.Set('show_startViews','2D') + AppStorage.Set('show_startViews', '2D'); } -//init index - init(){ - AppStorage.SetAndLink('show_startViews','2D') + + /** + * init index + */ + init() { + AppStorage.SetAndLink('show_startViews', '2D'); } } + let mFaceModel = new model_2D(); + export default mFaceModel as model_2D; diff --git a/ui/faceenroll/product/phone/src/main/ets/default/model_3D.ets b/ui/faceenroll/product/phone/src/main/ets/default/model_3D.ets index 2e6f11b12fad4f45a8963814a4d40d5290beb5ac..6e01bda62c82dc164c34598b0929f809860b67aa 100644 --- a/ui/faceenroll/product/phone/src/main/ets/default/model_3D.ets +++ b/ui/faceenroll/product/phone/src/main/ets/default/model_3D.ets @@ -14,82 +14,53 @@ * limitations under the License. */ -import Log from '../../../../../../common/src/main/ets/default/Log.ets' -import router from '@system.router'; -import userEnroll from '@ohos.enroll' -import Constants from '../default/common/constant.ets' +import Constants from '../default/common/constant.ets'; +import UserIDM from '@ohos.useridm'; -const TAG = 'faceenroll-faceModel_3D'; -var mPrgValue -var mValue = Constants.value() -var mPro = Constants.progress() -var mRes = Constants.result() +var mPrgvalue; +var mResultCode = Constants.resultCode(); +var mFaceTips = Constants.FaceTips(); -async function routeSuccess() { - let options = { - uri: 'pages/success' - } - try { - await router.push(options) - } catch (err) { - console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) - } -} +export class model_3D { + private UserIDM; -async function route_back() { - let options = { - uri: 'pages/index' - } - try { - await router.push(options) - } catch (err) { - console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) + constructor() { + this.UserIDM = UserIDM.constructor(); } -} - -export class model_3D { - // init page - initFaceModel() { - Log.showInfo(TAG, 'initFaceModel'); + /** + * init FaceModel + */ + initFaceModel(credentialInfo) { + console.info("FaceEnroll model_3D initFaceModel start"); AppStorage.Link('width'); AppStorage.Link('height'); AppStorage.Link('showPrg'); - mPrgValue = AppStorage.Link('prgValue'); + mPrgvalue = AppStorage.Link('prgValue'); AppStorage.Link('showBtn'); AppStorage.Link('blur'); AppStorage.Link('showBack'); AppStorage.Set('enrollInfo', $r('app.string.enroll_info')) AppStorage.Set('enrollTitle', $r('app.string.face_record')) AppStorage.Link('showAperture1') - - var result = userEnroll.init() - Log.showInfo(TAG,'initFaceModel init result:' + result) - - var challenge = userEnroll.preEnroll() - Log.showInfo(TAG,'initFaceModel perEnroll challenge:'+ challenge) - - var angle = userEnroll.getAngleDim() - Log.showInfo(TAG,'initFaceModel getAngleDim angle:' + angle ) - - this.startEnroll(); + this.startEnroll(credentialInfo); + console.info("FaceEnroll model_3D initFaceModel end"); } - //resume page + + /** + * resume page, unInit FaceModel + */ uninitFaceModel() { - if(mPrgValue != Constants.PROGRESS_TOTAL) - { - var cal = userEnroll.cancelEnroll() - Log.showInfo(TAG,'uninitFaceModel cancel cal:' + cal) + console.info(" FaceEnroll model_3D uninitFaceModel start"); + if (mPrgvalue != Constants.PROGRESS_TOTAL) { + this.cancelEnroll(); } - - setTimeout(()=> { - Log.showInfo(TAG, 'uninitFaceModel'); - + setTimeout(() => { AppStorage.Set('width', Constants.SHELTER_START_WIDTH); AppStorage.Set('height', Constants.SHELTER_START_HEIGHT); AppStorage.Set('showPrg', false) - mPrgValue = AppStorage.Set('prgValue', $r('app.float.progress_value_start')) + mPrgvalue = AppStorage.Set('prgValue', $r('app.float.progress_value_start')) AppStorage.Set('showBack', true) AppStorage.Set('blur', Constants.BLUR_START) AppStorage.Set('showBtn', false) @@ -104,90 +75,181 @@ export class model_3D { },Constants.TIMEOUT_500) } - //get callback value - private startEnroll(){ - userEnroll.enroll({enrollParam:{ - token: Constants.PARAM_TOKEN, - flags: Constants.FLAGS, - faceId: Constants.FACEID, - previewId: Constants.PREVIEWID - }},function(data) { - Log.showInfo(TAG,'startEnroll enroll data:' + data.code) - Log.showInfo(TAG,'startEnroll enroll data:' + data.errorCode) + /** + * Open session and get challenge. + * @param callback + */ + openSession(callback) { + console.info("FaceEnroll model_3D openSession start"); + this.UserIDM.openSession((data) => { + try { + console.info("FaceEnroll model_3D openSession data", data); + callback(data); + } + catch (e) { + console.info("FaceEnroll model_3D openSession error", e); + } + }) + callback(); + console.info("FaceEnroll model_3D openSession end"); + } - if(data.code == Constants.CODE_ACQUIRE) { - if (data.errorCode == Constants.ERROR_CODE_FACE_DETECTED) { - setTimeout(() => { + /** + * start enroll, get callback value + */ + startEnroll(credentialInfo) { + console.info(" FaceEnroll model_3D startEnroll 3d start "); + this.UserIDM.addCredential(credentialInfo, { + onResult: (result, extraInfo) => { + if (result == Constants.RESULT_CODE_SUCCESS) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('showPrg', true); + Constants.progress_2D(); + this.endEnroll(); + } + if (result == Constants.RESULT_CODE_FAIL) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); AppStorage.Set('width', Constants.SHELTER_END_WIDTH); - AppStorage.Set('height', Constants.SHELTER_3D_END_HEIGHT); - }, Constants.TIMEOUT_1000) - Constants.aperture() - + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); } - - var pro = mPro.has(data.errorCode) - - Log.showInfo(TAG,'startEnroll enroll pro:' + pro) - if(pro) { - AppStorage.Set('showPrg',true) - mPrgValue = AppStorage.Set('prgValue',mPro.get(data.errorCode)) + if (result == Constants.RESULT_CODE_GENERAL_ERROR) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); } - - var have = mValue.has(data.errorCode) - Log.showInfo(TAG,'startEnroll enroll have:' + have) - if(have){ - AppStorage.Set('enrollInfo',mValue.get(data.errorCode)) + if (result == Constants.RESULT_CODE_CANCELED) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); } - } - - if(data.code == Constants.CODE_CANCEL) { - Log.showInfo(TAG,'startEnroll cancel data:' + data.errorCode) - } - - if(data.code == Constants.CODE_RESULT) { - if(data.errorCode == Constants.ERROR_CODE_SUCCESS){ - - routeSuccess() - setTimeout(()=>{ - route_back() - },Constants.TIMEOUT_1000) + if (result == Constants.RESULT_CODE_TIMEOUT) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.enrolling_timeout')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); } - - var res = mRes.has(data.errorCode) - if(res){ - AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')) - AppStorage.Set('enrollInfo',mRes.get(data.errorCode)) - AppStorage.Set('blur',Constants.BLUR_END) - AppStorage.Set('showBtn',true) - AppStorage.Set('showBack',false) - AppStorage.Set('prgValue',$r('app.float.progress_value_start')) - AppStorage.Set('showAperture5',false) + if (result == Constants.RESULT_CODE_TYPE_NOT_SUPPORT) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); } - if(data.errorCode == Constants.ERROR_CODE_TIMEOUT){ - AppStorage.Set('enrollTitle', $r('app.string.enrolling_timeout')) - AppStorage.Set('enrollInfo','') - AppStorage.Set('blur',Constants.BLUR_END) - AppStorage.Set('showBtn',true) - AppStorage.Set('showBack',false) - AppStorage.Set('prgValue',$r('app.float.progress_value_start')) - AppStorage.Set('showAperture5',false) + if (result == Constants.RESULT_CODE_TRUST_LEVEL_NOT_SUPPORT) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_BUSY) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_INVALID_PARAMETERS) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); } + if (result == Constants.RESULT_CODE_LOCKED) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + if (result == Constants.RESULT_CODE_NOT_ENROLLED) { + console.info(" FaceEnroll model_3D startEnroll UserIDM.addCredential onResult result", result); + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.face_record_3d_record_fail')); + AppStorage.Set('enrollInfo', mResultCode.get(result)); + AppStorage.Set('blur', Constants.BLUR_END); + AppStorage.Set('showBtn', true); + AppStorage.Set('showBack', false); + AppStorage.Set('prgValue', $r('app.float.progress_value_start')); + } + }, + onAcquireInfo: (callbackModule, acquire, extraInfo) => { + AppStorage.Set('width', Constants.SHELTER_END_WIDTH); + AppStorage.Set('height', Constants.SHELTER_END_HEIGHT); + AppStorage.Set('showAperture', false); + AppStorage.Set('enrollTitle', $r('app.string.enrolling')); + AppStorage.Set('enrollInfo', mFaceTips.get(acquire)); } }) - this.endEnroll() + this.endEnroll(); } - //post and release - private endEnroll(){ - var post = userEnroll.postEnroll() - Log.showInfo(TAG,'endEnroll postEnroll post:' +post) - var res = userEnroll.release() - Log.showInfo(TAG,'endEnroll release res:' + res ) + /** + * end enroll + */ + endEnroll() { + console.info("FaceEnroll model_3D endEnroll start"); + this.UserIDM.closeSession(); + console.info("FaceEnroll model_3D endEnroll userEnroll.closeSession()"); + AppStorage.Delete('faceSession'); + console.info("FaceEnroll model_3D endEnroll end"); } - private toSuccess() { - routeSuccess() - + /** + * cancel enroll + */ + cancelEnroll() { + console.info("FaceEnroll model_3D cancelEnroll start"); + let can = this.UserIDM.cancel(AppStorage.Get('faceSession')); + console.info("FaceEnroll model_3D cancelEnroll userEnroll.cancel() can" + can); + this.endEnroll(); + console.info("FaceEnroll model_3D cancelEnroll end"); } } diff --git a/ui/faceenroll/product/phone/src/main/ets/default/pages/aperture.ets b/ui/faceenroll/product/phone/src/main/ets/default/pages/aperture.ets index 8c7fe55d21aff3046fb53816b5d2573b690cdcbb..f95bd98aa9fb674c6315d908791248a8f89350cc 100644 --- a/ui/faceenroll/product/phone/src/main/ets/default/pages/aperture.ets +++ b/ui/faceenroll/product/phone/src/main/ets/default/pages/aperture.ets @@ -13,20 +13,17 @@ * limitations under the License. */ -import Constants from '../common/constant.ets' +import Constants from '../common/constant.ets'; @Entry @Component - export default - struct Aperture { - - @StorageLink('showAperture1') showAperture1:boolean = true - @StorageLink('showAperture2') showAperture2:boolean = false - @StorageLink('showAperture3') showAperture3:boolean = false - @StorageLink('showAperture4') showAperture4:boolean = false - @StorageLink('showAperture5') showAperture5:boolean = false + @StorageLink('showAperture1') showAperture1:boolean = true; + @StorageLink('showAperture2') showAperture2:boolean = false; + @StorageLink('showAperture3') showAperture3:boolean = false; + @StorageLink('showAperture4') showAperture4:boolean = false; + @StorageLink('showAperture5') showAperture5:boolean = false; build() { Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { diff --git a/ui/faceenroll/product/phone/src/main/ets/default/pages/declare.ets b/ui/faceenroll/product/phone/src/main/ets/default/pages/declare.ets index e2df2be2ea8a1990a5b5a108fdd2be1285006939..d845020ee1b1155e1c0d46e3df39152d52cfb1e6 100644 --- a/ui/faceenroll/product/phone/src/main/ets/default/pages/declare.ets +++ b/ui/faceenroll/product/phone/src/main/ets/default/pages/declare.ets @@ -13,88 +13,189 @@ * limitations under the License. */ -import Constants from '../common/constant.ets' +import Constants from '../common/constant.ets'; import router from '@system.router'; + @Entry @Component +export default struct Declare { + Scroll: Scroller = new Scroller(); + pattern: string = "2D"; -export default - -struct Declare { build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { - Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center}) { - Image($r('app.media.back')) - .width(Constants.BACK_WIDTH) - .height(Constants.BACK_HEIGHT) + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Scroll(this.Scroll) { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { + Image($r('app.media.back')) + .width(Constants.BACK_WIDTH) + .height(Constants.BACK_HEIGHT) + .onClick(() => { + router.back(); + }) + + Text(this.pattern == "2D" ? $r('app.string.face_guide_2d_announce_link') : $r("app.string.face_guide_3d_announce_link")) + .fontSize(Constants.DECLARE_TITLE_FONT_SIZE) + .fontWeight(FontWeight.Bold) + } .margin({ top: $r('app.float.back_margin') }) - .onClick(() => { - router.back() - }) - } - Text($r('app.string.face_recognize_annouce')) - .fontSize(Constants.TITLE_FONT_SIZE) - .fontWeight(FontWeight.Bold) - .margin({ top: Constants.TITLE_MARGIN }) - - Text() { - Span($r('app.string.face_recognize_annouce_message_01')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_recognize_annouce_message_02')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_recognize_annouce_message_03')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_recognize_annouce_message_04')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_recognize_annouce_message_05')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_recognize_annouce_message_06')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_recognize_annouce_message_07')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_recognize_annouce_message_08')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_recognize_annouce_message_09')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_recognize_annouce_message_10')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_recognize_annouce_message_11')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_recognize_annouce_message_12')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - }.margin({ top: Constants.CONTENT2_MARGIN }) - .textAlign(TextAlign.Start) - .width(Constants.ENROLL_INFO_WIDTH) - - Text($r('app.string.face_recognize_annouce_message_13')) - .fontSize(Constants.SMALL_TITLE_FONT_SIZE) - .fontWeight(Constants.FONT_WEIGHT) - .textAlign(TextAlign.Center) - - Text() { - Span($r('app.string.face_recognize_annouce_message_14')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_recognize_annouce_message_15')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - }.margin({ top: Constants.CONTENT2_MARGIN }) - .textAlign(TextAlign.Start) - .width(Constants.ENROLL_INFO_WIDTH) - }.width('100%') - .height('100%') + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Text($r("app.string.face_feature_desc")) + .fontSize(Constants.DECLARE_SECONDARY_TITLE_FONT_SIZE) + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start) + .margin({ top: Constants.DECLARE_TITLE_MARGIN_TOP, bottom: Constants.DECLARE_TITLE_MARGIN_BOTTOM }) + Text(this.pattern == "2D" ? $r("app.string.face_recognize_annouce_message_01") : $r("app.string.face_3drecognize_annouce_message_01")) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start) + .margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM}) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + Text($r("app.string.face_recognize_annouce_message_02")) + .fontSize(Constants.DECLARE_SECONDARY_TITLE_FONT_SIZE) + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start) + .margin({ top: Constants.DECLARE_TITLE_MARGIN_TOP, bottom: Constants.DECLARE_TITLE_MARGIN_BOTTOM }) + Text($r("app.string.face_recognize_annouce_message_03")) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + Text($r("app.string.face_recognize_annouce_message_04")) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + Text($r("app.string.face_recognize_annouce_message_05")) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + .width(Constants.DECLARE_MAX_WIDTH) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + Text($r("app.string.face_recognize_annouce_message_06")) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + Text($r("app.string.face_recognize_annouce_message_07")) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + Text($r("app.string.face_recognize_annouce_message_08")) + .fontSize(Constants.DECLARE_SECONDARY_TITLE_FONT_SIZE) + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ top: Constants.DECLARE_TITLE_MARGIN_TOP, bottom: Constants.DECLARE_TITLE_MARGIN_BOTTOM }) + + Text($r("app.string.face_recognize_annouce_message_09")) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + if (this.pattern == "2D") { + Text($r("app.string.face_annouce_tip1_item2_3d")) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + Text() { + Span(Constants.DECLARE_TITLE_3).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + Span($r("app.string.face_recognize_annouce_message_10")).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + } + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + + Text() { + Span(Constants.DECLARE_TITLE_4).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + Span($r("app.string.face_recognize_annouce_message_11")).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + } + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + + Text() { + Span(Constants.DECLARE_TITLE_5).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + Span($r("app.string.face_recognize_annouce_message_12")).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + } + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + } else if (this.pattern == "3D") { + Text() { + Span(Constants.DECLARE_TITLE_2).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + Span($r("app.string.face_recognize_annouce_message_10")).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + } + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + + Text() { + Span(Constants.DECLARE_TITLE_3).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + Span($r("app.string.face_recognize_annouce_message_11")).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + } + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + + Text() { + Span(Constants.DECLARE_TITLE_4).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + Span($r("app.string.face_recognize_annouce_message_12")).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + } + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start).margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + } + + + Text($r("app.string.face_recognize_annouce_message_13")) + .fontSize(Constants.DECLARE_SECONDARY_TITLE_FONT_SIZE) + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start) + .margin({ top: Constants.DECLARE_TITLE_MARGIN_TOP, bottom: Constants.DECLARE_TITLE_MARGIN_BOTTOM }) + + + Text() { + Span($r("app.string.face_recognize_annouce_message_14_1")) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + Span($r("app.string.face_recognize_annouce_message_14_3")) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + .fontWeight(FontWeight.Bold) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + Span($r("app.string.face_recognize_annouce_message_14_2")) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + Span($r("app.string.face_recognize_annouce_message_14_3")) + .fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + .fontWeight(FontWeight.Bold) + + } + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start) + .margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + + Text() { + Span($r("app.string.face_recognize_annouce_message_15_1")).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + Span($r("app.string.face_recognize_annouce_message_14_3")).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + .fontWeight(FontWeight.Bold) + Span($r("app.string.face_recognize_annouce_message_15_2")).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + Span($r("app.string.face_recognize_annouce_message_15_3")).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + .fontWeight(FontWeight.Bold) + Span($r("app.string.face_recognize_annouce_message_15_4")).fontSize(Constants.DECLARE_TEXT_FONT_SIZE) + } + .width(Constants.DECLARE_MAX_WIDTH) + .textAlign(TextAlign.Start) + .margin({ bottom: Constants.DECLARE_ITEM_MARGIN_BOTTOM }) + .lineHeight(Constants.DECLARE_TEXT_LINE_HEIGHT) + }.width(Constants.DECLARE_WIDTH) + + } + } + .scrollBarWidth(Constants.DECLARE_SCROLL_BAR_WIDTH) + } + .backgroundColor(Constants.DECLARE_BACKGROUND_COLOR) + .width(Constants.DECLARE_MAX_WIDTH) } -} \ No newline at end of file +} + + diff --git a/ui/faceenroll/product/phone/src/main/ets/default/pages/enroll_2D.ets b/ui/faceenroll/product/phone/src/main/ets/default/pages/enroll_2D.ets index e21207de6c4eec306ad168fadc18d33f86693127..a942b007f043e88b80588071ec54cdb5dc414f78 100644 --- a/ui/faceenroll/product/phone/src/main/ets/default/pages/enroll_2D.ets +++ b/ui/faceenroll/product/phone/src/main/ets/default/pages/enroll_2D.ets @@ -14,45 +14,61 @@ */ import router from '@system.router'; -import mFaceModel from "../model_2D.ets" -import Log from '../../../../../../../common/src/main/ets/default/Log.ets' -import Constants from '../common/constant.ets' -const TAG = 'faceenroll_2D' +import mFaceModel from "../model_2D.ets"; +import Constants from '../common/constant.ets'; +const SUBTYPE_FACE_2D = 20000; +const AUTHTYPE_FACE = 2; async function route_back() { let options = { - uri: 'pages/index' + uri: 'pages/entryView' } try { - await router.push(options) + await router.push(options); } catch (err) { - console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); } } @Entry @Component export default struct Enroll_2D { - @StorageLink('showAperture') showAperture: boolean = true - @StorageLink('blur') blur: number = Constants.BLUR_START - @StorageLink('width') width: any = Constants.SHELTER_START_WIDTH - @StorageLink('height') height: any = Constants.SHELTER_START_HEIGHT - @StorageLink('showPrg') showPrg: boolean = false - @StorageLink('prgValue') prgValue: number = Constants.PROGRESS_START - @StorageLink('enrollInfo') enrollInfo: any = $r('app.string.enroll_info') - @StorageLink('enrollTitle') enrollTitle: any = $r('app.string.face_record') - @StorageLink('showBtn') showBtn: boolean = false - @StorageLink('showBack') showBack: boolean = true + @StorageLink('showAperture') showAperture: boolean = true; + @StorageLink('blur') blur: number = Constants.BLUR_START; + @StorageLink('width') width: any = Constants.SHELTER_START_WIDTH; + @StorageLink('height') height: any = Constants.SHELTER_START_HEIGHT; + @StorageLink('showPrg') showPrg: boolean = false; + @StorageLink('prgValue') prgValue: number = Constants.PROGRESS_START; + @StorageLink('enrollInfo') enrollInfo: any = ''; + @StorageLink('enrollTitle') enrollTitle: any = ''; + @StorageLink('showBtn') showBtn: boolean = false; + @StorageLink('showBack') showBack: boolean = true; + private credentialInfo; - //init page private aboutToAppear(): void { - mFaceModel.initFaceModel() - Log.showInfo(TAG, 'aboutToAppear'); + setTimeout(()=> { + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView' + }); + }, 180000) + + this.credentialInfo = { + credType:AUTHTYPE_FACE, + credSubType:SUBTYPE_FACE_2D, + token:AppStorage.Get('token') + }; + mFaceModel.initFaceModel(this.credentialInfo); } - //hide page change + private onPageHide() { - mFaceModel.uninitFaceModel() - Log.showInfo(TAG, 'PageHide'); + mFaceModel.uninitFaceModel(); + } + private onBackPress(): void{ + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) } build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { @@ -61,8 +77,6 @@ export default struct Enroll_2D { .height(Constants.CENTER_HEIGHT) .align(Alignment.Center) .position({x: $r('app.float.enroll_center_position_X'),y:Constants.ENROLL_CENTER_POSITION_Y}) - - Flex() .width('100%') .height(Constants.CENTER_HEIGHT) @@ -70,14 +84,12 @@ export default struct Enroll_2D { .blur(this.blur) .position({x:$r('app.float.enroll_center_position_X'),y: Constants.ENROLL_CENTER_POSITION_Y}) .animation({ duration: Constants.SHELTER_ANIMATOR, curve: Curve.Linear }) - if (this.showAperture) { Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { Image($r('app.media.aperture1')) .width(Constants.APERTURE1_WIDTH) .height(Constants.APERTURE1_WIDTH) .align(Alignment.Center) - // .position({ x: $r('app.float.aperture1_position_X'), y: $r('app.float.aperture1_position_Y') }) } .position({x:$r('app.float.enroll_center_position_X'),y:Constants.ENROLL_CENTER_POSITION_Y}) .height(Constants.CENTER_HEIGHT) @@ -86,8 +98,7 @@ export default struct Enroll_2D { Flex() .width('100%') - .height(Constants.ENROLL_CENTER_POSITION_Y) - + .height(Constants.ENROLL_CENTER_POSITION_Y) Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { Image($r('app.media.shelter')) .width(this.width) @@ -96,7 +107,6 @@ export default struct Enroll_2D { }.width('100%') .height(Constants.CENTER_HEIGHT) - if(this.showPrg) { Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { Progress({ value: Constants.PROGRESS_START, total: Constants.PROGRESS_TOTAL, style: ProgressStyle.Capsule }) @@ -107,24 +117,22 @@ export default struct Enroll_2D { .height(Constants.CENTER_HEIGHT) .width('100%') } - if(this.showBack) { Flex() { Image($r('app.media.back')) .width(Constants.BACK_WIDTH) .height(Constants.BACK_HEIGHT) .onClick(() => { - router.back() + mFaceModel.cancelEnroll(); + router.back(); }) }.position({ x: $r('app.float.enroll_center_position_X'), y: Constants.CENTER_POSITION_Y }) } - Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { Text(this.enrollTitle) .fontSize(Constants.TITLE_FONT_SIZE) .fontWeight(Constants.ENROll_TITLE) }.position({x:$r('app.float.enroll_title_position_X'),y:Constants.TITLE_ENROLLING_MARGIN}) - Flex({justifyContent:FlexAlign.Center}) { Text(this.enrollInfo) .fontSize(Constants.ERROR_CODE_INFO_SIZE) @@ -132,7 +140,6 @@ export default struct Enroll_2D { } .position({ x:$r('app.float.enroll_info_X'), y: Constants.ENROLL_INFO_POSITION}) .width(Constants.ENROLL_INFO_WIDTH) - if(this.showBtn){ Flex({justifyContent:FlexAlign.Center}) { Button({ type: ButtonType.Capsule, stateEffect: true }) { @@ -144,7 +151,7 @@ export default struct Enroll_2D { .width(Constants.BUTTON_WIDTH) .height(Constants.BUTTON_HEIGHT) .onClick(() => { - route_back() + route_back(); }) }.position({ x:$r('app.float.enroll_center_position_X'), y: Constants.BUTTON_POSITION}) } diff --git a/ui/faceenroll/product/phone/src/main/ets/default/pages/enroll_3D.ets b/ui/faceenroll/product/phone/src/main/ets/default/pages/enroll_3D.ets index 63a6e654696d9811ccc7d2b5ca9b0b87048f478d..d0d5e38a884aef251119000a048e7fbd9f1a7a3d 100644 --- a/ui/faceenroll/product/phone/src/main/ets/default/pages/enroll_3D.ets +++ b/ui/faceenroll/product/phone/src/main/ets/default/pages/enroll_3D.ets @@ -14,48 +14,62 @@ */ import router from '@system.router'; -import Aperture from './aperture.ets' -import Log from '../../../../../../../common/src/main/ets/default/Log.ets' -import mFaceModel from '../model_3D.ets' -import Constants from '../common/constant.ets' -const TAG = 'faceenroll_3D' +import Aperture from './aperture.ets'; +import mFaceModel from '../model_3D.ets'; +import Constants from '../common/constant.ets'; +const SUBTYPE_FACE_2D = 20000; +const AUTHTYPE_FACE = 2; async function route_back() { let options = { - uri: 'pages/index' + uri: 'pages/entryView' } try { - await router.push(options) + await router.push(options); } catch (err) { - console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); } } @Entry @Component - struct Enroll_3D { + @StorageLink('blur') blur: number = Constants.BLUR_START; + @StorageLink('width') width: any = Constants.SHELTER_START_WIDTH; + @StorageLink('height') height: any = Constants.SHELTER_START_HEIGHT; + @StorageLink('showPrg') showPrg: boolean = false; + @StorageLink('prgValue') prgValue: number = Constants.PROGRESS_START; + @StorageLink('enrollInfo') enrollInfo: any = $r('app.string.enroll_info'); + @StorageLink('enrollTitle') enrollTitle: any = $r('app.string.face_record'); + @StorageLink('showBtn') showBtn: boolean = false; + @StorageLink('showBack') showBack: boolean = true; + private credentialInfo; - @StorageLink('blur') blur: number = Constants.BLUR_START - @StorageLink('width') width: any = Constants.SHELTER_START_WIDTH - @StorageLink('height') height: any = Constants.SHELTER_START_HEIGHT - @StorageLink('showPrg') showPrg: boolean = false - @StorageLink('prgValue') prgValue: number = Constants.PROGRESS_START - @StorageLink('enrollInfo') enrollInfo: any = $r('app.string.enroll_info') - @StorageLink('enrollTitle') enrollTitle: any = $r('app.string.face_record') - @StorageLink('showBtn') showBtn: boolean = false - @StorageLink('showBack') showBack: boolean = true - - //init page private aboutToAppear(): void { - mFaceModel.initFaceModel() - Log.showInfo(TAG, 'aboutToAppear'); + setTimeout(()=> { + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView' + }); + }, 180000) + + this.credentialInfo = { + credType:AUTHTYPE_FACE, + credSubType:SUBTYPE_FACE_2D, + token:AppStorage.Get('token') + }; + mFaceModel.initFaceModel(this.credentialInfo); } - //hide page change + private onPageHide() { + mFaceModel.uninitFaceModel(); + } - mFaceModel.uninitFaceModel() - Log.showInfo(TAG, 'PageHide'); + private onBackPress(): void{ + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) } build() { @@ -76,7 +90,7 @@ struct Enroll_3D { Flex() .width('100%') - .height(Constants.ENROLL_CENTER_POSITION_Y) + .height(Constants.ENROLL_CENTER_POSITION_Y) Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { Image($r('app.media.shelter')) @@ -92,14 +106,11 @@ struct Enroll_3D { .value(this.prgValue) .width(Constants.PROGRESS_WIDTH) .color(0x317aff) - // .position({ x: $r('app.float.enroll_progress_2D_X'), y: $r('app.float.enroll_progress_Y') }) }.position({x:$r('app.float.enroll_center_position_X'),y: Constants.ENROLL_CENTER_POSITION_Y}) .height(Constants.CENTER_HEIGHT) .width('100%') } - Aperture() - Flex({justifyContent:FlexAlign.Center}) { Text(this.enrollInfo) .fontSize(Constants.ERROR_CODE_INFO_SIZE) @@ -114,7 +125,8 @@ struct Enroll_3D { .height(Constants.BACK_HEIGHT) .position({ x:$r('app.float.enroll_center_position_X'), y: Constants.CENTER_POSITION_Y }) .onClick(() => { - router.back() + mFaceModel.cancelEnroll(); + router.back(); }) } Flex({ alignItems: ItemAlign.Center , justifyContent:FlexAlign.Center}) { @@ -134,12 +146,11 @@ struct Enroll_3D { .width(Constants.BUTTON_WIDTH) .height(Constants.BUTTON_HEIGHT) .onClick(() => { - route_back() + route_back(); }) }.position({ x:$r('app.float.enroll_center_position_X'), y: Constants.BUTTON_POSITION}) } } - .width('100%') .height('100%') } diff --git a/ui/faceenroll/product/phone/src/main/ets/default/pages/entryView.ets b/ui/faceenroll/product/phone/src/main/ets/default/pages/entryView.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecb9c629b6c43d71e2259b864f9ed9382dd2cb48 --- /dev/null +++ b/ui/faceenroll/product/phone/src/main/ets/default/pages/entryView.ets @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; +import UserAuthPresenter from '../../../../../../../common/src/main/ets/default/common/presenter/userAuthPresenter.ets' + +let mUserAuthPresenter: UserAuthPresenter; + +@Entry +@Component +struct entryView { + @State open_userAuth: boolean = false; + + private aboutToAppear(): void { + AppStorage.Delete('faceInfo'); + AppStorage.Delete('authLength'); + AppStorage.Delete('userMode'); + AppStorage.Delete('faceToken'); + mUserAuthPresenter = UserAuthPresenter.getInstance(); + } + + build() { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('人脸识别', { type: ButtonType.Normal, stateEffect: true }) + .onClick(() => { + mUserAuthPresenter.jumpToUserAuth(this.getTokenCallBack.bind(this)); + }) + } + } + +/** + * Get token callback. + */ + public getTokenCallBack() { + let faceToken = AppStorage.Get('faceToken'); + if (faceToken != undefined) { + this.jumpToUserAuth(); + } + } + +/** + * Jump to userAuth page. + */ + private jumpToUserAuth() { + router.push({ + uri: 'pages/userAuth', + }) + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/phone/src/main/ets/default/pages/index.ets b/ui/faceenroll/product/phone/src/main/ets/default/pages/index.ets index 45bca96ef4517201ffd5bfc7d62a6de331a7ee47..9aa2659e3b4db44c20a6c7fbb176bec522d5f87e 100644 --- a/ui/faceenroll/product/phone/src/main/ets/default/pages/index.ets +++ b/ui/faceenroll/product/phone/src/main/ets/default/pages/index.ets @@ -13,14 +13,21 @@ * limitations under the License. */ -import StartViews_2D from "./startViews_2D.ets" -import StartViews_3D from "./startViews_3D.ets" -import Constants from "../common/constant.ets" +import StartViews_2D from "./startViews_2D.ets"; +import StartViews_3D from "./startViews_3D.ets"; +import Constants from "../common/constant.ets"; +import router from '@system.router'; @Entry @Component struct Index { - @StorageLink('show_startViews') show_startViews: string = Constants.SHOW_START_VIEWS_2D + @StorageLink('show_startViews') show_startViews: string = Constants.SHOW_START_VIEWS_2D; + private onBackPress(): void{ + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) + } build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { diff --git a/ui/faceenroll/product/phone/src/main/ets/default/pages/startViews_2D.ets b/ui/faceenroll/product/phone/src/main/ets/default/pages/startViews_2D.ets index 3ec66164af62275b284cc3f4a382bbc8d25e1176..07187dd18d94d5fc7fd15e51347614ebcde73850 100644 --- a/ui/faceenroll/product/phone/src/main/ets/default/pages/startViews_2D.ets +++ b/ui/faceenroll/product/phone/src/main/ets/default/pages/startViews_2D.ets @@ -13,21 +13,18 @@ * limitations under the License. */ -import router from '@system.router' -import Log from '../../../../../../../common/src/main/ets/default/Log.ets' -import Constants from '../common/constant.ets' -import fileio from '@ohos.fileio' - -const TAG = 'startViews_2D' +import router from '@system.router'; +import Constants from '../common/constant.ets'; +import mFaceModel from "../model_2D.ets"; async function routeDeclare() { let options = { uri: 'pages/declare' } try { - await router.push(options) + await router.push(options); } catch (err) { - console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); } } async function routeEnroll_2D() { @@ -35,20 +32,36 @@ async function routeEnroll_2D() { uri: 'pages/enroll_2D' } try { - await router.push(options) + await router.push(options); } catch (err) { - console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); } } @Entry @Component - export default - struct StartViews_2D { - @StorageLink('checkbox_color') checkbox_color : any = $r('app.color.startView_color') + @StorageLink('checkbox_color') checkbox_color : any = $r('app.color.startView_color'); + private pageHideFlag: number = 0; + + public openSessionCallBack() { + routeEnroll_2D(); + } + private onPageHide(): void { + if (this.pageHideFlag == 0) { + router.push({ + uri: 'pages/entryView' + }) + } + } + private onBackPress(): void{ + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) + } build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { @@ -67,41 +80,40 @@ struct StartViews_2D { .fontWeight(FontWeight.Bold) .margin({ top: Constants.TITLE_MARGIN }) - Image($r('app.media.startImage_2D')) - .width('100%') - .height(Constants.IMAGE_2D_HEIGHT) - .margin({ top: Constants.IMAGE_MARGIN}) + Image($r('app.media.startImage_2D')) + .width('100%') + .height(Constants.IMAGE_2D_HEIGHT) + .margin({ top: Constants.IMAGE_MARGIN}) + + Column() { + Text($r('app.string.enroll_face_guide_title')) + .fontSize(Constants.SMALL_TITLE_FONT_SIZE) + .fontWeight(Constants.FONT_WEIGHT) + .textAlign(TextAlign.Center) - Column() { - Text($r('app.string.enroll_face_guide_title')) - .fontSize(Constants.SMALL_TITLE_FONT_SIZE) - .fontWeight(Constants.FONT_WEIGHT) - .textAlign(TextAlign.Center) + Text($r('app.string.face_guide_2d_way')) + .fontSize(Constants.FONT_SIZE) + .fontColor($r('app.color.font_color')) + .textAlign(TextAlign.Center) + .margin({ top: Constants.CONTENT1_MARGIN }) - Text($r('app.string.face_guide_2d_way')) - .fontSize(Constants.FONT_SIZE) + Text() { + Span($r('app.string.face_guide_2d_announce')) .fontColor($r('app.color.font_color')) - .textAlign(TextAlign.Center) - .margin({ top: Constants.CONTENT1_MARGIN }) - - Text() { - Span($r('app.string.face_guide_2d_announce')) - .fontColor($r('app.color.font_color')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - Span($r('app.string.face_guide_2d_announce_link')) - .textCase(TextCase.UpperCase) - .fontSize(Constants.FONT_SIZE) - .fontColor($r('app.color.startView_color')) - }.margin({ top: Constants.CONTENT2_MARGIN }) - .textAlign(TextAlign.Center) - .onClick(() => { - Log.showInfo(TAG, 'declare') - routeDeclare() - }) + .textCase(TextCase.UpperCase) + .fontSize(Constants.FONT_SIZE) + Span($r('app.string.face_guide_2d_announce_link')) + .textCase(TextCase.UpperCase) + .fontSize(Constants.FONT_SIZE) + .fontColor($r('app.color.startView_color')) + }.margin({ top: Constants.CONTENT2_MARGIN }) + .textAlign(TextAlign.Center) + .onClick(() => { + routeDeclare(); + }) - }.width(Constants.ENROLL_INFO_WIDTH) - .margin({ top: Constants.IMAGE_MARGIN }) + }.width(Constants.ENROLL_INFO_WIDTH) + .margin({ top: Constants.IMAGE_MARGIN }) Flex() { Toggle({ type: ToggleType.Checkbox, isOn: true }) @@ -118,11 +130,12 @@ struct StartViews_2D { Flex({justifyContent:FlexAlign.Center}) { Button({ type: ButtonType.Capsule, stateEffect: true }) { - Text($r('app.string.face_recognitin_guide')).fontSize(Constants.BUTTON_FONT_SIZE).fontColor(0xffffff) + Text($r('app.string.face_record')).fontSize(Constants.BUTTON_FONT_SIZE).fontColor(0xffffff) } .backgroundColor($r('app.color.startView_color')).width(Constants.BUTTON_WIDTH).height(Constants.BUTTON_HEIGHT) .onClick(() => { - routeEnroll_2D() + this.pageHideFlag = 1; + mFaceModel.openSession(this.openSessionCallBack.bind(this)); }) }.position({ x:$r('app.float.enroll_center_position_X'), y: Constants.BUTTON_POSITION}) } diff --git a/ui/faceenroll/product/phone/src/main/ets/default/pages/startViews_3D.ets b/ui/faceenroll/product/phone/src/main/ets/default/pages/startViews_3D.ets index e2a0e26768c83af64d489fb49da0b64ac0ba8e91..78e4f6aef34b5617d89d07b3d58663444a2911ce 100644 --- a/ui/faceenroll/product/phone/src/main/ets/default/pages/startViews_3D.ets +++ b/ui/faceenroll/product/phone/src/main/ets/default/pages/startViews_3D.ets @@ -13,20 +13,18 @@ * limitations under the License. */ -import router from '@system.router' -import fileio from '@ohos.fileio'; -import Log from '../../../../../../../common/src/main/ets/default/Log.ets' -import Constants from '../common/constant.ets' -const TAG = 'startViews_3D' +import router from '@system.router'; +import Constants from '../common/constant.ets'; +import mFaceModel from "../model_3D.ets"; async function routeEnroll_3D() { let options = { uri: 'pages/enroll_3D' } try { - await router.push(options) + await router.push(options); } catch (err) { - console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); } } async function routeDeclare() { @@ -34,21 +32,36 @@ async function routeDeclare() { uri: 'pages/declare' } try { - await router.push(options) + await router.push(options); } catch (err) { - console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); } } - @Entry @Component - export default - struct StartViews_3D { - @StorageLink('checkbox_color') checkbox_color : any = $r('app.color.startView_color') + private pageHideFlag: number = 0; + @StorageLink('checkbox_color') checkbox_color : any = $r('app.color.startView_color'); + public openSessionCallBack() { + routeEnroll_3D(); + } + + private onPageHide(): void { + if (this.pageHideFlag == 0) { + router.push({ + uri: 'pages/entryView' + }) + } + } + private onBackPress(): void{ + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) + } build() { Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center}) { @@ -100,12 +113,12 @@ struct StartViews_3D { .textCase(TextCase.UpperCase) .fontSize(Constants.FONT_SIZE) .fontColor($r('app.color.startView_color')) - } - .margin({ top: Constants.CONTENT2_MARGIN }) - .textAlign(TextAlign.Center) - .onClick(() => { - routeDeclare() - }) + } + .margin({ top: Constants.CONTENT2_MARGIN }) + .textAlign(TextAlign.Center) + .onClick(() => { + routeDeclare(); + }) }.width(Constants.ENROLL_INFO_WIDTH) .margin({ top: Constants.IMAGE_MARGIN }) @@ -129,7 +142,8 @@ struct StartViews_3D { } .backgroundColor($r('app.color.startView_color')) .width(Constants.BUTTON_WIDTH).height(Constants.BUTTON_HEIGHT) .onClick(() => { - routeEnroll_3D() + this.pageHideFlag = 1; + mFaceModel.openSession(this.openSessionCallBack.bind(this)); }) }.position({ x:$r('app.float.enroll_center_position_X'), y: Constants.BUTTON_POSITION}) } diff --git a/ui/faceenroll/product/phone/src/main/ets/default/pages/success.ets b/ui/faceenroll/product/phone/src/main/ets/default/pages/success.ets index 6c0df2fa89a33cc473b716eb11d3678e3fd7e8c6..bc6df13b355ad5f7b181c22b69b456242f4beaa5 100644 --- a/ui/faceenroll/product/phone/src/main/ets/default/pages/success.ets +++ b/ui/faceenroll/product/phone/src/main/ets/default/pages/success.ets @@ -13,22 +13,36 @@ * limitations under the License. */ import router from '@system.router'; -import Constants from '../common/constant.ets' +import Constants from '../common/constant.ets'; async function routeCase() { let options = { - uri: 'pages/index' + uri: 'pages/entryView' } try { - await router.push(options) + await router.push(options); } catch (err) { - console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`); } } @Entry @Component struct Success { + + onPageShow(){ + setTimeout(()=>{ + router.push({ + uri: 'pages/userAuth' + }) + },Constants.TIMEOUT_2000) + } + private onBackPress(): void{ + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) + } build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { Flex() { diff --git a/ui/faceenroll/product/phone/src/main/ets/default/pages/userAuth.ets b/ui/faceenroll/product/phone/src/main/ets/default/pages/userAuth.ets new file mode 100644 index 0000000000000000000000000000000000000000..f6febc6107bdb00aa07b1b8284c9091bbb21f294 --- /dev/null +++ b/ui/faceenroll/product/phone/src/main/ets/default/pages/userAuth.ets @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; +import userAuthModel from '../../../../../../../common/src/main/ets/default/common/model/userAuthModel.ets'; + +@Entry +@Component +struct userAuth { + @State authLength: number = 0; + @State userMode: string = ''; + private mUserAuthModel: userAuthModel; + private faceInfo ; + @State faceToken: string = ''; + @State getAllCallback: boolean = false; + + private aboutToAppear(): void { + this.mUserAuthModel = userAuthModel.getInstance(); + this.faceToken = AppStorage.Get('faceToken'); + if (this.mUserAuthModel != undefined) { + this.mUserAuthModel.getUserAuthInfo(this.getAuthInfoCallback.bind(this),this.getUserMode.bind(this)); + } + } + +/** + * Get phone mode(2D or 3D). + */ + public getUserMode() { + this.mUserAuthModel.getUserMode(this.getUserModeCallback.bind(this)); + } + + onPageShow() { + if (this.faceToken == '' || this.faceToken == undefined) { + router.push({ + uri: 'pages/entryView', + }) + } + } + +/** + * Get authInfo callback. + * @param {object} authInfo - Callback data. + * @param {function} getUserMode - Do this function after callback. + */ + public getAuthInfoCallback(authInfo,getUserMode) { + this.faceInfo = authInfo; + this.authLength = authInfo.length; + AppStorage.SetOrCreate('authLength',this.authLength); + AppStorage.SetOrCreate('faceInfo',this.faceInfo); + AppStorage.SetOrCreate('facePageFlag',0); + getUserMode(); + } + +/** + * Get phone mode(2D or 3D) callback. + * @param {string} userMode - Phone mode(2D or 3D). + */ + public getUserModeCallback(userMode) { + this.userMode = userMode; + AppStorage.SetOrCreate('userMode',this.userMode); + this.getAllCallback = true; + + } + + build() { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + if (this.getAllCallback) { + getRouter({ + authLength: this.authLength + }) + + } + } + } +} + +@Component +struct getRouter{ + @Prop authLength: number; + public aboutToAppear() { + if (this.authLength == 0) { + router.push({ + uri: 'pages/index', + }) + }else if(this.authLength > 0) { + router.push({ + uri: 'pages/userSettings', + }) + } + } + + build() { + Column() {} + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/phone/src/main/ets/default/pages/userSettings.ets b/ui/faceenroll/product/phone/src/main/ets/default/pages/userSettings.ets new file mode 100644 index 0000000000000000000000000000000000000000..525a8e90505ff410b75e226be8dd9e022c543056 --- /dev/null +++ b/ui/faceenroll/product/phone/src/main/ets/default/pages/userSettings.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import faceSettings from '../../../../../../../feature/faceSettings/src/main/ets/default/pages/faceSettings.ets'; +import TrustedDevices from '../../../../../../../feature/trustedDevice/src/main/ets/default/pages/index.ets'; +import router from '@system.router'; + +@Entry +@Component +struct userSettings { + @State authLength: number = 1; + @State userMode: string = ''; + @StorageLink('facePageFlag') facePageFlag: number = 0; + private faceInfo; + private faceToken; + + private aboutToAppear(): void { + this.faceInfo = AppStorage.Get('faceInfo'); + this.authLength = AppStorage.Get('authLength'); + this.userMode = AppStorage.Get('userMode'); + } + + private onPageHide(): void { + router.push({ + uri: 'pages/entryView' + }) + } + private onBackPress(): void{ + AppStorage.Delete('faceToken'); + router.push({ + uri: 'pages/entryView', + }) + } + onPageShow() { + + } + + build() { + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + if(this.authLength != 0) { + if (this.facePageFlag == 0) { + faceSettings({ + faceLength: this.authLength, + userMode: this.userMode + }); + }else if(this.facePageFlag == 1) { + TrustedDevices(); + } + } + } + } +} \ No newline at end of file diff --git a/ui/faceenroll/product/phone/src/main/resources/base/element/string.json b/ui/faceenroll/product/phone/src/main/resources/base/element/string.json index 21595d49f2e1332669e34059cce1906798a5d4ce..9958a872cd25533c7c451f80249165cf7c9901bf 100644 --- a/ui/faceenroll/product/phone/src/main/resources/base/element/string.json +++ b/ui/faceenroll/product/phone/src/main/resources/base/element/string.json @@ -9,284 +9,799 @@ "value": "JS_Phone_Empty Feature Ability" }, { - "name": "face_record", - "value": "Set up Face Recognition" + "name": "enrolling", + "value": "正在录入" }, { - "name": "face_record_3d_record_fail", - "value": "Setup failed" + "name": "enrolling_fail", + "value": "录入失败" }, { "name": "enrolling_timeout", - "value": "Enter the timeout" + "value": "录入超时" }, + { - "name": "face_2dguide_light_notify_universal", - "value": "Enable raise to wake" + "name": "declare", + "value": "声明" }, { - "name": "face_checker", - "value": "Face Recognition" + "name": "declare_content", + "value": " 如果您选择添加人脸数据,在亮屏状态,您将可以通过正面注视手机屏幕瞬间解锁。人脸数据储存在您的设备,而且不会通过云服务或者其他工具备份他处。" }, { - "name": "face_record_success", - "value": "Setup complete" + "name": "open_clock", + "value": "打开”拿起手机亮屏“,提升解锁体验" }, { - "name": "enroll_face_guide_title", - "value": "Set up Face Recognition" + "name": "face_enroll", + "value": "人脸识别" }, { - "name": "face_guide_2d_way", - "value": "Before starting, make sure the camera is clean, your face is unobstructed, and the environment is well-lit." + "name": "enroll_success", + "value": "录入成功" }, { - "name": "face_guide_2d_announce", - "value": "You can use Face Recognition to unlock your device and open locked apps.Click \"Start typing\" to indicate your consent" + "name": "start_title", + "value": "如何录入面部数据" }, { - "name": "face_guide_2d_announce_link", - "value": "Statement About Face Recognition。" + "name": "start_2D_content1", + "value": "首先,确保摄像头清洁、面部无遮挡,录入环境光线充足、无阳光直射。然后,正对屏幕,将面部完整移入识别区。" }, { - "name": "face_guide_3d_way", - "value": "First, position your face in the frame. Then slowly move your head in a circle while looking at the screen to show all angles of your face." + "name": "start_2D_content2", + "value": "人脸识别可用于解锁屏幕及访问应用锁。点击“开始录入”即表示您同意" }, { - "name": "face_guide_3d_announce", - "value": "You can use Face Recognition to unlock your device, confirm payments, open locked apps, and more.Click \"Start typing\" to indicate your consent" + "name": "start_2D_content3", + "value": "关于人脸识别的声明。" }, { - "name": "face_guide_3d_announce_link", - "value": "Statement About 3D Face Recognition。" + "name": "start_3D_content1", + "value": "首先,请确保您的面部全部显示在识别区内。然后注视屏幕并缓缓转动头部以完成全方位采集。" }, { - "name": "face_recognitin_guide", - "value": "Get started" + "name": "start_3D_content2", + "value": "人脸识别可用于解锁屏幕,访问应用锁、保密柜及支付。点击“开始录入”即表示您同意" + }, + { + "name": "start_3D_content3", + "value": "关于3D人脸识别的声明。" }, { - "name": "face_unlock_guide_3d_tip1", - "value": "Make sure that the camera is clean, your face is not covered, and you are in a well-lit environment (avoid direct sunlight)." + "name": "button_content", + "value": "开始录入" + }, + { + "name": "enroll_info_fail", + "value": "请确保摄像头清洁,面部无遮挡,在光线充足、无阳光直射的环境里录入。" }, { "name": "enroll_info", - "value": "Please hold still" + "value": "请保持不动" }, { "name": "enroll_info_cancel", - "value": "cancelled" + "value": "被取消" }, { "name": "enroll_info_algorithm_not_init", - "value": "The algorithm is not initialized" + "value": "算法未初始化" }, { "name": "enroll_info_hal_invalid", - "value": "Demon is unavailable" + "value": "人脸识别demon不可用" }, { "name": "enroll_info_over_max_faces", - "value": "The input exceeds the upper limit" + "value": "录入超过最大上限" }, { "name": "enroll_info_invalid_parameters", - "value": "The parameter is invalid" + "value": "入参无效" }, { "name": "enroll_info_busy", - "value": "Face flow in progress, request BUSY" + "value": "人脸流程正在进行中,请求busy" }, { "name": "enroll_info_has_registered", - "value": "The current face has been entered" + "value": "当前人脸已经录入过" }, { "name": "enroll_info_bad_quality", - "value": "Poor image quality" + "value": "图像质量太差" }, { "name": "enroll_info_not_found", - "value": "No faces detected" + "value": "没检测到人脸" }, { - "name": "face_record_3d_tip_close", - "value": "The face is too small" + "name": "enroll_info_scale_too_small", + "value": "人脸太小" }, { - "name": "face_record_3d_tip_far", - "value": "The face is too big" + "name": "enroll_info_scale_too_large", + "value": "人脸太大" }, { - "name": "face_enroll_too_left", - "value": "Face too far to the left" + "name": "enroll_info_offset_left", + "value": "人脸太靠左" }, { - "name": "face_enroll_too_high", - "value": "Face too close up" + "name": "enroll_info_offset_top", + "value": "人脸太靠上" }, { - "name": "face_enroll_too_right", - "value": "Face too far to the right" + "name": "enroll_info_offset_right", + "value": "人脸太靠右" }, { - "name": "face_enroll_too_low", - "value": "Face too far down " + "name": "enroll_info_offset_bottom", + "value": "人脸太靠下" }, { "name": "enroll_info_liveness_warning", - "value": "In vivo testing is risky " + "value": "活体检测有风险" }, { "name": "enroll_info_liveness_failure", - "value": "In vivo test failed" + "value": "活体检测失败" }, { - "name": "face_rotate_too_left", - "value": "Too much head to the left " + "name": "enroll_info_rotated_left", + "value": "头向左转的角度太大" }, { - "name": "face_rotate_too_high", - "value": "Head raised at too high an Angle" + "name": "enroll_info_rise", + "value": "头抬的角度太高" }, { - "name": "enroll_info_face_has_registered", - "value": "Turn the head" + "name": "enroll_info_rotated_right", + "value": "头向右转的角度太大" }, { - "name": "face_rotate_too_right", - "value": "Head turned too far to the right" - }, - { - "name": "face_rotate_too_low", - "value": "Head raised too low" + "name": "enroll_info_down", + "value": "头抬的角度太低" }, { "name": "enroll_info_eye_occlusion", - "value": "Poor eyesight" + "value": "眼睛不清晰" }, { "name": "enroll_info_eye_close", - "value": "close one's eyes" + "value": "闭眼" }, { "name": "enroll_info_mouth_occlusion", - "value": "Your mouth is not clear" + "value": "嘴巴不清晰" }, { - "name": "face_record_3d_tip_multi", - "value": "Multiple faces appear" + "name": "enroll_info_mutlify", + "value": "出现多张脸" }, { "name": "enroll_info_blur", - "value": "Face is not clear" + "value": "脸不清晰" }, { "name": "enroll_info_not_complete", - "value": "Face is not complete" + "value": "脸不完整" }, { "name": "enroll_info_darklight", - "value": "The light is too dim" + "value": "光线太暗" }, { "name": "enroll_info_highlight", - "value": "The light is too strong" + "value": "光线太强" }, { "name": "enroll_info_half_shadow", - "value": "Yin and Yang face" + "value": "阴阳脸" }, { "name": "enroll_info_darkpic", - "value": "Picture too dark" + "value": "图片太暗" }, { "name": "enroll_info_rotate_top_right", - "value": "Head to the right" + "value": "人脸头顶朝右" }, { "name": "enroll_info_rotate_top_left", - "value": "Head to the left" + "value": "人脸头顶朝左" }, { "name": "enroll_info_rotate_bottom_right", - "value": "Face with chin to the right" + "value": "人脸下巴朝右" }, { "name": "enroll_info_rotate_bottom_left", - "value": "Face with chin to the left" + "value": "人脸下巴朝左" }, { "name": "enroll_info_open_camera_failed", - "value": "Failed to open Camera " + "value": "打开Camera失败" + }, + { + "name": "enroll_info_face_has_registered", + "value": "转动头部" }, { "name": "enroll_button_content", - "value": "re-enter" + "value": "重新录入" + }, + { + "name": "description_product", + "value": "ETS_Empty Ability" + }, + { + "name": "entry_product", + "value": "entry_product" }, { - "name": "face_recognize_annouce", - "value": "Disclaimer" + "name": "deleteTitle", + "value": "delete" + } + ,{ + "name": "face_introdution_title", + "value": "解锁时需连接可信设备" + }, + { + "name": "face_introdution_tip", + "value": "进行人脸识别解锁手机时,需连接可信设备以进一步提升安全性。" + }, + { + "name": "trusted_devices_title", + "value": "可信设备" + }, + { + "name": "face_introdution_button", + "value": "添加可信设备" + }, + { + "name": "connect_tip", + "value": "已连接" + }, + { + "name": "disconnect_tip", + "value": "未连接" + }, + { + "name": "cancel_button", + "value": "取消" + }, + { + "name": "remove_device_button", + "value": "移除" + }, + { + "name": "add_device_button", + "value": "添加" + }, + { + "name": "remove_device_tip", + "value": "移除后,人脸识别解锁本机时将不再需要连接可信设备。是否移除?" + }, + { + "name": "remove_device_title", + "value": "移除可信设备" + }, + { + "name": "add_device_or_not_tip", + "value": "是否添加" + }, + { + "name": "using_tips", + "value": "使用提示" + }, + { + "name": "add_device_tip", + "value": "添加后,当可信设备与本机断开连接时,将无法使用人脸识别解锁。您可以使用其他方式解锁。" + } + + + , + { + "name": "face_guide_2d_announce_link", + "value": "关于人脸识别的声明" + }, + { + "name": "face_feature_desc", + "value": "功能介绍" }, { "name": "face_recognize_annouce_message_01", - "value": " Face Recognition is a biometric identification technology that allows your phone to recognize the features of your face. It uses the front camera to capture facial data, and then compares it to pre-stored data to quickly verify your identity. You can use this feature to unlock your device, open locked apps, and more." + "value": "人脸识别是一种基于人的脸部特征信息进行身份识别的生物识别技术。它通过手机前置摄像头捕捉人脸面部数据,进而快速完成面部特征比对和身份认证。可用于解锁屏幕、访问应用锁等场景。" }, { "name": "face_recognize_annouce_message_02", - "value": "Please note the following when setting up this feature:" + "value": "录入面部数据时,需注意以下事项:" }, { "name": "face_recognize_annouce_message_03", - "value": "Make sure that the camera lens is clean." + "value": "1.确保摄像头清洁;" }, { "name": "face_recognize_annouce_message_04", - "value": "Scan your face in a well-lit environment, avoiding direct sunlight." + "value": "2.在光线充足的环境下录入,但需避免强光直射;" }, { "name": "face_recognize_annouce_message_05", - "value": "Avoid covering your face with items of clothing, hair, sunglasses, masks, or thick makeup." + "value": "3.勿用衣帽、头发、墨镜、口罩、浓妆等遮挡面部;" }, { "name": "face_recognize_annouce_message_06", - "value": "Make sure your face is completely displayed in the frame. Look straight at the camera, and avoid raising and lowering your head or closing your eyes." + "value": "4.确保面部正面完整清晰地出现在提示框内,不要闭眼、大幅度仰头或低头" }, { "name": "face_recognize_annouce_message_07", - "value": "Make sure that no one else appears in the frame.。" + "value": "5.避免其他人出现在录入画面中。" }, { "name": "face_recognize_annouce_message_08", - "value": "Please note the following when using Face Recognition:" + "value": "任何技术都存在一定局限和风险,使用人脸识别时,需注意以下事项:" }, { "name": "face_recognize_annouce_message_09", - "value": "Face Recognition may not work as well in dim, very bright, or backlit environments, or if the angle between your face and the camera is too great." + "value": "1.在暗光、强光、逆光或角度过大等场景下,人脸识别的成功率会有所降低;" + }, + { + "name": "face_annouce_tip1_item2_3d", + "value": "2.人脸识别的安全性低于图案密码、数字密码、混合密码。;" }, { "name": "face_recognize_annouce_message_10", - "value": "There is a small chance that your device may be unlocked by people that closely resemble you or by objects that represent close depictions of your likeness." + "value": "您的设备可能会被容貌、外形与您相近的人或物品解锁;" }, { "name": "face_recognize_annouce_message_11", - "value": "To prevent Face Recognition from being used without your consent, please exercise caution before allowing other people to use your device." + "value": "请勿将设备随意交给他人使用,避免人脸识别功能被恶意利用;" }, { "name": "face_recognize_annouce_message_12", - "value": "The functionality of Face Recognition may also be affected in scenarios other than those described above." + "value": "除以上事项外,您还需注意其他可能影响人脸识别功能正常使用的情况。" }, { "name": "face_recognize_annouce_message_13", - "value": "Privacy Statement" + "value": "隐私声明" + }, + { + "name": "face_recognize_annouce_message_14_1", + "value": "您的" + }, + { + "name": "face_recognize_annouce_message_14_2", + "value": "将受到严格保护。该数据仅加密保存于本设备的安全隔离区域,华为不会进行备份,其他应用也无法访问或备份。例如,您使用人脸识别进行应用内认证时,应用仅能收到认证是否成功的通知,而无法访问、备份或录入" }, { - "name": "face_recognize_annouce_message_14", - "value": " Your facial data is rigorously protected. This data is encrypted and stored in an isolated zone on your device, where it will not be copied by Huawei, and cannot be copied or accessed by any app. When you use Face Recognition in an app, the app is only informed whether or not verification is successful, and cannot access your actual facial data." + "name": "face_recognize_annouce_message_14_3", + "value": "面部数据。" }, { - "name": "face_recognize_annouce_message_15", - "value": "As the owner of your facial data, you are entitled to decide how you use the Face Recognition feature. For example, if you don\\'t want to use Face Recognition to access App Lock, you can disable this feature in Settings. You can also choose to permanently delete your facial data from your device." + "name": "face_recognize_annouce_message_15_1", + "value": "您拥有人脸识别的自主控制权,可灵活控制人脸识别的使用及适用范围。例如,您不想使用人脸识别访问应用锁,在“设置”中将其关闭即可,此时人脸识别仍可用于其他操作,但不可用于进入应用锁。您还可彻底删除" + }, + { + "name": "face_recognize_annouce_message_15_2", + "value": "删除后本设备将不再保存这些数据。" + }, + { + "name": "face_recognize_annouce_message_15_3", + "value": "" + }, + { + "name": "face_recognize_annouce_message_15_4", + "value": "" + }, + { + "name": "face_guide_3d_announce_link", + "value": "关于3D人脸识别的声明" + }, + { + "name": "face_3drecognize_annouce_message_01", + "value": "3D人脸识别是新一代人脸识别技术。它通过深度感应技术,捕捉更丰富的面部数据,实现三维立体防伪识别。在暗光、逆光、无光等环境下,也可用于解锁屏幕,访问应用锁、保密柜及支付,其安全性、准确率和环境适应性较传统人脸识别技术大幅提升。" + } + + + + , + { + "name": "face_recognition", + "value": "人脸识别" + }, + { + "name": "face_recognition_is_used", + "value": "人脸识别用于" + }, + { + "name": "unlock_screen", + "value": "解锁屏幕" + }, + { + "name": "slide_to_unlock", + "value": "滑动解锁" + }, + { + "name": "smart_display_lock_screen_notification", + "value": "智能显示锁屏通知" + }, + { + "name": "access_safe", + "value": "访问保密柜" + }, + { + "name": "access_app_lock", + "value": "访问应用锁" + }, + { + "name": "automatically_fill_in_account", + "value": "自动填充账号和密码" + }, + { + "name": "use_password_safe_to_save_account", + "value": "使用密码保险箱保存账号和密码" + }, + { + "name": "delete_face_data", + "value": "删除面部数据" + }, + { + "name": "set_backup_face", + "value": "设置备用面容" + }, + { + "name": "recognize_another_face", + "value": "除继续学习您的长相外,还可识别另一种面容" + }, + { + "name": "main_and_backup_faces", + "value": "已设置主用及备用面容" + }, + { + "name": "trusted_device_be_connected_when_unlocking", + "value": "解锁时需连接可信设备" + }, + { + "name": "closed", + "value": "已关闭" + }, + { + "name": "look_at_screen_during_face_recognition", + "value": "人脸识别时需注视屏幕" + }, + { + "name": "fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "auxiliary_mode", + "value": "辅助模式" + }, + { + "name": "recognize_without_opening_eyes", + "value": "开启屏幕朗读后无需睁眼即可识别" + }, + { + "name": "be_based_on_facial_feature_information", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + { + "name": "statement_on_face_recognition", + "value": "关于人脸识别的声明。" + }, + { + "name": "statement3D_on_face_recognition", + "value": "关于3D人脸识别的声明。" + }, + { + "name": "looking_for_other_settings", + "value": "是否在寻找其设置项?" + }, + { + "name": "pick_up_phone_turn_on_screen", + "value": "拿起手机亮屏" + }, + { + "name": "annotation_screen_keeps_on", + "value": "注视屏幕不息屏" + }, + { + "name": "unlock_directly", + "value": "直接解锁" + }, + { + "name": "unlock_directly_after_successful_face_recognition", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "Slide_to_unlock_after_successful_face_recognition", + "value": "人脸识别成功后滑动屏幕解锁" + }, + { + "name": "close", + "value": "关闭" + }, + { + "name": "cancel", + "value": "取消" + }, + { + "name": "enable", + "value": "启用" + }, + { + "name": "activate_safe", + "value": "启动保密柜" + }, + { + "name": "whether_to_enable_safe", + "value": "需开启应用文件管理保密柜完成人脸关联。是否启用?" + }, + + { + "name": "activate_app_lock", + "value": "启动应用锁" + }, + { + "name": "Whether_to_activate_app_lock", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启动应用锁?" + }, + { + "name": "delete_all_face_data", + "value": "删除主用及备用面容" + }, + { + "name": "delete", + "value": "删除" + }, + { + "name": "wether_delete_face_data", + "value": "删除后,基于面部数据的功能将不可用。是否删除?" + }, + { + "name": "pick_up_phone", + "value": "同时关闭拿起手机亮屏" + }, + { + "name": "face_checker", + "value": "人脸识别" + }, + + { + "name": "face_unlock_method", + "value": "解锁屏幕" + }, + { + "name": "face_recognize_slideunlock_title", + "value": "滑动解锁" + }, + { + "name": "title_apps_security_pref", + "value": "访问应用锁" + }, + { + "name": "title_fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "recommend_preference_title", + "value": "是否在寻找其他设置项?" + }, + { + "name": "face_config_light_01_universal", + "value": "拿起手机亮屏" + }, + { + "name": "multiface_list_title", + "value": "面部列表" + }, + { + "name": "multiface_default_face_name_1", + "value": "面部 1" + }, + { + "name": "multiface_default_face_name", + "value": "面部" + }, + { + "name": "multiface_enroll_new_face", + "value": "新建面部数据" + }, + { + "name": "multiface_face_name_title", + "value": "面部名称" + }, + { + "name": "delete_face", + "value": "删除面容" + }, + { + "name": "multiface_save", + "value": "保存" + }, + { + "name": "face_unlock_method_close", + "value": "关闭" + }, + { + "name": "face_recognize_unlock_title", + "value": "直接解锁" + }, + { + "name": "face_3dguide_info_2", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + + { + "name": "face_inform_open_applock_msg", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启用应用锁?" + }, + { + "name": "face_record_cancel", + "value": "取消" + }, + + { + "name": "face_recognize_unlock_summary_3d", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "face_recognize_slideunlock_summary_3d", + "value": "人脸识别成功后滑动屏幕解锁" + }, + + + { + "name": "secure_notification_new", + "value": "智能显示锁屏通知" + }, + + { + "name": "face_fingerprint_settings_switch_title", + "value": "自动填充账号和密码" + }, + { + "name": "face_fingerprint_settings_switch_summary", + "value": "使用密码保险箱保存的帐号和密码" + }, + { + "name": "delete_record_title", + "value": "删除面部数据" + }, + { + "name": "enroll_backup_face_title", + "value": "设置备用面容" + }, + { + "name": "enroll_backup_face_summary", + "value": "除继续学习您的长相外,还可识别另一种面容" + }, + { + "name": "title_face_stare_aux", + "value": "人脸识别时需注视屏幕" + }, + { + "name": "face_inform_open_strongbox_msg", + "value": "需要启用文件管理保密柜完成人脸关联。是否启用?" + }, + { + "name": "face_record_delete", + "value": "删除" + }, + { + "name": "face_recognize_lighton_close_universal", + "value": "同时关闭拿起手机亮屏" + }, + { + "name": "title_strong_box_pref", + "value": "访问保密柜" + }, + { + "name": "face_enterance_off", + "value": "已关闭" + }, + { + "name": "open_bluetooth", + "value": "使用此功能需先开启蓝牙,点击设置" + }, + { + "name": "no_available_devices_title", + "value": "没有可添加的设备" + }, + { + "name": "no_available_devices_tip", + "value": "没有检测到可添加的配对设备。是否前往蓝牙设置配对?" + }, + { + "name": "pair_button", + "value": "去配对" + }, + { + "name": "face_record", + "value": "正在录入" + }, + { + "name": "face_record_3d_record_fail", + "value": "录入失败" + }, + { + "name": "enroll_face_guide_title", + "value": "如何录入面部数据" + }, + { + "name": "face_guide_2d_way", + "value": "首先,确保摄像头清洁、面部无遮挡,录入环境光线充足、无阳光直射。然后,正对屏幕,将面部完整移入识别区。" + }, + { + "name": "face_guide_2d_announce", + "value": "人脸识别可用于解锁屏幕及访问应用锁。点击“开始录入”即表示您同意" + }, + { + "name": "face_2dguide_light_notify_universal", + "value": "打开”拿起手机亮屏“,提升解锁体验" + }, + { + "name": "face_guide_3d_way", + "value": "首先,请确保您的面部全部显示在识别区内。然后注视屏幕并缓缓转动头部以完成全方位采集。" + }, + { + "name": "face_guide_3d_announce", + "value": "人脸识别可用于解锁屏幕,访问应用锁、保密柜及支付。点击“开始录入”即表示您同意" + }, + { + "name": "face_recognitin_guide", + "value": "开始录入" + }, + { + "name": "face_record_success", + "value": "录入成功" + }, + { + "name": "face_record_3d_tip_close", + "value": "人脸太小" + }, + { + "name": "face_record_3d_tip_far", + "value": "人脸太大" + }, + { + "name": "face_enroll_too_left", + "value": "人脸太靠左" + }, + { + "name": "face_enroll_too_high", + "value": "人脸太靠上" + }, + { + "name": "face_enroll_too_right", + "value": "人脸太靠右" + }, + { + "name": "face_enroll_too_low", + "value": "人脸太靠下" + }, + { + "name": "face_record_3d_tip_multi", + "value": "出现多张脸" + }, + { + "name": "face_rotate_too_left", + "value": "头向左转的角度太大" + }, + { + "name": "face_rotate_too_high", + "value": "头抬的角度太高" + }, + { + "name": "face_rotate_too_right", + "value": "头向右转的角度太大" + }, + { + "name": "face_rotate_too_low", + "value": "头抬的角度太低" } ] } \ No newline at end of file diff --git a/ui/faceenroll/product/phone/src/main/resources/base/media/ic_settings_arrow.svg b/ui/faceenroll/product/phone/src/main/resources/base/media/ic_settings_arrow.svg new file mode 100644 index 0000000000000000000000000000000000000000..6aebbe7b504aa070dafcb5df58347bc151f0237e --- /dev/null +++ b/ui/faceenroll/product/phone/src/main/resources/base/media/ic_settings_arrow.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/ui/faceenroll/product/phone/src/main/resources/base/media/into_arrow.svg b/ui/faceenroll/product/phone/src/main/resources/base/media/into_arrow.svg new file mode 100644 index 0000000000000000000000000000000000000000..d20cc39c31fe2f8bd414a84c678decd8383ac086 --- /dev/null +++ b/ui/faceenroll/product/phone/src/main/resources/base/media/into_arrow.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui/faceenroll/product/phone/src/main/resources/base/media/phone.svg b/ui/faceenroll/product/phone/src/main/resources/base/media/phone.svg new file mode 100644 index 0000000000000000000000000000000000000000..b81e4e3637a98a33576cb875acb1fa9721b02e67 --- /dev/null +++ b/ui/faceenroll/product/phone/src/main/resources/base/media/phone.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui/faceenroll/product/phone/src/main/resources/en_AS/element/string.json b/ui/faceenroll/product/phone/src/main/resources/en_AS/element/string.json index 21595d49f2e1332669e34059cce1906798a5d4ce..2420178c9dab58f55e8456d3d58c6d550f94a9bf 100644 --- a/ui/faceenroll/product/phone/src/main/resources/en_AS/element/string.json +++ b/ui/faceenroll/product/phone/src/main/resources/en_AS/element/string.json @@ -9,284 +9,480 @@ "value": "JS_Phone_Empty Feature Ability" }, { - "name": "face_record", - "value": "Set up Face Recognition" + "name": "deleteTitle", + "value": "delete" }, { - "name": "face_record_3d_record_fail", - "value": "Setup failed" + "name": "face_guide_2d_announce_link", + "value": "Statement About Face Recognition" }, { - "name": "enrolling_timeout", - "value": "Enter the timeout" + "name": "face_feature_desc", + "value": "Feature description" }, { - "name": "face_2dguide_light_notify_universal", - "value": "Enable raise to wake" + "name": "face_recognize_annouce_message_01", + "value": "Face Recognition is a biometric identification technology that allows your phone to recognize the features of your face. It uses the front camera to capture facial data, and then compares it to pre-stored data to quickly verify your identity. You can use this feature to unlock your device, open locked apps, and more." }, { - "name": "face_checker", - "value": "Face Recognition" + "name": "face_recognize_annouce_message_02", + "value": "Please note the following when setting up this feature:" }, { - "name": "face_record_success", - "value": "Setup complete" + "name": "face_recognize_annouce_message_03", + "value": "1.Make sure that the camera lens is clean." }, { - "name": "enroll_face_guide_title", - "value": "Set up Face Recognition" + "name": "face_recognize_annouce_message_04", + "value": "2.Scan your face in a well-lit environment, avoiding direct sunlight.;" }, { - "name": "face_guide_2d_way", - "value": "Before starting, make sure the camera is clean, your face is unobstructed, and the environment is well-lit." + "name": "face_recognize_annouce_message_05", + "value": "3.Avoid covering your face with items of clothing, hair, sunglasses, masks, or thick makeup." }, { - "name": "face_guide_2d_announce", - "value": "You can use Face Recognition to unlock your device and open locked apps.Click \"Start typing\" to indicate your consent" + "name": "face_recognize_annouce_message_06", + "value": "4.Make sure your face is completely displayed in the frame. Look straight at the camera, and avoid raising and lowering your head or closing your eyes." }, { - "name": "face_guide_2d_announce_link", - "value": "Statement About Face Recognition。" + "name": "face_recognize_annouce_message_07", + "value": "5.Make sure that no one else appears in the frame." }, { - "name": "face_guide_3d_way", - "value": "First, position your face in the frame. Then slowly move your head in a circle while looking at the screen to show all angles of your face." + "name": "face_recognize_annouce_message_08", + "value": "Please note the following when using Face Recognition:" }, { - "name": "face_guide_3d_announce", - "value": "You can use Face Recognition to unlock your device, confirm payments, open locked apps, and more.Click \"Start typing\" to indicate your consent" + "name": "face_recognize_annouce_message_09", + "value": "1.Face Recognition may not work as well in dim, very bright, or backlit environments, or if the angle between your face and the camera is too great." + }, + { + "name": "face_annouce_tip1_item2_3d", + "value": "2.Face Recognition is less secure than other unlock methods such as Pattern, PIN, and Password." + }, + { + "name": "face_recognize_annouce_message_10", + "value": "There is a small chance that your device may be unlocked by people that closely resemble you or by objects that represent close depictions of your likeness." + }, + { + "name": "face_recognize_annouce_message_11", + "value": "To prevent Face Recognition from being used without your consent, please exercise caution before allowing other people to use your device." + }, + { + "name": "face_recognize_annouce_message_12", + "value": "The functionality of Face Recognition may also be affected in scenarios other than those described above." + }, + { + "name": "face_recognize_annouce_message_13", + "value": "Privacy Statement" + }, + { + "name": "face_recognize_annouce_message_14_1", + "value": "Your" + }, + { + "name": "face_recognize_annouce_message_14_2", + "value": "is rigorously protected. This data is encrypted and stored in an isolated zone on your device, where it will not be copied by Huawei, and cannot be copied or accessed by any app. When you use Face Recognition in an app, the app is only informed whether or not verification is successful, and cannot access your actual" + }, + { + "name": "face_recognize_annouce_message_14_3", + "value": "facial data" + }, + { + "name": "face_recognize_annouce_message_15_1", + "value": "As the owner of your" + }, + { + "name": "face_recognize_annouce_message_15_2", + "value": ", you are entitled to decide how you use the Face Recognition feature. For example, if you don't want to use Face Recognition to access App Lock, you can disable this feature in Settings. You can also choose to permanently delete your。" + }, + { + "name": "face_recognize_annouce_message_15_3", + "value": "facial data" + }, + { + "name": "face_recognize_annouce_message_15_4", + "value": "from your device." }, { "name": "face_guide_3d_announce_link", - "value": "Statement About 3D Face Recognition。" + "value": "Statement About 3D Face Recognition" }, { - "name": "face_recognitin_guide", - "value": "Get started" + "name": "face_3drecognize_annouce_message_01", + "value": "3D Face Recognition uses depth-sensing technology to create a sophisticated, three-dimensional model of your face, which can be used to verify your identity. This lets you securely unlock your device, confirm payments, and access features such as App Lock and Safe by simply looking at the screen. 3D Face Recognition is more secure and robust than 2D face recognition technologies, and can even be used in the dark." + } + , + { + "name": "face_introdution_title", + "value": "Require trusted device" }, { - "name": "face_unlock_guide_3d_tip1", - "value": "Make sure that the camera is clean, your face is not covered, and you are in a well-lit environment (avoid direct sunlight)." + "name": "face_introdution_tip", + "value": "Add an extra layer of security by only allowing this device to be unlocked with facial recognition when a trusted device is connected." }, { - "name": "enroll_info", - "value": "Please hold still" + "name": "trusted_devices_title", + "value": "Trusted devices" }, { - "name": "enroll_info_cancel", - "value": "cancelled" + "name": "face_introdution_button", + "value": "Add trusted device" }, { - "name": "enroll_info_algorithm_not_init", - "value": "The algorithm is not initialized" + "name": "connect_tip", + "value": "Connected" }, { - "name": "enroll_info_hal_invalid", - "value": "Demon is unavailable" + "name": "disconnect_tip", + "value": "Not connected" }, { - "name": "enroll_info_over_max_faces", - "value": "The input exceeds the upper limit" + "name": "cancel_button", + "value": "Cancel" }, { - "name": "enroll_info_invalid_parameters", - "value": "The parameter is invalid" + "name": "remove_device_button", + "value": "Remove" }, { - "name": "enroll_info_busy", - "value": "Face flow in progress, request BUSY" + "name": "add_device_button", + "value": "Add" }, { - "name": "enroll_info_has_registered", - "value": "The current face has been entered" + "name": "remove_device_tip", + "value": "Once removed, a trusted device will no longer be required to unlock this device with facial recognition." }, { - "name": "enroll_info_bad_quality", - "value": "Poor image quality" + "name": "remove_device_title", + "value": "Remove trusted device" }, { - "name": "enroll_info_not_found", - "value": "No faces detected" + "name": "add_device_or_not_tip", + "value": "Add trusted device?" }, { - "name": "face_record_3d_tip_close", - "value": "The face is too small" + "name": "using_tips", + "value": "Note" }, { - "name": "face_record_3d_tip_far", - "value": "The face is too big" + "name": "add_device_tip", + "value": "You will only be able to unlock this device with facial recognition when a trusted device is connected over Bluetooth. Other unlock methods will not be affected." }, { - "name": "face_enroll_too_left", - "value": "Face too far to the left" + "name": "open_bluetooth", + "value": "Bluetooth must be enabled. Touch to enable" }, { - "name": "face_enroll_too_high", - "value": "Face too close up" + "name": "no_available_devices_title", + "value": "No available devices" }, { - "name": "face_enroll_too_right", - "value": "Face too far to the right" + "name": "no_available_devices_tip", + "value": "No paired devices found. Pair one now?" }, { - "name": "face_enroll_too_low", - "value": "Face too far down " + "name": "pair_button", + "value": "Go pair" + } + + , + { + "name": "face_recognition", + "value": "Face Recognition" }, { - "name": "enroll_info_liveness_warning", - "value": "In vivo testing is risky " + "name": "face_recognition_is_used", + "value": "face recognition for" }, { - "name": "enroll_info_liveness_failure", - "value": "In vivo test failed" + "name": "main_and_backup_faces", + "value": "primary and secondary faces are set" }, { - "name": "face_rotate_too_left", - "value": "Too much head to the left " + "name": "trusted_device_be_connected_when_unlocking", + "value": "A trusted device needs to be connected to unlock" }, { - "name": "face_rotate_too_high", - "value": "Head raised at too high an Angle" + "name": "closed", + "value": "off" }, { - "name": "enroll_info_face_has_registered", - "value": "Turn the head" + "name": "auxiliary_mode", + "value": "Assist mode" }, { - "name": "face_rotate_too_right", - "value": "Head turned too far to the right" + "name": "recognize_without_opening_eyes", + "value": "When screen reading is turned on, it can be recognized without opening your eyes" }, { - "name": "face_rotate_too_low", - "value": "Head raised too low" + "name": "looking_for_other_settings", + "value": "Are you looking for its settings?" }, { - "name": "enroll_info_eye_occlusion", - "value": "Poor eyesight" + "name": "annotation_screen_keeps_on", + "value": "staring at the screen" }, { - "name": "enroll_info_eye_close", - "value": "close one's eyes" + "name": "close", + "value": "off" }, { - "name": "enroll_info_mouth_occlusion", - "value": "Your mouth is not clear" + "name": "cancel", + "value": "cancel" }, { - "name": "face_record_3d_tip_multi", - "value": "Multiple faces appear" + "name": "enable", + "value": "enable" }, { - "name": "enroll_info_blur", - "value": "Face is not clear" + "name": "activate_safe", + "value": "Activate safe" }, { - "name": "enroll_info_not_complete", - "value": "Face is not complete" + "name": "whether_to_enable_safe", + "value": "You need to open the application file management safe to complete the face association. Whether to enable?" }, + { - "name": "enroll_info_darklight", - "value": "The light is too dim" + "name": "activate_app_lock", + "value": "Activate app lock" }, { - "name": "enroll_info_highlight", - "value": "The light is too strong" + "name": "Whether_to_activate_app_lock", + "value": "The app lock function needs to be turned on to complete the face association. Activate App Lock now?" }, { - "name": "enroll_info_half_shadow", - "value": "Yin and Yang face" + "name": "delete_all_face_data", + "value": "delete primary and backup faces" }, { - "name": "enroll_info_darkpic", - "value": "Picture too dark" + "name": "wether_delete_face_data", + "value": "After deletion, features based on facial data will not be available. delete or not?" }, { - "name": "enroll_info_rotate_top_right", - "value": "Head to the right" + "name": "entry_MainAbility", + "value": "entry_MainAbility" }, { - "name": "enroll_info_rotate_top_left", - "value": "Head to the left" + "name": "face_checker", + "value": "Face Recognition" }, + { - "name": "enroll_info_rotate_bottom_right", - "value": "Face with chin to the right" + "name": "face_unlock_method", + "value": "Unlock device" }, { - "name": "enroll_info_rotate_bottom_left", - "value": "Face with chin to the left" + "name": "face_recognize_slideunlock_title", + "value": "Slide to unlock" }, { - "name": "enroll_info_open_camera_failed", - "value": "Failed to open Camera " + "name": "title_apps_security_pref", + "value": "Access App Lock" }, { - "name": "enroll_button_content", - "value": "re-enter" + "name": "title_fill_light", + "value": "Low light compensation" }, { - "name": "face_recognize_annouce", - "value": "Disclaimer" + "name": "recommend_preference_title", + "value": "Looking for other settings?" }, { - "name": "face_recognize_annouce_message_01", - "value": " Face Recognition is a biometric identification technology that allows your phone to recognize the features of your face. It uses the front camera to capture facial data, and then compares it to pre-stored data to quickly verify your identity. You can use this feature to unlock your device, open locked apps, and more." + "name": "face_config_light_01_universal", + "value": "Raise to wake" }, { - "name": "face_recognize_annouce_message_02", - "value": "Please note the following when setting up this feature:" + "name": "multiface_list_title", + "value": "Facial profiles" }, { - "name": "face_recognize_annouce_message_03", - "value": "Make sure that the camera lens is clean." + "name": "multiface_default_face_name_1", + "value": "Profile 1" }, { - "name": "face_recognize_annouce_message_04", - "value": "Scan your face in a well-lit environment, avoiding direct sunlight." + "name": "multiface_default_face_name", + "value": "Profile " }, { - "name": "face_recognize_annouce_message_05", - "value": "Avoid covering your face with items of clothing, hair, sunglasses, masks, or thick makeup." + "name": "multiface_enroll_new_face", + "value": "Add facial profile" }, { - "name": "face_recognize_annouce_message_06", - "value": "Make sure your face is completely displayed in the frame. Look straight at the camera, and avoid raising and lowering your head or closing your eyes." + "name": "multiface_face_name_title", + "value": "Name" }, { - "name": "face_recognize_annouce_message_07", - "value": "Make sure that no one else appears in the frame.。" + "name": "multiface_save", + "value": "Save" }, { - "name": "face_recognize_annouce_message_08", - "value": "Please note the following when using Face Recognition:" + "name": "face_unlock_method_close", + "value": "Off" }, { - "name": "face_recognize_annouce_message_09", - "value": "Face Recognition may not work as well in dim, very bright, or backlit environments, or if the angle between your face and the camera is too great." + "name": "face_recognize_unlock_title", + "value": "Direct unlock" }, { - "name": "face_recognize_annouce_message_10", - "value": "There is a small chance that your device may be unlocked by people that closely resemble you or by objects that represent close depictions of your likeness." + "name": "face_3dguide_info_2", + "value": "Face Recognition verifies your identity based on your facial features. To learn more, see the" }, { - "name": "face_recognize_annouce_message_11", - "value": "To prevent Face Recognition from being used without your consent, please exercise caution before allowing other people to use your device." + "name": "face_inform_open_applock_msg", + "value": "App Lock is not enabled. Enable now?" }, { - "name": "face_recognize_annouce_message_12", - "value": "The functionality of Face Recognition may also be affected in scenarios other than those described above." + "name": "face_record_cancel", + "value": "Cancel" }, { - "name": "face_recognize_annouce_message_13", - "value": "Privacy Statement" + "name": "face_recognize_unlock_summary_3d", + "value": "Unlock directly after successful facial recognition." + }, + { + "name": "face_recognize_slideunlock_summary_3d", + "value": "Slide to unlock after successful facial recognition." + }, + { + "name": "delete_face", + "value": "remove face" + }, + + { + "name": "secure_notification_new", + "value": "Show notifications" + }, + + { + "name": "face_fingerprint_settings_switch_title", + "value": "Autofill usernames and passwords" + }, + { + "name": "face_fingerprint_settings_switch_summary", + "value": "Usernames and passwords are accessed from Password Vault." + }, + { + "name": "delete_record_title", + "value": "Delete facial data" + }, + { + "name": "enroll_backup_face_title", + "value": "Set an alternate look" + }, + { + "name": "enroll_backup_face_summary", + "value": "Add another appearance for accurate facial recognition even if you change your look." + }, + { + "name": "title_face_stare_aux", + "value": "Require eye contact" + }, + { + "name": "face_inform_open_strongbox_msg", + "value": "The Safe feature hasn\\'t been enabled yet." + }, + { + "name": "face_record_delete", + "value": "Delete" + }, + { + "name": "face_recognize_lighton_close_universal", + "value": "Disable raise to wake" + }, + { + "name": "title_strong_box_pref", + "value": "Access Safe" + }, + { + "name": "face_enterance_off", + "value": "Off" + } + , + { + "name": "face_record", + "value": "Set up Face Recognition" + }, + { + "name": "face_record_3d_record_fail", + "value": "Setup failed" + }, + { + "name": "enroll_face_guide_title", + "value": "Set up Face Recognition" + }, + { + "name": "face_guide_2d_way", + "value": "Before starting, make sure the camera is clean, your face is unobstructed, and the environment is well-lit." + }, + { + "name": "face_guide_2d_announce", + "value": "You can use Face Recognition to unlock your device and open locked apps.Click \"Start typing\" to indicate your consent" }, { - "name": "face_recognize_annouce_message_14", - "value": " Your facial data is rigorously protected. This data is encrypted and stored in an isolated zone on your device, where it will not be copied by Huawei, and cannot be copied or accessed by any app. When you use Face Recognition in an app, the app is only informed whether or not verification is successful, and cannot access your actual facial data." + "name": "face_2dguide_light_notify_universal", + "value": "Enable raise to wake" }, { - "name": "face_recognize_annouce_message_15", - "value": "As the owner of your facial data, you are entitled to decide how you use the Face Recognition feature. For example, if you don\\'t want to use Face Recognition to access App Lock, you can disable this feature in Settings. You can also choose to permanently delete your facial data from your device." + "name": "face_guide_3d_way", + "value": "First, position your face in the frame. Then slowly move your head in a circle while looking at the screen to show all angles of your face." + }, + { + "name": "face_guide_3d_announce", + "value": "You can use Face Recognition to unlock your device, confirm payments, open locked apps, and more.Click \"Start typing\" to indicate your consent" + }, + { + "name": "face_recognitin_guide", + "value": "Get started" + }, + { + "name": "face_record_success", + "value": "Setup complete" + }, + { + "name": "face_record_3d_tip_close", + "value": "The face is too small" + }, + { + "name": "face_record_3d_tip_far", + "value": "The face is too big" + }, + { + "name": "face_enroll_too_left", + "value": "Face too far to the left" + }, + { + "name": "face_enroll_too_high", + "value": "Face too close up" + }, + { + "name": "face_enroll_too_right", + "value": "Face too far to the right" + }, + { + "name": "face_enroll_too_low", + "value": "Face too far down " + }, + { + "name": "face_record_3d_tip_multi", + "value": "Multiple faces appear" + }, + { + "name": "face_rotate_too_left", + "value": "Too much head to the left " + }, + { + "name": "face_rotate_too_high", + "value": "Head raised at too high an Angle" + }, + { + "name": "face_rotate_too_right", + "value": "Head turned too far to the right" + }, + { + "name": "face_rotate_too_low", + "value": "Head raised too low" } ] } \ No newline at end of file diff --git a/ui/faceenroll/product/phone/src/main/resources/zh_CN/element/string.json b/ui/faceenroll/product/phone/src/main/resources/zh_CN/element/string.json index 1d82b823100e8f0a6f0a530d588fcdd4b9077303..c4b079a1b02ab6beb486e105f56bc5ff932a53a9 100644 --- a/ui/faceenroll/product/phone/src/main/resources/zh_CN/element/string.json +++ b/ui/faceenroll/product/phone/src/main/resources/zh_CN/element/string.json @@ -9,11 +9,19 @@ "value": "JS_Phone_Empty Feature Ability" }, { - "name": "face_record", + "name": "description_product", + "value": "ETS_Empty Ability" + }, + { + "name": "entry_product", + "value": "entry_product" + }, + { + "name": "enrolling", "value": "正在录入" }, { - "name": "face_record_3d_record_fail", + "name": "enrolling_fail", "value": "录入失败" }, { @@ -21,51 +29,59 @@ "value": "录入超时" }, { - "name": "face_2dguide_light_notify_universal", + "name": "declare", + "value": "声明" + }, + { + "name": "declare_content", + "value": "如果您选择添加人脸数据,在亮屏状态,您将可以通过正面注视手机屏幕瞬间解锁。人脸数据储存在您的设备,而且不会通过云服务或者其他工具备份他处。" + }, + { + "name": "open_clock", "value": "打开”拿起手机亮屏“,提升解锁体验" }, { - "name": "face_checker", + "name": "face_enroll", "value": "人脸识别" }, { - "name": "face_record_success", + "name": "enroll_success", "value": "录入成功" }, { - "name": "enroll_face_guide_title", + "name": "start_title", "value": "如何录入面部数据" }, { - "name": "face_guide_2d_way", + "name": "start_2D_content1", "value": "首先,确保摄像头清洁、面部无遮挡,录入环境光线充足、无阳光直射。然后,正对屏幕,将面部完整移入识别区。" }, { - "name": "face_guide_2d_announce", + "name": "start_2D_content2", "value": "人脸识别可用于解锁屏幕及访问应用锁。点击“开始录入”即表示您同意" }, { - "name": "face_guide_2d_announce_link", + "name": "start_2D_content3", "value": "关于人脸识别的声明。" }, { - "name": "face_guide_3d_way", + "name": "start_3D_content1", "value": "首先,请确保您的面部全部显示在识别区内。然后注视屏幕并缓缓转动头部以完成全方位采集。" }, { - "name": "face_guide_3d_announce", + "name": "start_3D_content2", "value": "人脸识别可用于解锁屏幕,访问应用锁、保密柜及支付。点击“开始录入”即表示您同意" }, { - "name": "face_guide_3d_announce_link", + "name": "start_3D_content3", "value": "关于3D人脸识别的声明。" }, { - "name": "face_recognitin_guide", + "name": "button_content", "value": "开始录入" }, { - "name": "face_unlock_guide_3d_tip1", + "name": "enroll_info_fail", "value": "请确保摄像头清洁,面部无遮挡,在光线充足、无阳光直射的环境里录入。" }, { @@ -109,27 +125,27 @@ "value": "没检测到人脸" }, { - "name": "face_record_3d_tip_close", + "name": "enroll_info_scale_too_small", "value": "人脸太小" }, { - "name": "face_record_3d_tip_far", + "name": "enroll_info_scale_too_large", "value": "人脸太大" }, { - "name": "face_enroll_too_left", + "name": "enroll_info_offset_left", "value": "人脸太靠左" }, { - "name": "face_enroll_too_high", + "name": "enroll_info_offset_top", "value": "人脸太靠上" }, { - "name": "face_enroll_too_right", + "name": "enroll_info_offset_right", "value": "人脸太靠右" }, { - "name": "face_enroll_too_low", + "name": "enroll_info_offset_bottom", "value": "人脸太靠下" }, { @@ -141,11 +157,11 @@ "value": "活体检测失败" }, { - "name": "face_rotate_too_left", + "name": "enroll_info_rotated_left", "value": "头向左转的角度太大" }, { - "name": "face_rotate_too_high", + "name": "enroll_info_rise", "value": "头抬的角度太高" }, { @@ -153,11 +169,11 @@ "value": "转动头部" }, { - "name": "face_rotate_too_right", + "name": "enroll_info_rotated_right", "value": "头向右转的角度太大" }, { - "name": "face_rotate_too_low", + "name": "enroll_info_down", "value": "头抬的角度太低" }, { @@ -173,7 +189,7 @@ "value": "嘴巴不清晰" }, { - "name": "face_record_3d_tip_multi", + "name": "enroll_info_mutlify", "value": "出现多张脸" }, { @@ -225,12 +241,95 @@ "value": "重新录入" }, { - "name": "face_recognize_annouce", - "value": "免责声明" + "name": "deleteTitle", + "value": "删除数据" + } + ,{ + "name": "face_introdution_title", + "value": "解锁时需连接可信设备" + }, + { + "name": "face_introdution_tip", + "value": "进行人脸识别解锁手机时,需连接可信设备以进一步提升安全性。" + }, + { + "name": "trusted_devices_title", + "value": "可信设备" + }, + { + "name": "face_introdution_button", + "value": "添加可信设备" + }, + { + "name": "connect_tip", + "value": "已连接" + }, + { + "name": "disconnect_tip", + "value": "未连接" + }, + { + "name": "cancel_button", + "value": "取消" + }, + { + "name": "remove_device_button", + "value": "移除" + }, + { + "name": "add_device_button", + "value": "添加" + }, + { + "name": "remove_device_tip", + "value": "移除后,人脸识别解锁本机时将不再需要连接可信设备。是否移除?" + }, + { + "name": "remove_device_title", + "value": "移除可信设备" + }, + { + "name": "add_device_or_not_tip", + "value": "是否添加" + }, + { + "name": "using_tips", + "value": "使用提示" + }, + { + "name": "add_device_tip", + "value": "添加后,当可信设备与本机断开连接时,将无法使用人脸识别解锁。您可以使用其他方式解锁。" + }, + { + "name": "open_bluetooth", + "value": "使用此功能需先开启蓝牙,点击设置" + }, + { + "name": "no_available_devices_title", + "value": "没有可添加的设备" + }, + { + "name": "no_available_devices_tip", + "value": "没有检测到可添加的配对设备。是否前往蓝牙设置配对?" + }, + { + "name": "pair_button", + "value": "去配对" + } + + + , + { + "name": "face_guide_2d_announce_link", + "value": "关于人脸识别的声明" + }, + { + "name": "face_feature_desc", + "value": "功能介绍" }, { "name": "face_recognize_annouce_message_01", - "value": " 人脸识别是一种基于人的脸部特征信息进行身份识别的生物识别技术。它通过手机前置摄像头捕捉人脸面部数据,进而快速完成面部特征比对和身份认证。可用于解锁屏幕、访问应用锁等场景。" + "value": "人脸识别是一种基于人的脸部特征信息进行身份识别的生物识别技术。它通过手机前置摄像头捕捉人脸面部数据,进而快速完成面部特征比对和身份认证。可用于解锁屏幕、访问应用锁等场景。" }, { "name": "face_recognize_annouce_message_02", @@ -238,23 +337,23 @@ }, { "name": "face_recognize_annouce_message_03", - "value": "确保摄像头清洁;" + "value": "1.确保摄像头清洁;" }, { "name": "face_recognize_annouce_message_04", - "value": "在光线充足的环境下录入,但需避免强光直射;" + "value": "2.在光线充足的环境下录入,但需避免强光直射;" }, { "name": "face_recognize_annouce_message_05", - "value": "勿用衣帽、头发、墨镜、口罩、浓妆等遮挡面部;" + "value": "3.勿用衣帽、头发、墨镜、口罩、浓妆等遮挡面部;" }, { "name": "face_recognize_annouce_message_06", - "value": "确保面部正面完整清晰地出现在提示框内,不要闭眼、大幅度仰头或低头;" + "value": "4.确保面部正面完整清晰地出现在提示框内,不要闭眼、大幅度仰头或低头" }, { "name": "face_recognize_annouce_message_07", - "value": "避免其他人出现在录入画面中。" + "value": "5.避免其他人出现在录入画面中。" }, { "name": "face_recognize_annouce_message_08", @@ -262,7 +361,11 @@ }, { "name": "face_recognize_annouce_message_09", - "value": "在暗光、强光、逆光或角度过大等场景下,人脸识别的成功率会有所降低;" + "value": "1.在暗光、强光、逆光或角度过大等场景下,人脸识别的成功率会有所降低;" + }, + { + "name": "face_annouce_tip1_item2_3d", + "value": "2.人脸识别的安全性低于图案密码、数字密码、混合密码。;" }, { "name": "face_recognize_annouce_message_10", @@ -281,12 +384,418 @@ "value": "隐私声明" }, { - "name": "face_recognize_annouce_message_14", - "value": " 您的面部数据将受到严格保护。该数据仅加密保存于本设备的安全隔离区域,华为不会进行备份,其他应用也无法访问或备份。例如,您使用人脸识别进行应用内认证时,应用仅能收到认证是否成功的通知,而无法访问、备份或录入面部数据。" + "name": "face_recognize_annouce_message_14_1", + "value": "您的" + }, + { + "name": "face_recognize_annouce_message_14_2", + "value": "将受到严格保护。该数据仅加密保存于本设备的安全隔离区域,华为不会进行备份,其他应用也无法访问或备份。例如,您使用人脸识别进行应用内认证时,应用仅能收到认证是否成功的通知,而无法访问、备份或录入" + }, + { + "name": "face_recognize_annouce_message_14_3", + "value": "面部数据。" + }, + { + "name": "face_recognize_annouce_message_15_1", + "value": "您拥有人脸识别的自主控制权,可灵活控制人脸识别的使用及适用范围。例如,您不想使用人脸识别访问应用锁,在“设置”中将其关闭即可,此时人脸识别仍可用于其他操作,但不可用于进入应用锁。您还可彻底删除" + }, + { + "name": "face_recognize_annouce_message_15_2", + "value": "删除后本设备将不再保存这些数据。" + }, + + { + "name": "face_recognize_annouce_message_15_3", + "value": "" + }, + { + "name": "face_recognize_annouce_message_15_4", + "value": "" + }, + { + "name": "face_guide_3d_announce_link", + "value": "关于3D人脸识别的声明" + }, + { + "name": "face_3drecognize_annouce_message_01", + "value": "3D人脸识别是新一代人脸识别技术。它通过深度感应技术,捕捉更丰富的面部数据,实现三维立体防伪识别。在暗光、逆光、无光等环境下,也可用于解锁屏幕,访问应用锁、保密柜及支付,其安全性、准确率和环境适应性较传统人脸识别技术大幅提升。" + } + + + + , + { + "name": "face_recognition", + "value": "人脸识别" + }, + { + "name": "face_recognition_is_used", + "value": "人脸识别用于" + }, + { + "name": "unlock_screen", + "value": "解锁屏幕" + }, + { + "name": "slide_to_unlock", + "value": "滑动解锁" + }, + { + "name": "smart_display_lock_screen_notification", + "value": "智能显示锁屏通知" + }, + { + "name": "access_safe", + "value": "访问保密柜" + }, + { + "name": "access_app_lock", + "value": "访问应用锁" + }, + { + "name": "automatically_fill_in_account", + "value": "自动填充账号和密码" + }, + { + "name": "use_password_safe_to_save_account", + "value": "使用密码保险箱保存账号和密码" + }, + { + "name": "delete_face_data", + "value": "删除面部数据" + }, + { + "name": "set_backup_face", + "value": "设置备用面容" + }, + { + "name": "recognize_another_face", + "value": "除继续学习您的长相外,还可识别另一种面容" + }, + { + "name": "main_and_backup_faces", + "value": "已设置主用及备用面容" + }, + { + "name": "trusted_device_be_connected_when_unlocking", + "value": "解锁时需连接可信设备" + }, + { + "name": "closed", + "value": "已关闭" + }, + { + "name": "look_at_screen_during_face_recognition", + "value": "人脸识别时需注视屏幕" + }, + { + "name": "fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "auxiliary_mode", + "value": "辅助模式" + }, + { + "name": "recognize_without_opening_eyes", + "value": "开启屏幕朗读后无需睁眼即可识别" + }, + { + "name": "be_based_on_facial_feature_information", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + { + "name": "statement_on_face_recognition", + "value": "关于人脸识别的声明。" + }, + { + "name": "statement3D_on_face_recognition", + "value": "关于3D人脸识别的声明。" + }, + { + "name": "looking_for_other_settings", + "value": "是否在寻找其设置项?" + }, + { + "name": "pick_up_phone_turn_on_screen", + "value": "拿起手机亮屏" + }, + { + "name": "annotation_screen_keeps_on", + "value": "注视屏幕不息屏" + }, + { + "name": "unlock_directly", + "value": "直接解锁" + }, + { + "name": "unlock_directly_after_successful_face_recognition", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "Slide_to_unlock_after_successful_face_recognition", + "value": "人脸识别成功后滑动屏幕解锁" + }, + { + "name": "close", + "value": "关闭" + }, + { + "name": "cancel", + "value": "取消" + }, + { + "name": "enable", + "value": "启用" + }, + { + "name": "activate_safe", + "value": "启动保密柜" + }, + { + "name": "whether_to_enable_safe", + "value": "需开启应用文件管理保密柜完成人脸关联。是否启用?" }, + { - "name": "face_recognize_annouce_message_15", - "value": "您拥有人脸识别的自主控制权,可灵活控制人脸识别的使用及适用范围。例如,您不想使用人脸识别访问应用锁,在“设置”中将其关闭即可,此时人脸识别仍可用于其他操作,但不可用于进入应用锁。您还可彻底删除." + "name": "activate_app_lock", + "value": "启动应用锁" + }, + { + "name": "Whether_to_activate_app_lock", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启动应用锁?" + }, + { + "name": "delete_all_face_data", + "value": "删除主用及备用面容" + }, + { + "name": "wether_delete_face_data", + "value": "删除后,基于面部数据的功能将不可用。是否删除?" + }, + { + "name": "pick_up_phone", + "value": "同时关闭拿起手机亮屏" + }, + { + "name": "face_checker", + "value": "人脸识别" + }, + + { + "name": "face_unlock_method", + "value": "解锁屏幕" + }, + { + "name": "face_recognize_slideunlock_title", + "value": "滑动解锁" + }, + { + "name": "title_apps_security_pref", + "value": "访问应用锁" + }, + { + "name": "title_fill_light", + "value": "暗光环境下屏幕补光" + }, + { + "name": "recommend_preference_title", + "value": "是否在寻找其他设置项?" + }, + { + "name": "face_config_light_01_universal", + "value": "拿起手机亮屏" + }, + { + "name": "multiface_list_title", + "value": "面部列表" + }, + { + "name": "multiface_default_face_name_1", + "value": "面部 1" + }, + { + "name": "multiface_default_face_name", + "value": "面部" + }, + { + "name": "multiface_enroll_new_face", + "value": "新建面部数据" + }, + { + "name": "multiface_face_name_title", + "value": "面部名称" + }, + { + "name": "delete_face", + "value": "删除面部" + }, + { + "name": "multiface_save", + "value": "保存" + }, + { + "name": "face_unlock_method_close", + "value": "关闭" + }, + { + "name": "face_recognize_unlock_title", + "value": "直接解锁" + }, + { + "name": "face_3dguide_info_2", + "value": "人脸识别可基于您的面部特征信息进行身份识别,了解" + }, + + { + "name": "face_inform_open_applock_msg", + "value": "需开启应用锁功能才能完成人脸关联。是否立即启用应用锁?" + }, + { + "name": "face_record_cancel", + "value": "取消" + }, + + { + "name": "face_recognize_unlock_summary_3d", + "value": "人脸识别成功后直接解锁" + }, + { + "name": "face_recognize_slideunlock_summary_3d", + "value": "人脸识别成功后滑动屏幕解锁" + }, + { + "name": "secure_notification_new", + "value": "智能显示锁屏通知" + }, + + { + "name": "face_fingerprint_settings_switch_title", + "value": "自动填充账号和密码" + }, + { + "name": "face_fingerprint_settings_switch_summary", + "value": "使用密码保险箱保存的帐号和密码" + }, + { + "name": "delete_record_title", + "value": "删除面部数据" + }, + { + "name": "enroll_backup_face_title", + "value": "设置备用面容" + }, + { + "name": "enroll_backup_face_summary", + "value": "除继续学习您的长相外,还可识别另一种面容" + }, + { + "name": "title_face_stare_aux", + "value": "人脸识别时需注视屏幕" + }, + { + "name": "face_inform_open_strongbox_msg", + "value": "需要启用文件管理保密柜完成人脸关联。是否启用?" + }, + { + "name": "face_record_delete", + "value": "删除" + }, + { + "name": "face_recognize_lighton_close_universal", + "value": "同时关闭拿起手机亮屏" + }, + { + "name": "title_strong_box_pref", + "value": "访问保密柜" + }, + { + "name": "face_enterance_off", + "value": "已关闭" + }, + { + "name": "face_record", + "value": "正在录入" + }, + { + "name": "face_record_3d_record_fail", + "value": "录入失败" + }, + { + "name": "enroll_face_guide_title", + "value": "如何录入面部数据" + }, + { + "name": "face_guide_2d_way", + "value": "首先,确保摄像头清洁、面部无遮挡,录入环境光线充足、无阳光直射。然后,正对屏幕,将面部完整移入识别区。" + }, + { + "name": "face_guide_2d_announce", + "value": "人脸识别可用于解锁屏幕及访问应用锁。点击“开始录入”即表示您同意" + }, + { + "name": "face_2dguide_light_notify_universal", + "value": "打开”拿起手机亮屏“,提升解锁体验" + }, + { + "name": "face_guide_3d_way", + "value": "首先,请确保您的面部全部显示在识别区内。然后注视屏幕并缓缓转动头部以完成全方位采集。" + }, + { + "name": "face_guide_3d_announce", + "value": "人脸识别可用于解锁屏幕,访问应用锁、保密柜及支付。点击“开始录入”即表示您同意" + }, + { + "name": "face_recognitin_guide", + "value": "开始录入" + }, + { + "name": "face_record_success", + "value": "录入成功" + }, + { + "name": "face_record_3d_tip_close", + "value": "人脸太小" + }, + { + "name": "face_record_3d_tip_far", + "value": "人脸太大" + }, + { + "name": "face_enroll_too_left", + "value": "人脸太靠左" + }, + { + "name": "face_enroll_too_high", + "value": "人脸太靠上" + }, + { + "name": "face_enroll_too_right", + "value": "人脸太靠右" + }, + { + "name": "face_enroll_too_low", + "value": "人脸太靠下" + }, + { + "name": "face_record_3d_tip_multi", + "value": "出现多张脸" + }, + { + "name": "face_rotate_too_left", + "value": "头向左转的角度太大" + }, + { + "name": "face_rotate_too_high", + "value": "头抬的角度太高" + }, + { + "name": "face_rotate_too_right", + "value": "头向右转的角度太大" + }, + { + "name": "face_rotate_too_low", + "value": "头抬的角度太低" } ] } \ No newline at end of file diff --git a/ui/faceenroll/settings.gradle b/ui/faceenroll/settings.gradle index 044a842977e66ce32233138de8c87658bfa57d92..bdcd7f804f1f932320a3b0abe4b0324d83272b29 100644 --- a/ui/faceenroll/settings.gradle +++ b/ui/faceenroll/settings.gradle @@ -12,5 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -include ':phone',':common',':features' + +include ':phone', ':common', ':feature', ':feature:facesettings', ':feature:faceSettingsPad', ':feature:trustedDevice',':pad', ':feature:trusteddevicepad' project(':phone').projectDir = new File('./product/phone') +project(':pad').projectDir = new File('./product/pad') \ No newline at end of file