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