@react-native-ohos/react-native-image-crop-picker 0.40.4 → 0.50.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -4
- package/CODE_OF_CONDUCT.md +46 -0
- package/COMMITTERS.md +4 -7
- package/README.OpenSource +1 -1
- package/README.md +1 -1
- package/babel.config.js +14 -0
- package/harmony/image_crop_picker/index.ets +5 -3
- package/harmony/image_crop_picker/oh-package.json5 +16 -7
- package/harmony/image_crop_picker/src/main/cpp/CMakeLists.txt +2 -4
- package/harmony/image_crop_picker/src/main/cpp/{generated/RNOH/generated/turbo_modules/ImageCropPicker.cpp → ImageCropPicker.cpp} +6 -1
- package/harmony/image_crop_picker/src/main/cpp/{generated/RNOH/generated/turbo_modules/ImageCropPicker.h → ImageCropPicker.h} +6 -1
- package/harmony/image_crop_picker/src/main/cpp/ImageCropPickerPackage.h +84 -13
- package/harmony/image_crop_picker/src/main/ets/ImageCropPickerPackage.ts +23 -3
- package/harmony/image_crop_picker/src/main/ets/ImageCropPickerTurboModule.ts +39 -12
- package/harmony/image_crop_picker/src/main/ets/Logger.ts +23 -3
- package/harmony/image_crop_picker/src/main/ets/pages/ImageEditInfo.ets +23 -3
- package/harmony/image_crop_picker/src/main/ets/utils/Constants.ets +23 -3
- package/harmony/image_crop_picker/src/main/ets/utils/CropModel.ets +23 -3
- package/harmony/image_crop_picker/src/main/ets/utils/DecodeAndEncodeUtil.ets +23 -3
- package/harmony/image_crop_picker/src/main/ets/utils/EncodeUtil.ets +23 -3
- package/harmony/image_crop_picker/src/main/ets/utils/jul.ts +23 -3
- package/harmony/image_crop_picker/src/main/ets/utils/types.ets +23 -3
- package/harmony/image_crop_picker/src/main/ets/viewmodel/viewAndModel.ets +23 -4
- package/harmony/image_crop_picker/ts.ts +20 -11
- package/harmony/image_crop_picker.har +0 -0
- package/index.d.ts +24 -2
- package/js/NativeRNCImageCropPicker.ts +24 -0
- package/js/index.js +24 -0
- package/package.json +6 -5
- package/tsconfig.json +11 -0
- package/harmony/image_crop_picker/src/main/cpp/generated/RNOH/generated/BaseReactNativeImageCropPickerPackage.h +0 -66
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## v0.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
- pre-release: @react-native-ohos/react-native-image-crop-picker@0.40.4-rc.1 ([db47a7fb5b3960c0e05a93f83edb13a5113eade2](https://gitee.com/openharmony-sig/rntpc_react-native-image-crop-picker/pulls/4))
|
|
3
|
+
## v0.50.1
|
|
4
|
+
## 更新内容
|
|
5
|
+
* feat: add OpenHarmony support for react-native-image-crop-picker
|
package/CODE_OF_CONDUCT.md
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
## Our Standards
|
|
8
|
+
|
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
|
10
|
+
|
|
11
|
+
* Using welcoming and inclusive language
|
|
12
|
+
* Being respectful of differing viewpoints and experiences
|
|
13
|
+
* Gracefully accepting constructive criticism
|
|
14
|
+
* Focusing on what is best for the community
|
|
15
|
+
* Showing empathy towards other community members
|
|
16
|
+
|
|
17
|
+
Examples of unacceptable behavior by participants include:
|
|
18
|
+
|
|
19
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
|
20
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
21
|
+
* Public or private harassment
|
|
22
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
|
23
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
24
|
+
|
|
25
|
+
## Our Responsibilities
|
|
26
|
+
|
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
|
28
|
+
|
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
## Scope
|
|
32
|
+
|
|
33
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
|
34
|
+
|
|
35
|
+
## Enforcement
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at pusic007@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
|
38
|
+
|
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
|
40
|
+
|
|
41
|
+
## Attribution
|
|
42
|
+
|
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
|
44
|
+
|
|
45
|
+
[homepage]: http://contributor-covenant.org
|
|
46
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
package/COMMITTERS.md
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
## Committers列表
|
|
2
|
+
|
|
3
|
+
### 以下是此项目的committer人员
|
|
3
4
|
不区分先后顺序
|
|
4
5
|
|
|
5
|
-
- [
|
|
6
|
-
- [xiafeng_xf_admin](https://gitee.com/xiafeng_xf_admin)
|
|
7
|
-
- [chenLixi](https://gitee.com/Louis-C7)
|
|
8
|
-
- [LinJiacheng](https://gitee.com/LLLLLLin)
|
|
9
|
-
- [ZhengJinshou](https://gitee.com/longziz)
|
|
6
|
+
- [xiafeng_xf_admin](https://gitee.com/xiafeng_xf_admin)
|
package/README.OpenSource
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"Name": "react-native-image-crop-picker",
|
|
4
4
|
"License": "MIT License",
|
|
5
5
|
"License File": "https://github.com/ivpusic/react-native-image-crop-picker/blob/master/LICENSE",
|
|
6
|
-
"Version Number": "0.
|
|
6
|
+
"Version Number": "0.50.1",
|
|
7
7
|
"Owner" : "xiafeng@huawei.com",
|
|
8
8
|
"Upstream URL": "https://github.com/ivpusic/react-native-image-crop-picker",
|
|
9
9
|
"Description": "Select single or multiple images, with cropping option"
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @react-native-ohos/react-native-image-crop-picker
|
|
2
2
|
|
|
3
|
-
This project is based on [react-native-image-crop-picker@0.
|
|
3
|
+
This project is based on [react-native-image-crop-picker@0.50.1](https://github.com/ivpusic/react-native-image-crop-picker/tree/v0.50.1)
|
|
4
4
|
|
|
5
5
|
## Documentation
|
|
6
6
|
|
package/babel.config.js
ADDED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
4
6
|
|
|
5
7
|
export { ImageEditInfo } from "./src/main/ets/pages/ImageEditInfo"
|
|
6
8
|
export * from "./ts";
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
name:
|
|
2
|
+
"name": "@react-native-ohos/react-native-image-crop-picker",
|
|
3
3
|
"description": "Please describe the basic information.",
|
|
4
|
-
main:
|
|
5
|
-
type:
|
|
6
|
-
version:
|
|
7
|
-
dependencies: {
|
|
8
|
-
"@rnoh/react-native-openharmony": "
|
|
4
|
+
"main": "index.ets",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"version": "0.50.1",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@rnoh/react-native-openharmony": "file:../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har"
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
"metadata": {
|
|
11
|
+
"sourceRoots": [
|
|
12
|
+
"./src/main"
|
|
13
|
+
],
|
|
14
|
+
"debug": true
|
|
15
|
+
},
|
|
16
|
+
"compatibleSdkVersion": 12,
|
|
17
|
+
"compatibleSdkType": "HarmonyOS",
|
|
18
|
+
"obfuscated": false
|
|
19
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.13)
|
|
2
2
|
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
3
3
|
|
|
4
|
-
set(rnoh_image_crop_picker_generated_dir "${CMAKE_CURRENT_SOURCE_DIR}/generated")
|
|
5
|
-
file(GLOB_RECURSE rnoh_image_crop_picker_generated_SRC "${rnoh_image_crop_picker_generated_dir}/**/*.cpp")
|
|
6
4
|
file(GLOB rnoh_image_crop_picker_SRC CONFIGURE_DEPENDS *.cpp)
|
|
7
|
-
add_library(rnoh_image_crop_picker SHARED ${rnoh_image_crop_picker_SRC}
|
|
8
|
-
target_include_directories(rnoh_image_crop_picker PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
|
5
|
+
add_library(rnoh_image_crop_picker SHARED ${rnoh_image_crop_picker_SRC})
|
|
6
|
+
target_include_directories(rnoh_image_crop_picker PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
|
9
7
|
target_link_libraries(rnoh_image_crop_picker PUBLIC rnoh)
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generatorVersion: 1
|
|
3
8
|
*/
|
|
4
9
|
|
|
5
10
|
#include "ImageCropPicker.h"
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generatorVersion: 1
|
|
3
8
|
*/
|
|
4
9
|
|
|
5
10
|
#pragma once
|
|
@@ -1,19 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
4
24
|
|
|
5
|
-
#
|
|
6
|
-
#
|
|
25
|
+
#pragma once
|
|
26
|
+
#include "RNOH/Package.h"
|
|
27
|
+
#include "RNOH/ArkTSTurboModule.h"
|
|
28
|
+
#include "ImageCropPicker.h"
|
|
7
29
|
|
|
30
|
+
namespace rnoh {
|
|
8
31
|
|
|
9
|
-
|
|
10
|
-
|
|
32
|
+
class ImageCropPickerPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
|
|
33
|
+
public:
|
|
34
|
+
SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
|
|
35
|
+
if (name == "ImageCropPicker") {
|
|
36
|
+
return std::make_shared<ImageCropPicker>(ctx, name);
|
|
37
|
+
}
|
|
38
|
+
return nullptr;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
11
41
|
|
|
42
|
+
class ImageCropPickerEventEmitRequestHandler : public EventEmitRequestHandler {
|
|
43
|
+
public:
|
|
44
|
+
void handleEvent(Context const &ctx) override {
|
|
45
|
+
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
|
|
46
|
+
auto componentName = ctx.shadowViewRegistry->getComponentName(ctx.tag);
|
|
12
47
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
48
|
+
if (eventEmitter == nullptr) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
std::vector<std::string> supportedComponentNames = {
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
std::vector<std::string> supportedEventNames = {
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
if (std::find(supportedComponentNames.begin(), supportedComponentNames.end(), componentName) != supportedComponentNames.end() &&
|
|
59
|
+
std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
|
|
60
|
+
eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
17
63
|
};
|
|
18
|
-
|
|
19
|
-
|
|
64
|
+
|
|
65
|
+
class ImageCropPickerPackage : public Package {
|
|
66
|
+
public:
|
|
67
|
+
ImageCropPickerPackage(Package::Context ctx) : Package(ctx){};
|
|
68
|
+
|
|
69
|
+
std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
|
|
70
|
+
return std::make_unique<ImageCropPickerPackageTurboModuleFactoryDelegate>();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
|
|
74
|
+
return {
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
ComponentJSIBinderByString createComponentJSIBinderByName() override {
|
|
79
|
+
return {
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
EventEmitRequestHandlers createEventEmitRequestHandlers() override {
|
|
84
|
+
return {
|
|
85
|
+
std::make_shared<ImageCropPickerEventEmitRequestHandler>(),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
} // namespace rnoh
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
4
24
|
|
|
5
25
|
import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
|
|
6
26
|
import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
4
24
|
|
|
5
25
|
import type { TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
6
26
|
import { ImageCropPicker } from "./generated/turboModules/ImageCropPicker";
|
|
@@ -823,29 +843,37 @@ export class ImageCropPickerTurboModule extends TurboModule implements ImageCrop
|
|
|
823
843
|
async getFileInfo(includeBase64: boolean, filePath: string, compressOrTempFilePath: string, exifInfo: Exif): Promise<VideoImageInfo> {
|
|
824
844
|
let videoImageInfo: VideoImageInfo = { duration: null };
|
|
825
845
|
let imageType;
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
846
|
+
|
|
847
|
+
const targetFilePath = !this.isNullOrUndefined(compressOrTempFilePath) ? compressOrTempFilePath : filePath;
|
|
848
|
+
const isUsingCompressedFile = !this.isNullOrUndefined(compressOrTempFilePath);
|
|
849
|
+
|
|
850
|
+
let i = targetFilePath.lastIndexOf('/');
|
|
851
|
+
let fileName = targetFilePath.substring(i + 1);
|
|
852
|
+
i = targetFilePath.lastIndexOf('.');
|
|
829
853
|
if (i != -1) {
|
|
830
|
-
imageType =
|
|
854
|
+
imageType = targetFilePath.substring(i + 1);
|
|
831
855
|
}
|
|
832
|
-
|
|
856
|
+
|
|
857
|
+
videoImageInfo.path = filePrefix + targetFilePath;
|
|
833
858
|
videoImageInfo.filename = fileName;
|
|
834
859
|
videoImageInfo.mime = 'image/' + imageType;
|
|
835
860
|
|
|
836
|
-
let file = fs.openSync(
|
|
861
|
+
let file = fs.openSync(targetFilePath, fs.OpenMode.READ_ONLY);
|
|
837
862
|
let stat = fs.statSync(file.fd);
|
|
838
863
|
let length = stat.size;
|
|
839
864
|
videoImageInfo.size = length;
|
|
840
865
|
videoImageInfo.creationDate = stat.ctime;
|
|
841
866
|
videoImageInfo.modificationDate = stat.mtime;
|
|
842
|
-
|
|
867
|
+
|
|
868
|
+
if (this.isImage(targetFilePath)) {
|
|
843
869
|
let imageIS = image.createImageSource(file.fd)
|
|
844
870
|
let imagePM = await imageIS.createPixelMap()
|
|
845
871
|
let imgInfo = await imagePM.getImageInfo();
|
|
846
|
-
|
|
872
|
+
|
|
873
|
+
videoImageInfo.data = includeBase64 ? this.imageToBase64(targetFilePath) : null;
|
|
847
874
|
videoImageInfo.height = imgInfo.size.height;
|
|
848
875
|
videoImageInfo.width = imgInfo.size.width;
|
|
876
|
+
|
|
849
877
|
videoImageInfo.exif = exifInfo;
|
|
850
878
|
imagePM.release().then(() => {
|
|
851
879
|
imagePM = undefined;
|
|
@@ -856,7 +884,6 @@ export class ImageCropPickerTurboModule extends TurboModule implements ImageCrop
|
|
|
856
884
|
} else {
|
|
857
885
|
videoImageInfo.mime = 'video/' + imageType;
|
|
858
886
|
let url = 'fd://' + file.fd;
|
|
859
|
-
Logger.info(`${TAG} start avPlayer url = ${url}`);
|
|
860
887
|
avMetadataExtractor = await media.createAVMetadataExtractor();
|
|
861
888
|
avMetadataExtractor.fdSrc = { fd: file.fd, offset: 0, length: length };
|
|
862
889
|
try {
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
4
24
|
|
|
5
25
|
import hilog from '@ohos.hilog';
|
|
6
26
|
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
4
24
|
|
|
5
25
|
import image from '@ohos.multimedia.image';
|
|
6
26
|
import Logger from '../Logger';
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
4
24
|
|
|
5
25
|
export class Constants {
|
|
6
26
|
static readonly ENCODE_FORMAT: string = 'image/jpeg';
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
4
24
|
|
|
5
25
|
export class CropScaleClass {
|
|
6
26
|
value: number;
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
4
24
|
|
|
5
25
|
import fs from '@ohos.file.fs';
|
|
6
26
|
import image from '@ohos.multimedia.image';
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
4
24
|
|
|
5
25
|
import fs from '@ohos.file.fs';
|
|
6
26
|
import image from '@ohos.multimedia.image';
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
4
24
|
|
|
5
25
|
export function Event(...args): void {
|
|
6
26
|
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
4
24
|
|
|
5
25
|
@Observed
|
|
6
26
|
export class Rectangle {
|
|
@@ -1,7 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
5
24
|
export class RegionItem {
|
|
6
25
|
x: number;
|
|
7
26
|
y: number;
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
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
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
6
3
|
*
|
|
7
|
-
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
8
5
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
14
23
|
*/
|
|
15
24
|
|
|
16
25
|
export * from "./src/main/ets/ImageCropPickerPackage";
|
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
1
25
|
declare module "react-native-image-crop-picker" {
|
|
2
26
|
/**
|
|
3
27
|
* AVAssetExportPreset presets.
|
|
@@ -414,8 +438,6 @@ declare module "react-native-image-crop-picker" {
|
|
|
414
438
|
|
|
415
439
|
/**
|
|
416
440
|
* Selected image/video's filename.
|
|
417
|
-
*
|
|
418
|
-
* @platform iOS only
|
|
419
441
|
*/
|
|
420
442
|
filename?: string;
|
|
421
443
|
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
1
25
|
import type { TurboModule } from "react-native/library/TurboModule/RCTExport";
|
|
2
26
|
import { TurboModuleRegistry } from "react-native";
|
|
3
27
|
|
package/js/index.js
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
1
25
|
import React from 'react';
|
|
2
26
|
import ImageCropPicker from './NativeRNCImageCropPicker';
|
|
3
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-ohos/react-native-image-crop-picker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.1",
|
|
4
4
|
"description": "Select single or multiple images, with cropping option",
|
|
5
5
|
"main": "js/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,15 +29,16 @@
|
|
|
29
29
|
"bugs": {
|
|
30
30
|
"url": "https://gitcode.com/openharmony-sig/rntpc_react-native-image-crop-picker/issues"
|
|
31
31
|
},
|
|
32
|
-
"homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-image-crop-picker#readme",
|
|
32
|
+
"homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-image-crop-picker/tree/br_rnoh0.77#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"react-native-image-crop-picker": "^0.
|
|
34
|
+
"react-native-image-crop-picker": "^0.50.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"react-native-harmony-cli": "
|
|
37
|
+
"@react-native-oh/react-native-harmony-cli": "file:./packages/rnoh-react-native-harmony-cli-0.77.10.tgz"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"react
|
|
40
|
+
"react": "*",
|
|
41
|
+
"react-native": "*"
|
|
41
42
|
},
|
|
42
43
|
"harmony": {
|
|
43
44
|
"alias": "react-native-image-crop-picker"
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Basic Options */
|
|
4
|
+
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
|
5
|
+
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
|
6
|
+
"noEmit": true,
|
|
7
|
+
/* Strict Type-Checking Options */
|
|
8
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
9
|
+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
#pragma once
|
|
6
|
-
|
|
7
|
-
#include "RNOH/Package.h"
|
|
8
|
-
#include "RNOH/ArkTSTurboModule.h"
|
|
9
|
-
#include "RNOH/generated/turbo_modules/ImageCropPicker.h"
|
|
10
|
-
|
|
11
|
-
namespace rnoh {
|
|
12
|
-
|
|
13
|
-
class BaseReactNativeImageCropPickerPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
|
|
14
|
-
public:
|
|
15
|
-
SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
|
|
16
|
-
if (name == "ImageCropPicker") {
|
|
17
|
-
return std::make_shared<ImageCropPicker>(ctx, name);
|
|
18
|
-
}
|
|
19
|
-
return nullptr;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
class BaseReactNativeImageCropPickerPackageEventEmitRequestHandler : public EventEmitRequestHandler {
|
|
24
|
-
public:
|
|
25
|
-
void handleEvent(Context const &ctx) override {
|
|
26
|
-
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
|
|
27
|
-
if (eventEmitter == nullptr) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
std::vector<std::string> supportedEventNames = {
|
|
32
|
-
};
|
|
33
|
-
if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
|
|
34
|
-
eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
class BaseReactNativeImageCropPickerPackage : public Package {
|
|
41
|
-
public:
|
|
42
|
-
BaseReactNativeImageCropPickerPackage(Package::Context ctx) : Package(ctx){};
|
|
43
|
-
|
|
44
|
-
std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
|
|
45
|
-
return std::make_unique<BaseReactNativeImageCropPickerPackageTurboModuleFactoryDelegate>();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
|
|
49
|
-
return {
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
ComponentJSIBinderByString createComponentJSIBinderByName() override {
|
|
54
|
-
return {
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
EventEmitRequestHandlers createEventEmitRequestHandlers() override {
|
|
59
|
-
return {
|
|
60
|
-
std::make_shared<BaseReactNativeImageCropPickerPackageEventEmitRequestHandler>(),
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
} // namespace rnoh
|
|
66
|
-
|