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