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 "setting_data_observer.h" 17 18 namespace OHOS::ArkUi::UiAppearance { OnChange()19void SettingDataObserver::OnChange() 20 { 21 if (updateFunc_) { 22 updateFunc_(key_, userId_); 23 } 24 } 25 SetKey(const std::string & key)26void SettingDataObserver::SetKey(const std::string& key) 27 { 28 key_ = key; 29 } 30 GetKey() const31const std::string &SettingDataObserver::GetKey() const 32 { 33 return key_; 34 } 35 SetUpdateFunc(const UpdateFunc & updateFunc)36void SettingDataObserver::SetUpdateFunc(const UpdateFunc& updateFunc) 37 { 38 updateFunc_ = updateFunc; 39 } 40 SetUserId(const int32_t userId)41void SettingDataObserver::SetUserId(const int32_t userId) 42 { 43 userId_ = userId; 44 } 45 GetUserId() const46int32_t SettingDataObserver::GetUserId() const 47 { 48 return userId_; 49 } 50 } // namespace OHOS::ArkUi::UiAppearance 51