Skip to content

Commit

Permalink
init harmony
Browse files Browse the repository at this point in the history
  • Loading branch information
欧阳智 committed Nov 24, 2023
1 parent 9ab80fc commit 94a4bd7
Show file tree
Hide file tree
Showing 42 changed files with 1,642 additions and 737 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ lib/android/src/main/gen
example/android/app/src/main/gen

# build
react-native-fast-image-*.tgz
dist/

# coverage reports
Expand Down
Binary file added harmony/fast_image.har
Binary file not shown.
6 changes: 6 additions & 0 deletions harmony/fast_image/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
33 changes: 33 additions & 0 deletions harmony/fast_image/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
OPEN SOURCE SOFTWARE NOTICE

Please note we provide an open source software notice for the third party open source software along with this software and/or this software component (in the following just “this SOFTWARE”). The open source software licenses are granted by the respective right holders.

Warranty Disclaimer
THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.

Copyright Notice and License Texts

----------------------------------------------------------------------
Software: react-native-fast-image v8.6.3

MIT License

Copyright (c) 2017 Dylan Vann

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
38 changes: 38 additions & 0 deletions harmony/fast_image/OAT.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<oatconfig>
<licensefile>LICENSE</licensefile>
<filefilterlist>
<filefilter name="copyrightPolicyFilter" desc="Filters for compatibility,license header policies">
<filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加版权头"/>
<filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加版权头"/>
<filteritem type="filename" name="*.proto" desc="资源文件,不需要添加版权头"/>
<filteritem type="filename" name="*.json" desc="资源文件,不需要添加版权头"/>
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filename" name="LICENSE" desc="工程文件,不修改版权头"/>
</filefilter>
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
<filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加许可证头"/>
<filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加许可证头"/>
<filteritem type="filename" name="LICENSE" desc="原三方库证书文件无需更改,因此添加过滤"/>
<filteritem type="filename" name="*.proto" desc="资源文件,不需要添加许可证头"/>
<filteritem type="filename" name="*.json" desc="资源文件,不需要添加许可证头"/>
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
</filefilter>
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for resources files policies">
<filteritem type="filename" name="icon.png" desc="应用图标"/>
<filteritem type="filename" name="app_icon.png" desc="应用图标"/>
<filteritem type="filename" name="warn.png" desc="页面展示图标"/>
</filefilter>
</filefilterlist>
<policylist>
<policy name="projectPolicy" desc="">
<policyitem type="license" name="MIT" path="src/.*" desc="license under the MIT"/>
</policy>
</policylist>
</oatconfig>
</configuration>
11 changes: 11 additions & 0 deletions harmony/fast_image/README.OpenSource
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"Name": "react-native-fast-image",
"License": "MIT License",
"License File": "https://github.com/DylanVann/react-native-fast-image/blob/v8.6.3/LICENSE",
"Version Number": "8.6.3",
"Owner" : "Dylan Vann <[email protected]>"
"Upstream URL": "https://github.com/DylanVann/react-native-fast-image",
"Description": "FastImage, performant React Native image component."
}
]
8 changes: 8 additions & 0 deletions harmony/fast_image/build-profile.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"apiType": "stageMode",
"targets": [
{
"name": "default",
}
]
}
2 changes: 2 additions & 0 deletions harmony/fast_image/hvigorfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
export { harTasks } from '@ohos/hvigor-ohos-plugin';
26 changes: 26 additions & 0 deletions harmony/fast_image/index.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* MIT License
*
* Copyright (C) 2023 Huawei Device Co., Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

export * from './src/main/ets/RNFastImage'
export * from "./src/main/ets/FastImagePackage"
12 changes: 12 additions & 0 deletions harmony/fast_image/oh-package.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"license": "ISC",
"types": "",
"devDependencies": {
"rnoh": "file:../rnoh"
},
"name": "rnoh-fast-image",
"description": "",
"main": "index.ets",
"version": "0.0.1",
"dependencies": {}
}
7 changes: 7 additions & 0 deletions harmony/fast_image/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

file(GLOB rnoh_fast_image_SRC CONFIGURE_DEPENDS *.cpp)
add_library(rnoh_fast_image SHARED ${rnoh_fast_image_SRC})
target_include_directories(rnoh_fast_image PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(rnoh_fast_image PUBLIC rnoh)
35 changes: 35 additions & 0 deletions harmony/fast_image/src/main/cpp/ComponentDescriptors.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateComponentDescriptorH.js
*/

#pragma once

#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
#include <react/renderer/components/view/ViewShadowNode.h>
#include "Props.h"
#include "EventEmitters.h"

namespace facebook {
namespace react {
extern const char FastImageViewComponentName[] = "FastImageView";
using FastImageViewShadowNode =
ConcreteViewShadowNode<FastImageViewComponentName, FastImageViewProps, FastImageViewEventEmitter>;

class ComponentDescriptorParameters;
class ComponentDescriptor;

class FastImageViewComponentDescriptor final : public ConcreteComponentDescriptor<FastImageViewShadowNode> {
public:
FastImageViewComponentDescriptor(ComponentDescriptorParameters const &parameters)
: ConcreteComponentDescriptor(parameters) {}
};

} // namespace react
} // namespace facebook
57 changes: 57 additions & 0 deletions harmony/fast_image/src/main/cpp/EventEmitters.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateEventEmitterCpp.js
*/

#include "EventEmitters.h"

namespace facebook {
namespace react {

void FastImageViewEventEmitter::onLoadStart(OnLoadStart event) const
{
dispatchEvent("loadStart", [event=std::move(event)](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);
return payload;
});
}
void FastImageViewEventEmitter::onProgress(OnProgress event) const
{
dispatchEvent("progress", [event=std::move(event)](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);
payload.setProperty(runtime, "loaded", event.loaded);
payload.setProperty(runtime, "total", event.total);
return payload;
});
}
void FastImageViewEventEmitter::onLoad(OnLoad event) const
{
dispatchEvent("load", [event=std::move(event)](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);
payload.setProperty(runtime, "width", event.width);
payload.setProperty(runtime, "height", event.height);
return payload;
});
}
void FastImageViewEventEmitter::onError(OnError event) const
{
dispatchEvent("error", [event=std::move(event)](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);
return payload;
});
}
void FastImageViewEventEmitter::onLoadEnd(OnLoadEnd event) const
{
dispatchEvent("loadEnd", [event=std::move(event)](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);
return payload;
});
}

} // namespace react
} // namespace facebook
48 changes: 48 additions & 0 deletions harmony/fast_image/src/main/cpp/EventEmitters.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateEventEmitterH.js
*/
#pragma once

#include <react/renderer/components/view/ViewEventEmitter.h>
#include <jsi/jsi.h>

namespace facebook {
namespace react {

class JSI_EXPORT FastImageViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;

struct OnLoadStart {
};

struct OnProgress {
int loaded;
int total;
};
struct OnLoad {
int width;
int height;
};

struct OnError {
};

struct OnLoadEnd {
};

void onLoadStart(OnLoadStart value) const;
void onProgress(OnProgress value) const;
void onLoad(OnLoad value) const;
void onError(OnError value) const;
void onLoadEnd(OnLoadEnd value) const;
};

} // namespace react
} // namespace facebook
Loading

0 comments on commit 94a4bd7

Please sign in to comment.