• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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_task_state_napi.h"
17 #include "cloud_enhancement_napi.h"
18 #include "cloud_media_asset_manager_napi.h"
19 #include "cloud_media_asset_status_napi.h"
20 #include "highlight_album_napi.h"
21 #include "media_album_change_request_napi.h"
22 #include "media_asset_change_request_napi.h"
23 #include "media_asset_edit_data_napi.h"
24 #include "media_asset_manager_napi.h"
25 #include "media_assets_change_request_napi.h"
26 #include "napi/native_node_api.h"
27 #include "native_module_ohos_medialibrary.h"
28 #include "photo_proxy_napi.h"
29 
30 namespace OHOS {
31 namespace Media {
32 /*
33  * Function registering all props and functions of userfilemanager module
34  */
PhotoAccessHelperExport(napi_env env,napi_value exports)35 static napi_value PhotoAccessHelperExport(napi_env env, napi_value exports)
36 {
37     MediaLibraryNapi::PhotoAccessHelperInit(env, exports);
38     FetchFileResultNapi::PhotoAccessHelperInit(env, exports);
39     FileAssetNapi::PhotoAccessHelperInit(env, exports);
40     AlbumNapi::PhotoAccessHelperInit(env, exports);
41     PhotoAlbumNapi::PhotoAccessInit(env, exports);
42     HighlightAlbumNapi::AnalysisAlbumInit(env, exports);
43     HighlightAlbumNapi::Init(env, exports);
44     MediaAssetEditDataNapi::Init(env, exports);
45     MediaAssetChangeRequestNapi::Init(env, exports);
46     MediaAssetsChangeRequestNapi::Init(env, exports);
47     MediaAlbumChangeRequestNapi::Init(env, exports);
48     MediaAlbumChangeRequestNapi::MediaAnalysisAlbumChangeRequestInit(env, exports);
49     MediaAssetManagerNapi::Init(env, exports);
50     MovingPhotoNapi::Init(env, exports);
51     PhotoProxyNapi::Init(env, exports);
52     CloudEnhancementNapi::Init(env, exports);
53     CloudEnhancementTaskStateNapi::Init(env, exports);
54     CloudMediaAssetManagerNapi::Init(env, exports);
55     CloudMediaAssetStatusNapi::Init(env, exports);
56     return exports;
57 }
58 
59 /*
60  * module define
61  */
62 static napi_module g_photoAccessHelperModule = {
63     .nm_version = 1,
64     .nm_flags = 0,
65     .nm_filename = nullptr,
66     .nm_register_func = PhotoAccessHelperExport,
67     .nm_modname = "file.photoAccessHelper",
68     .nm_priv = reinterpret_cast<void *>(0),
69     .reserved = {0}
70 };
71 
72 /*
73  * module register
74  */
RegisterPhotoAccessHelper(void)75 extern "C" __attribute__((constructor)) void RegisterPhotoAccessHelper(void)
76 {
77     napi_module_register(&g_photoAccessHelperModule);
78 }
79 } // namespace Media
80 } // namespace OHOS