• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 OHOS_MEDIALIBRARY_ASSET_CHANGE_NOTIFY_EXECUTION_H
17 #define OHOS_MEDIALIBRARY_ASSET_CHANGE_NOTIFY_EXECUTION_H
18 
19 #include <functional>
20 #include <map>
21 #include <vector>
22 
23 #include "notify_info_inner.h"
24 #include "photo_asset_change_info.h"
25 
26 namespace OHOS {
27 namespace Media::AccurateRefresh {
28 
29 const int32_t OPERATION_HIDDEN_FLAG = 0x1;
30 const int32_t OPERATION_TRASH_FLAG = 0x2;
31 const int32_t OPERATION_NONE_FLAG = 0x100;
32 enum AssetType {
33     ASSET_NORMAL = 0,
34     ASSET_HIDDEN = OPERATION_HIDDEN_FLAG,
35     ASSET_TRASH = OPERATION_TRASH_FLAG,
36     ASSET_TRASH_HIDDEN = OPERATION_TRASH_FLAG + OPERATION_HIDDEN_FLAG,
37     ASSET_INVALID = OPERATION_NONE_FLAG,
38 };
39 
40 class AssetChangeNotifyExecution {
41 public:
42     void Notify(const std::vector<PhotoAssetChangeData> &changeDatas);
43 private:
44     void InsertNotifyInfo(Notification::AssetRefreshOperation operationType, const PhotoAssetChangeData &changeData);
45     Notification::AssetRefreshOperation GetAddOperation(const PhotoAssetChangeInfo &changeInfo);
46     Notification::AssetRefreshOperation GetRemoveOperation(const PhotoAssetChangeInfo &changeInfo);
47     void InsertNormalAssetOperation(const PhotoAssetChangeData &changeData);
48     void InsertTrashAssetOperation(const PhotoAssetChangeData &changeData);
49     void InsertHiddenlAssetOperation(const PhotoAssetChangeData &changeData);
50 
51 private:
52     std::map<Notification::AssetRefreshOperation, std::vector<PhotoAssetChangeData>> notifyInfos_;
53 };
54 
55 } // namespace Media
56 } // namespace OHOS
57 
58 #endif