mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-30 04:43:11 +08:00
fix
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -59,3 +59,4 @@ harmony/package
|
|||||||
harmony/pushy/.preview
|
harmony/pushy/.preview
|
||||||
Example/harmony_use_pushy/harmony/entry/src/main/resources/rawfile/meta.json
|
Example/harmony_use_pushy/harmony/entry/src/main/resources/rawfile/meta.json
|
||||||
**/.hvigor
|
**/.hvigor
|
||||||
|
Example/harmony_use_pushy/harmony/entry/src/main/cpp/generated
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable react/no-unstable-nested-components */
|
|
||||||
/* eslint-disable react-native/no-inline-styles */
|
/* eslint-disable react-native/no-inline-styles */
|
||||||
import React, {useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
import {StyleSheet, Text, View, TouchableOpacity, Image} from 'react-native';
|
import {StyleSheet, Text, View, TouchableOpacity, Image} from 'react-native';
|
||||||
@@ -6,7 +5,7 @@ import {StyleSheet, Text, View, TouchableOpacity, Image} from 'react-native';
|
|||||||
import TestConsole from './TestConsole';
|
import TestConsole from './TestConsole';
|
||||||
|
|
||||||
import _updateConfig from './update.json';
|
import _updateConfig from './update.json';
|
||||||
import {PushyProvider, Pushy, usePushy} from 'react-native-update';
|
import {UpdateProvider, Pushy, useUpdate} from 'react-native-update';
|
||||||
const {appKey} = _updateConfig.harmony;
|
const {appKey} = _updateConfig.harmony;
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
@@ -20,7 +19,7 @@ function App() {
|
|||||||
packageVersion,
|
packageVersion,
|
||||||
currentHash,
|
currentHash,
|
||||||
progress: {received, total} = {},
|
progress: {received, total} = {},
|
||||||
} = usePushy();
|
} = useUpdate();
|
||||||
const [useDefaultAlert, setUseDefaultAlert] = useState(false);
|
const [useDefaultAlert, setUseDefaultAlert] = useState(false);
|
||||||
const [showTestConsole, setShowTestConsole] = useState(false);
|
const [showTestConsole, setShowTestConsole] = useState(false);
|
||||||
const [showUpdateBanner, setShowUpdateBanner] = useState(false);
|
const [showUpdateBanner, setShowUpdateBanner] = useState(false);
|
||||||
@@ -41,6 +40,7 @@ function App() {
|
|||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<Text style={styles.welcome}>欢迎使用Pushy热更新服务</Text>
|
<Text style={styles.welcome}>欢迎使用Pushy热更新服务</Text>
|
||||||
|
{/* <Image source={require('./gmail.png')} style={styles.image} /> */}
|
||||||
{/* <Text style={styles.welcome}>😁hdiffFromAPP更新成功!!!</Text> */}
|
{/* <Text style={styles.welcome}>😁hdiffFromAPP更新成功!!!</Text> */}
|
||||||
{/* <Text style={styles.welcome}>😁hdiffFromPPk更新成功!!!</Text> */}
|
{/* <Text style={styles.welcome}>😁hdiffFromPPk更新成功!!!</Text> */}
|
||||||
<View style={{flexDirection: 'row'}}>
|
<View style={{flexDirection: 'row'}}>
|
||||||
@@ -166,7 +166,7 @@ function App() {
|
|||||||
style={{marginRight: 20}}>
|
style={{marginRight: 20}}>
|
||||||
<Text style={{color: '#2196F3'}}>下次再说</Text>
|
<Text style={{color: '#2196F3'}}>下次再说</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity onPress={switchVersion}>
|
<TouchableOpacity onPress={() => switchVersion()}>
|
||||||
<Text style={{color: '#2196F3'}}>立即重启</Text>
|
<Text style={{color: '#2196F3'}}>立即重启</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
@@ -204,18 +204,22 @@ const styles = StyleSheet.create({
|
|||||||
color: '#333333',
|
color: '#333333',
|
||||||
marginBottom: 5,
|
marginBottom: 5,
|
||||||
},
|
},
|
||||||
image: {},
|
image: {
|
||||||
|
width: 109,
|
||||||
|
height: 40,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const pushyClient = new Pushy({
|
const pushyClient = new Pushy({
|
||||||
appKey,
|
appKey,
|
||||||
debug: true,
|
debug: true,
|
||||||
|
updateStrategy: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function Root() {
|
export default function Root() {
|
||||||
return (
|
return (
|
||||||
<PushyProvider client={pushyClient}>
|
<UpdateProvider client={pushyClient}>
|
||||||
<App />
|
<App />
|
||||||
</PushyProvider>
|
</UpdateProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
source 'https://rubygems.org'
|
|
||||||
|
|
||||||
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
|
|
||||||
ruby ">= 2.6.10"
|
|
||||||
|
|
||||||
gem 'cocoapods', '~> 1.12'
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,65 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -18,7 +18,7 @@
|
|||||||
"@react-native-oh/react-native-harmony": "^0.72.59",
|
"@react-native-oh/react-native-harmony": "^0.72.59",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-native": "0.72.5",
|
"react-native": "0.72.5",
|
||||||
"react-native-update": "latest"
|
"react-native-update": "^10.34.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.20.0",
|
"@babel/core": "^7.20.0",
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export class DownloadTask {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
const exists = fileIo.accessSync(params.targetFile);
|
let exists = fileIo.accessSync(params.targetFile);
|
||||||
if (exists) {
|
if (exists) {
|
||||||
await fileIo.unlink(params.targetFile);
|
await fileIo.unlink(params.targetFile);
|
||||||
} else {
|
} else {
|
||||||
@@ -65,7 +65,7 @@ export class DownloadTask {
|
|||||||
0,
|
0,
|
||||||
params.targetFile.lastIndexOf('/'),
|
params.targetFile.lastIndexOf('/'),
|
||||||
);
|
);
|
||||||
const exists = fileIo.accessSync(targetDir);
|
exists = fileIo.accessSync(targetDir);
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
await fileIo.mkdir(targetDir);
|
await fileIo.mkdir(targetDir);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export class PushyFileJSBundleProvider extends JSBundleProvider {
|
|||||||
|
|
||||||
async getBundle(): Promise<ArrayBuffer> {
|
async getBundle(): Promise<ArrayBuffer> {
|
||||||
try {
|
try {
|
||||||
this.filePath = this.updateContext.getBundleUrl();
|
this.filePath = this.updateContext.getBundleUrl();
|
||||||
const res = fileIo.accessSync(this.filePath);
|
const res = fileIo.accessSync(this.filePath);
|
||||||
if (res) {
|
if (res) {
|
||||||
const file = fileIo.openSync(this.filePath, fileIo.OpenMode.READ_ONLY);
|
const file = fileIo.openSync(this.filePath, fileIo.OpenMode.READ_ONLY);
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ export class UpdateContext {
|
|||||||
params.hash = hash;
|
params.hash = hash;
|
||||||
params.listener = listener;
|
params.listener = listener;
|
||||||
params.targetFile = `${this.rootDir}/${hash}.ppk`;
|
params.targetFile = `${this.rootDir}/${hash}.ppk`;
|
||||||
|
params.unzipDirectory = `${this.rootDir}/${hash}`;
|
||||||
const downloadTask = new DownloadTask(this.context);
|
const downloadTask = new DownloadTask(this.context);
|
||||||
await downloadTask.execute(params);
|
await downloadTask.execute(params);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -162,8 +163,8 @@ export class UpdateContext {
|
|||||||
const downloadTask = new DownloadTask(this.context);
|
const downloadTask = new DownloadTask(this.context);
|
||||||
return await downloadTask.execute(params);
|
return await downloadTask.execute(params);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw e;
|
|
||||||
console.error('Failed to download APK patch:', e);
|
console.error('Failed to download APK patch:', e);
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update",
|
"name": "react-native-update",
|
||||||
"version": "10.34.9",
|
"version": "10.35.0",
|
||||||
"description": "react-native hot update",
|
"description": "react-native hot update",
|
||||||
"main": "src/index",
|
"main": "src/index",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export const currentVersionInfo = _currentVersionInfo;
|
|||||||
|
|
||||||
export const isFirstTime: boolean = PushyConstants.isFirstTime;
|
export const isFirstTime: boolean = PushyConstants.isFirstTime;
|
||||||
export const rolledBackVersion: string = PushyConstants.rolledBackVersion;
|
export const rolledBackVersion: string = PushyConstants.rolledBackVersion;
|
||||||
export const isRolledBack: boolean = typeof rolledBackVersion === 'string';
|
export const isRolledBack: boolean = !!rolledBackVersion;
|
||||||
|
|
||||||
export const buildTime: string = PushyConstants.buildTime;
|
export const buildTime: string = PushyConstants.buildTime;
|
||||||
let uuid = PushyConstants.uuid;
|
let uuid = PushyConstants.uuid;
|
||||||
|
|||||||
Reference in New Issue
Block a user