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 static void SetActiveCircleColor(const JSRef<JSVal>& info); 40 static void SetActiveCircleRadius(const JSRef<JSVal>& info); 41 static void SetEnableWaveEffect(const JSRef<JSVal>& info); 42 static void SetActivateCircleStyle(const JSCallbackInfo& info); 43 44 protected: 45 static void SetPatternComplete(const JSCallbackInfo& info); 46 static void SetDotConnect(const JSCallbackInfo& info); 47 48 private: 49 static void SetDefaultTheme(OHOS::Ace::RefPtr<OHOS::Ace::V2::PatternLockComponent>& patternLock); 50 static JSRef<JSArray> ChoosePointToJSValue(std::vector<int> input); 51 }; 52 53 class JSPatternLockController final : public Referenced { 54 public: 55 JSPatternLockController() = default; 56 ~JSPatternLockController() override = default; 57 static void JSBind(BindingTarget globalObj); 58 static void Constructor(const JSCallbackInfo& args); 59 static void Destructor(JSPatternLockController* controller); 60 void Reset(const JSCallbackInfo& args); 61 void SetChallengeResult(const JSCallbackInfo& args); SetController(const RefPtr<V2::PatternLockController> & controller)62 void SetController(const RefPtr<V2::PatternLockController>& controller) 63 { 64 controller_ = controller; 65 } 66 67 private: 68 RefPtr<V2::PatternLockController> controller_; 69 ACE_DISALLOW_COPY_AND_MOVE(JSPatternLockController); 70 }; 71 } // namespace OHOS::Ace::Framework 72 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_PATTERN_LOCK_H 73