1 /* 2 * Copyright (c) 2021-2023 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 #ifndef FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_PATTERN_LOCK_H 17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_PATTERN_LOCK_H 18 19 #include "bridge/declarative_frontend/jsview/js_view_common_def.h" 20 #include "core/components_v2/pattern_lock/pattern_lock_component.h" 21 #include "core/components_v2/pattern_lock/pattern_lock_theme.h" 22 #include "frameworks/bridge/declarative_frontend/jsview/js_view_abstract.h" 23 #include "frameworks/bridge/declarative_frontend/jsview/js_view_common_def.h" 24 #include "frameworks/bridge/declarative_frontend/jsview/js_interactable_view.h" 25 26 namespace OHOS::Ace::Framework { 27 class JSPatternLock : public JSViewAbstract { 28 public: 29 static void Create(const JSCallbackInfo& info); 30 static void JSBind(BindingTarget globalObj); 31 static void SetSelectedColor(const JSCallbackInfo& info); 32 static void SetActiveColor(const JSCallbackInfo& info); 33 static void SetPathColor(const JSCallbackInfo& info); 34 static void SetRegularColor(const JSCallbackInfo& info); 35 static void SetCircleRadius(const JSCallbackInfo& info); 36 static void SetSideLength(const JSCallbackInfo& info); 37 static void SetPathStrokeWidth(const JSCallbackInfo& info); 38 static void SetAutoReset(const JSCallbackInfo& info); 39 40 protected: 41 static void SetPatternComplete(const JSCallbackInfo& info); 42 static void SetDotConnected(const JSCallbackInfo& info); 43 44 private: 45 static void SetDefaultTheme(OHOS::Ace::RefPtr<OHOS::Ace::V2::PatternLockComponent>& patternLock); 46 static JSRef<JSArray> ChoosePointToJSValue(std::vector<int> input); 47 }; 48 49 class JSPatternLockController final : public Referenced { 50 public: 51 JSPatternLockController() = default; 52 ~JSPatternLockController() override = default; 53 static void JSBind(BindingTarget globalObj); 54 static void Constructor(const JSCallbackInfo& args); 55 static void Destructor(JSPatternLockController* controller); 56 void Reset(const JSCallbackInfo& args); 57 void SetChallengeResult(const JSCallbackInfo& args); SetController(const RefPtr<V2::PatternLockController> & controller)58 void SetController(const RefPtr<V2::PatternLockController>& controller) 59 { 60 controller_ = controller; 61 } 62 63 private: 64 RefPtr<V2::PatternLockController> controller_; 65 ACE_DISALLOW_COPY_AND_MOVE(JSPatternLockController); 66 }; 67 } // namespace OHOS::Ace::Framework 68 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_PATTERN_LOCK_H 69