• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_UPLOAD_CHECKER_H
17 #define OHOS_CLOUD_UPLOAD_CHECKER_H
18 
19 #include <mutex>
20 #include <stdint.h>
21 #include <string>
22 #include <vector>
23 
24 #include "rdb_predicates.h"
25 
26 namespace OHOS {
27 namespace Media {
28 struct CheckedPhotoInfo {
29     int32_t fileId;
30     std::string path;
31     int64_t size;
32     int32_t subtype;
33     int32_t movingPhotoEffectMode;
34 };
35 
36 class CloudUploadChecker {
37 public:
38     static void RepairNoOriginPhoto();
39 
40 private:
41     static void HandleNoOriginPhoto();
42     static std::vector<CheckedPhotoInfo> QueryPhotoInfo(int32_t startFiled);
43     static void HandlePhotoInfos(const std::vector<CheckedPhotoInfo> &photoInfos, int32_t &curFileId);
44     static void UpdateDirty(const std::vector<std::string> &idList, int32_t dirtyType);
45     static int32_t QueryLcdPhotoCount(int32_t startFileId);
46     static void UpdateFileSize(const CheckedPhotoInfo &photoInfo, bool isMovingPhoto);
47     static void HandleMissingFile(
48         const CheckedPhotoInfo &photoInfo, bool isMovingPhoto, std::vector<std::string> &noLcdList);
49 
50 private:
51     static std::mutex mutex_;
52 };
53 }  // namespace Media
54 }  // namespace OHOS
55 #endif  // OHOS_CLOUD_UPLOAD_CHECKER_H
56