• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "user_auth_modal_inner_callback.h"
17 
18 #include "iam_logger.h"
19 
20 #include "user_auth_napi_client_impl.h"
21 
22 #define LOG_TAG "USER_AUTH_SDK"
23 
24 namespace OHOS {
25 namespace UserIam {
26 namespace UserAuth {
UserAuthModalInnerCallback()27 UserAuthModalInnerCallback::UserAuthModalInnerCallback()
28 {}
29 
~UserAuthModalInnerCallback()30 UserAuthModalInnerCallback::~UserAuthModalInnerCallback()
31 {}
32 
SendCommand(uint64_t contextId,const std::string & cmdData)33 void UserAuthModalInnerCallback::SendCommand(uint64_t contextId, const std::string &cmdData)
34 {
35     IAM_LOGI("SendCommand start");
36     CancelAuthentication(contextId, CancelReason::MODAL_CREATE_ERROR);
37     IAM_LOGI("invalid request");
38 }
39 
IsModalInit()40 bool UserAuthModalInnerCallback::IsModalInit()
41 {
42     IAM_LOGD("get is modal init");
43     return false;
44 }
45 
IsModalDestroy()46 bool UserAuthModalInnerCallback::IsModalDestroy()
47 {
48     IAM_LOGD("get is modal on destroy");
49     return false;
50 }
51 
CancelAuthentication(uint64_t contextId,int32_t cancelReason)52 void UserAuthModalInnerCallback::CancelAuthentication(uint64_t contextId, int32_t cancelReason)
53 {
54     // cancel for failed
55     int32_t code = UserAuthNapiClientImpl::Instance().CancelAuthentication(contextId, cancelReason);
56     IAM_LOGI("CancelAuthentication, code: %{public}d, contextId: ****%{public}hx", code,
57         static_cast<uint16_t>(contextId));
58 }
59 } // namespace UserAuth
60 } // namespace UserIam
61 } // namespace OHOS