mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-16 07:01:38 +08:00
support to harmony local debug mode (#493)
* support to Expo * update * update * update * support to harmony local debug * udpate * update --------- Co-authored-by: Steven <steven@Stevens-MacBook-Pro.local>
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
## 运行harmony_use_pushy项目步骤
|
||||
|
||||
### 1. 先在react-native-update根目录执行下面命令同步C++模块。
|
||||
### 1. 在项目根目录执行下面命令安装第三方依赖。
|
||||
```
|
||||
yarn submodule
|
||||
bun install
|
||||
```
|
||||
|
||||
### 2. 在项目根目录执行下面命令安装第三方依赖。
|
||||
### 2. 本地debug 模式
|
||||
```
|
||||
yarn install
|
||||
bun run start
|
||||
```
|
||||

|
||||
|
||||
### 3. 在项目根目录执行下面命令生成bundle包文件。
|
||||
### 3. release 模式: 在项目根目录执行下面命令生成bundle包文件。
|
||||
```
|
||||
yarn build
|
||||
bun run build
|
||||
```
|
||||
说明:这个命令会在harmony/entry/src/main/resources/rawfile目录生成Hbundle.harmony.js和assets文件,同时会基于该内容在.pushy/output目录生成ppk包。
|
||||
|
||||
|
2130
Example/harmony_use_pushy/bun.lock
Normal file
2130
Example/harmony_use_pushy/bun.lock
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Example/harmony_use_pushy/debug.png
Normal file
BIN
Example/harmony_use_pushy/debug.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 743 KiB |
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* This code was generated by "react-native codegen-harmony"
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be
|
||||
* lost once the code is regenerated.
|
||||
*
|
||||
* @generatorVersion: 1
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RNOH/Package.h"
|
||||
#include "RNOH/ArkTSTurboModule.h"
|
||||
|
||||
namespace rnoh {
|
||||
|
||||
class RNOHGeneratedPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
|
||||
public:
|
||||
SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
|
||||
return nullptr;
|
||||
};
|
||||
};
|
||||
|
||||
class GeneratedEventEmitRequestHandler : public EventEmitRequestHandler {
|
||||
public:
|
||||
void handleEvent(Context const &ctx) override {
|
||||
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
|
||||
if (eventEmitter == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::string> supportedEventNames = {
|
||||
};
|
||||
if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
|
||||
eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class RNOHGeneratedPackage : public Package {
|
||||
public:
|
||||
RNOHGeneratedPackage(Package::Context ctx) : Package(ctx){};
|
||||
|
||||
std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
|
||||
return std::make_unique<RNOHGeneratedPackageTurboModuleFactoryDelegate>();
|
||||
}
|
||||
|
||||
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
|
||||
return {
|
||||
};
|
||||
}
|
||||
|
||||
ComponentJSIBinderByString createComponentJSIBinderByName() override {
|
||||
return {
|
||||
};
|
||||
};
|
||||
|
||||
EventEmitRequestHandlers createEventEmitRequestHandlers() override {
|
||||
return {
|
||||
std::make_shared<GeneratedEventEmitRequestHandler>(),
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace rnoh
|
@@ -1,5 +1,6 @@
|
||||
import { FileJSBundleProvider } from 'pushy/src/main/ets/FileJSBundleProvider';
|
||||
import { ComponentBuilderContext, RNOHCoreContext,RNAbility } from '@rnoh/react-native-openharmony';
|
||||
import { ComponentBuilderContext, RNOHCoreContext,RNAbility,
|
||||
MetroJSBundleProvider } from '@rnoh/react-native-openharmony';
|
||||
import {
|
||||
RNApp,
|
||||
AnyJSBundleProvider,
|
||||
@@ -61,8 +62,9 @@ struct Index {
|
||||
},
|
||||
jsBundleProvider: new TraceJSBundleProviderDecorator(
|
||||
new AnyJSBundleProvider([
|
||||
// MetroJSBundleProvider.fromServerIp('127.0.0.1'),
|
||||
// new ResourceJSBundleProvider(rnohCoreContext.uiAbilityContext.resourceManager, 'hermes_bundle.hbc'),
|
||||
// local debug mode
|
||||
new MetroJSBundleProvider(),
|
||||
// release mode
|
||||
new FileJSBundleProvider(this.rnohCoreContext.uiAbilityContext),
|
||||
new ResourceJSBundleProvider(this.rnohCoreContext.uiAbilityContext.resourceManager, 'bundle.harmony.js')
|
||||
]),
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"pushy_build_time": "2025-03-09T01:57:42.464Z",
|
||||
"pushy_build_time": "2025-04-12T11:12:43.423Z",
|
||||
"versionName": "1.0.0"
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
export {}
|
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* This code was generated by "react-native codegen-harmony"
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be
|
||||
* lost once the code is regenerated.
|
||||
*/
|
||||
|
||||
export * from "./ts"
|
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* This code was generated by "react-native codegen-harmony"
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be
|
||||
* lost once the code is regenerated.
|
||||
*/
|
||||
|
||||
export * as RNC from "./components/ts"
|
||||
export * as TM from "./turboModules/ts"
|
@@ -0,0 +1,5 @@
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
export {}
|
12423
Example/harmony_use_pushy/package-lock.json
generated
12423
Example/harmony_use_pushy/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,8 @@
|
||||
"android": "react-native run-android",
|
||||
"ios": "react-native run-ios",
|
||||
"lint": "eslint .",
|
||||
"start": "react-native start",
|
||||
"start": "npm run codegen && hdc rport tcp:8081 tcp:8081 && react-native start",
|
||||
"codegen": "react-native codegen-harmony --rnoh-module-path ./harmony/react_native_openharmony",
|
||||
"build": "pushy bundle --platform harmony",
|
||||
"test": "jest",
|
||||
"hdiffFromPPK": "pushy hdiffFromPPK .pushy/output/harmony.1735052610653.ppk .pushy/output/harmony.1735052678646.ppk .pushy/output/hdiff.ppk-patch",
|
||||
@@ -14,10 +15,10 @@
|
||||
"hash": "pushy hash /Users/yanbo.he/Desktop/HarmonyOS/react-native-pushy/Example/harmony_use_pushy/.pushy/output/harmony.1735048297258.ppk"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native-oh/react-native-harmony": "^0.72.43",
|
||||
"react": "18.2.0",
|
||||
"react-native": "0.72.5",
|
||||
"react-native-update": "file:../../",
|
||||
"@react-native-oh/react-native-harmony": "^0.72.43"
|
||||
"react-native-update": "^10.26.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.0",
|
||||
|
7566
Example/testHotUpdate/yarn.lock
Normal file
7566
Example/testHotUpdate/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -380,4 +380,4 @@ export const UpdateProvider = ({
|
||||
};
|
||||
|
||||
/** @deprecated Please use `UpdateProvider` instead */
|
||||
export const PushyProvider = UpdateProvider;
|
||||
export const PushyProvider = UpdateProvider;
|
@@ -98,4 +98,4 @@ export interface ClientOptions {
|
||||
export interface UpdateTestPayload {
|
||||
type: '__rnPushyVersionHash' | string | null;
|
||||
data: any;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user