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 #include "cloud_enhancement_asset_helper.h"
17 #include "medialibrary_type_const.h"
18
19 namespace OHOS {
20 namespace Media::AccurateRefresh {
21
IsAsset(const PhotoAssetChangeInfo & assetInfo)22 bool CloudEnhancementAssetHelper::IsAsset(const PhotoAssetChangeInfo &assetInfo)
23 {
24 return assetInfo.strongAssociation_ == static_cast<int32_t> (StrongAssociationType::CLOUD_ENHANCEMENT) &&
25 AlbumAssetHelper::IsImageAsset(assetInfo) && AlbumAssetHelper::IsCommonSystemAsset(assetInfo, false);
26 }
27
IsVideoAsset(const PhotoAssetChangeInfo & assetInfo)28 bool CloudEnhancementAssetHelper::IsVideoAsset(const PhotoAssetChangeInfo &assetInfo)
29 {
30 return false;
31 }
32
IsHiddenAsset(const PhotoAssetChangeInfo & assetInfo)33 bool CloudEnhancementAssetHelper::IsHiddenAsset(const PhotoAssetChangeInfo &assetInfo)
34 {
35 return assetInfo.strongAssociation_ == static_cast<int32_t> (StrongAssociationType::CLOUD_ENHANCEMENT) &&
36 AlbumAssetHelper::IsImageAsset(assetInfo) && AlbumAssetHelper::IsCommonSystemAsset(assetInfo, true);
37 }
IsNewerAsset(const PhotoAssetChangeInfo & compareAssetInfo,const PhotoAssetChangeInfo & currentAssetInfo)38 bool CloudEnhancementAssetHelper::IsNewerAsset(const PhotoAssetChangeInfo &compareAssetInfo,
39 const PhotoAssetChangeInfo ¤tAssetInfo)
40 {
41 return IsAsset(compareAssetInfo) && IsAsset(currentAssetInfo) &&
42 AlbumAssetHelper::IsNewerByDateTaken(compareAssetInfo, currentAssetInfo);
43 }
IsNewerHiddenAsset(const PhotoAssetChangeInfo & compareAssetInfo,const PhotoAssetChangeInfo & currentAssetInfo)44 bool CloudEnhancementAssetHelper::IsNewerHiddenAsset(const PhotoAssetChangeInfo &compareAssetInfo,
45 const PhotoAssetChangeInfo ¤tAssetInfo)
46 {
47 return IsHiddenAsset(compareAssetInfo) && IsHiddenAsset(currentAssetInfo) &&
48 AlbumAssetHelper::IsNewerByHiddenTime(compareAssetInfo, currentAssetInfo);
49 }
50
51 } // namespace Media
52 } // namespace OHOS