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 #ifndef OHOS_CLOUD_DISK_SERVICE_NOTIFY_H 17 #define OHOS_CLOUD_DISK_SERVICE_NOTIFY_H 18 19 #include <list> 20 #include <string> 21 22 #include "clouddisk_notify_const.h" 23 #include "dataobs_mgr_client.h" 24 #include "nocopyable.h" 25 26 namespace OHOS::FileManagement::CloudDisk { 27 using namespace std; 28 using ChangeInfo = OHOS::AAFwk::ChangeInfo; 29 30 struct CacheNotifyInfo { 31 NotifyType notifyType; 32 mutable list<Uri> uriList; 33 mutable list<bool> isDirList; 34 }; 35 36 class CloudDiskNotify final : public NoCopyable { 37 public: 38 static CloudDiskNotify &GetInstance(); 39 void TryNotify(const NotifyParamDisk ¶mDisk, const ParamDiskOthers ¶mOthers = {}); 40 void TryNotifyService(const NotifyParamService ¶mService, const ParamServiceOther ¶mOthers = {}); 41 int32_t GetDeleteNotifyData(const vector<NativeRdb::ValueObject> &deleteIds, 42 vector<NotifyData> ¬ifyDataList, 43 const ParamServiceOther ¶mOthers); 44 void AddNotify(const NotifyData notifyData); 45 void NotifyChangeOuter(); 46 47 private: 48 CloudDiskNotify() = default; 49 ~CloudDiskNotify() = default; 50 list<CacheNotifyInfo> nfList_; 51 mutex mutex_; 52 }; 53 } // namespace OHOS::FileManagement::CloudDisk 54 55 #endif // OHOS_CLOUD_DISK_SERVICE_NOTIFY_H