1 /* 2 * Copyright (c) 2025 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 UI_APPEARANCE_SMART_GESTURE_MANAGER_H 17 #define UI_APPEARANCE_SMART_GESTURE_MANAGER_H 18 19 #include <functional> 20 #include <mutex> 21 22 #include "errors.h" 23 #include "nocopyable.h" 24 25 namespace OHOS::ArkUi::UiAppearance { 26 class SmartGestureManager final : public NoCopyable { 27 public: 28 static SmartGestureManager &GetInstance(); 29 30 ErrCode Initialize(const std::function<void(bool, int32_t)>& updateCallback); 31 32 ErrCode RegisterSettingDataObserver() const; 33 34 void UpdateSmartGestureInitialValue(); 35 36 private: 37 enum SmartGestureMode { 38 SMART_GESTURE_INVALID = -1, 39 SMART_GESTURE_DISABLE = 0, 40 SMART_GESTURE_AUTO = 1, 41 }; 42 43 void LoadSettingDataObserversCallback(); 44 45 void UpdateSmartGestureValue(const std::string& key, int32_t userId); 46 47 void OnChangeSmartGestureMode(SmartGestureMode mode, int32_t userId); 48 49 std::pair<std::string, std::function<void(const std::string&, int32_t)>> observer_; 50 51 std::function<void(bool, int32_t)> updateCallback_; 52 }; 53 } // namespace OHOS::ArkUi::UiAppearance 54 55 #endif // UI_APPEARANCE_SMART_GESTURE_MANAGER_H 56