mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-16 13:11:39 +08:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5b46071834 | ||
![]() |
a6802bdd44 | ||
![]() |
97848e7b13 |
@@ -45,8 +45,10 @@ node_modules/
|
||||
npm-debug.log
|
||||
Example
|
||||
yarn.lock
|
||||
bun.lock
|
||||
|
||||
domains.json
|
||||
endpoints.json
|
||||
endpoints_cresc.json
|
||||
|
||||
tea.yaml
|
@@ -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
@@ -1,10 +1,40 @@
|
||||
import ExpoModulesCore
|
||||
import react_native_update
|
||||
import React
|
||||
|
||||
public final class ExpoPushyReactDelegateHandler: ExpoReactDelegateHandler {
|
||||
private weak var reactDelegate: ExpoReactDelegate?
|
||||
|
||||
public override func bundleURL(reactDelegate: ExpoReactDelegate) -> URL? {
|
||||
return RCTPushy.bundleURL()
|
||||
}
|
||||
#if EXPO_SUPPORTS_BUNDLEURL
|
||||
// This code block compiles only if EXPO_SUPPORTS_BUNDLEURL is defined
|
||||
// For expo-modules-core >= 1.12.0
|
||||
|
||||
// Override bundleURL, which is the primary mechanism for these versions.
|
||||
// Expo's default createBridge implementation should respect this.
|
||||
override public func bundleURL(reactDelegate: ExpoReactDelegate) -> URL? {
|
||||
let bundleURL = RCTPushy.bundleURL()
|
||||
print("PushyHandler: Using bundleURL: \(bundleURL?.absoluteString ?? "nil")")
|
||||
return bundleURL
|
||||
}
|
||||
|
||||
// No createBridge override needed here, rely on default behavior using the bundleURL override.
|
||||
|
||||
#else
|
||||
// This code block compiles only if EXPO_SUPPORTS_BUNDLEURL is NOT defined
|
||||
// For expo-modules-core < 1.12.0
|
||||
|
||||
// No bundleURL override possible here.
|
||||
|
||||
// createBridge is the mechanism to customize the URL here.
|
||||
// We completely override it and do not call super.
|
||||
override public func createBridge(reactDelegate: ExpoReactDelegate, bridgeDelegate: RCTBridgeDelegate, launchOptions: [AnyHashable: Any]?) -> RCTBridge? {
|
||||
let bundleURL = RCTPushy.bundleURL()
|
||||
// Print the URL being provided to the initializer
|
||||
print("PushyHandler: createBridge bundleURL: \(bundleURL?.absoluteString ?? "nil")")
|
||||
|
||||
// Directly create the bridge using the bundleURL initializer.
|
||||
// Pass nil for moduleProvider, assuming default behavior is sufficient.
|
||||
// WARNING: If bundleURL is nil, this initialization might fail silently or crash.
|
||||
return RCTBridge(bundleURL: bundleURL, moduleProvider: nil, launchOptions: launchOptions)
|
||||
}
|
||||
|
||||
#endif // EXPO_SUPPORTS_BUNDLEURL
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-update",
|
||||
"version": "10.28.2",
|
||||
"version": "10.28.3",
|
||||
"description": "react-native hot update",
|
||||
"main": "src/index",
|
||||
"scripts": {
|
||||
@@ -74,5 +74,6 @@
|
||||
"react-native": "0.73",
|
||||
"ts-jest": "^29.2.5",
|
||||
"typescript": "^5.6.3"
|
||||
}
|
||||
},
|
||||
"packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
require 'json'
|
||||
require 'rubygems' # Required for version comparison
|
||||
|
||||
new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
||||
|
||||
@@ -33,17 +34,45 @@ Pod::Spec.new do |s|
|
||||
s.dependency "React-Core"
|
||||
s.dependency 'SSZipArchive'
|
||||
|
||||
project_root = File.expand_path('../../', __dir__)
|
||||
project_package_json = File.join(project_root, 'package.json')
|
||||
is_expo_project = false
|
||||
expo_dependency_added = false
|
||||
supports_bundle_url_final = false
|
||||
|
||||
if (File.exist?(project_package_json))
|
||||
package_json = JSON.parse(File.read(project_package_json))
|
||||
has_expo_dependency = package_json['dependencies'] && package_json['dependencies']['expo']
|
||||
has_expo_modules_core = Dir.exist?('node_modules/expo-modules-core')
|
||||
is_expo_project = has_expo_dependency || has_expo_modules_core
|
||||
if is_expo_project
|
||||
s.dependency 'ExpoModulesCore'
|
||||
# Use CocoaPods mechanism to find Podfile
|
||||
begin
|
||||
podfile_path = File.join(Pod::Config.instance.installation_root, 'Podfile')
|
||||
if File.exist?(podfile_path)
|
||||
podfile_content = File.read(podfile_path)
|
||||
is_expo_project = podfile_content.include?('use_expo_modules!')
|
||||
end
|
||||
rescue
|
||||
# Silently skip if CocoaPods config is not available
|
||||
end
|
||||
|
||||
if is_expo_project
|
||||
s.dependency 'ExpoModulesCore'
|
||||
expo_dependency_added = true
|
||||
|
||||
# Current directory is in node_modules/react-native-update, so parent is node_modules
|
||||
expo_core_package_json_path = File.join(__dir__, '..', 'expo-modules-core', 'package.json')
|
||||
|
||||
if File.exist?(expo_core_package_json_path)
|
||||
begin
|
||||
core_package_json = JSON.parse(File.read(expo_core_package_json_path))
|
||||
installed_version_str = core_package_json['version']
|
||||
|
||||
if installed_version_str
|
||||
begin
|
||||
installed_version = Gem::Version.new(installed_version_str)
|
||||
target_version = Gem::Version.new('1.12.0')
|
||||
supports_bundle_url_final = installed_version >= target_version
|
||||
rescue ArgumentError
|
||||
# Silently skip version parsing errors
|
||||
end
|
||||
end
|
||||
rescue JSON::ParserError, StandardError
|
||||
# Silently skip file reading and parsing errors
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -62,9 +91,12 @@ Pod::Spec.new do |s|
|
||||
ss.public_header_files = 'ios/RCTPushy/HDiffPatch/**/*.h'
|
||||
end
|
||||
|
||||
if is_expo_project
|
||||
if expo_dependency_added
|
||||
s.subspec 'Expo' do |ss|
|
||||
ss.source_files = 'ios/Expo/**/*.{h,m,mm,swift}'
|
||||
if supports_bundle_url_final
|
||||
ss.pod_target_xcconfig = { 'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => 'EXPO_SUPPORTS_BUNDLEURL' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -79,7 +111,7 @@ Pod::Spec.new do |s|
|
||||
s.pod_target_xcconfig = {
|
||||
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
||||
}
|
||||
}.merge(s.pod_target_xcconfig)
|
||||
s.dependency "React-Codegen"
|
||||
s.dependency "RCT-Folly"
|
||||
s.dependency "RCTRequired"
|
||||
|
Reference in New Issue
Block a user