mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-17 23:36:11 +08:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3353c16fa3 | ||
![]() |
93d2a6cccb | ||
![]() |
cfdc26f71d | ||
![]() |
b6a08a19c8 | ||
![]() |
ef53716df3 | ||
![]() |
551cbc33cc | ||
![]() |
56e6d790c1 |
@@ -59,6 +59,8 @@ typedef NS_ENUM(NSInteger, HotUpdateType) {
|
|||||||
HotUpdateTypePatchFromPpk = 3,
|
HotUpdateTypePatchFromPpk = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static BOOL ignoreRollback = false;
|
||||||
|
|
||||||
@implementation RCTHotUpdate {
|
@implementation RCTHotUpdate {
|
||||||
RCTHotUpdateManager *_fileManager;
|
RCTHotUpdateManager *_fileManager;
|
||||||
}
|
}
|
||||||
@@ -92,7 +94,7 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
|
|||||||
BOOL isFirstLoadOK = [updateInfo[paramIsFirstLoadOk] boolValue];
|
BOOL isFirstLoadOK = [updateInfo[paramIsFirstLoadOk] boolValue];
|
||||||
|
|
||||||
NSString *loadVersioin = curVersion;
|
NSString *loadVersioin = curVersion;
|
||||||
BOOL needRollback = (isFirstTime == NO && isFirstLoadOK == NO) || loadVersioin.length<=0;
|
BOOL needRollback = (!ignoreRollback && isFirstTime == NO && isFirstLoadOK == NO) || loadVersioin.length<=0;
|
||||||
if (needRollback) {
|
if (needRollback) {
|
||||||
loadVersioin = lastVersion;
|
loadVersioin = lastVersion;
|
||||||
|
|
||||||
@@ -112,7 +114,10 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
|
|||||||
[defaults synchronize];
|
[defaults synchronize];
|
||||||
// ...need clear files later
|
// ...need clear files later
|
||||||
}
|
}
|
||||||
else if (isFirstTime){
|
else if (isFirstTime && !ignoreRollback){
|
||||||
|
// bundleURL may be called many times, ignore rollbacks before process restarted again.
|
||||||
|
ignoreRollback = true;
|
||||||
|
|
||||||
NSMutableDictionary *newInfo = [[NSMutableDictionary alloc] initWithDictionary:updateInfo];
|
NSMutableDictionary *newInfo = [[NSMutableDictionary alloc] initWithDictionary:updateInfo];
|
||||||
newInfo[paramIsFirstTime] = @(NO);
|
newInfo[paramIsFirstTime] = @(NO);
|
||||||
[defaults setObject:newInfo forKey:keyUpdateInfo];
|
[defaults setObject:newInfo forKey:keyUpdateInfo];
|
||||||
|
@@ -110,8 +110,9 @@ async function compileHermesByteCode(bundleName, outputFolder) {
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
if (enableHermes) {
|
if (enableHermes) {
|
||||||
console.log(`Hermes enabled, now compiling to hermes bytecode:\n`);
|
console.log(`Hermes enabled, now compiling to hermes bytecode:\n`);
|
||||||
|
const hermesPath = fs.existsSync('node_modules/hermes-engine') ? 'node_modules/hermes-engine' : 'node_modules/hermesvm';
|
||||||
exec(`
|
exec(`
|
||||||
node_modules/hermesvm/${getHermesOSBin()}/hermes -emit-binary -out ${outputFolder}/${bundleName} ${outputFolder}/${bundleName} -O
|
${hermesPath}/${getHermesOSBin()}/hermes -emit-binary -out ${outputFolder}/${bundleName} ${outputFolder}/${bundleName} -O
|
||||||
echo Compiling done.
|
echo Compiling done.
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
@@ -421,9 +422,9 @@ export const commands = {
|
|||||||
throw new Error('Platform must be specified.');
|
throw new Error('Platform must be specified.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// const { version, major, minor } = getRNVersion();
|
const { version, major, minor } = getRNVersion();
|
||||||
|
|
||||||
// console.log('Bundling with React Native version: ', version);
|
console.log('Bundling with React Native version: ', version);
|
||||||
|
|
||||||
await runReactNativeBundleCommand(bundleName, dev, entryFile, intermediaDir, platform);
|
await runReactNativeBundleCommand(bundleName, dev, entryFile, intermediaDir, platform);
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update",
|
"name": "react-native-update",
|
||||||
"version": "5.2.1",
|
"version": "5.2.4",
|
||||||
"description": "react-native hot update",
|
"description": "react-native hot update",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@@ -18,17 +18,13 @@ Pod::Spec.new do |s|
|
|||||||
s.pod_target_xcconfig = { 'USER_HEADER_SEARCH_PATHS' => '"$(SRCROOT)/../node_modules/react-native-update/ios"' }
|
s.pod_target_xcconfig = { 'USER_HEADER_SEARCH_PATHS' => '"$(SRCROOT)/../node_modules/react-native-update/ios"' }
|
||||||
|
|
||||||
s.dependency 'React'
|
s.dependency 'React'
|
||||||
|
s.dependency 'SSZipArchive'
|
||||||
|
|
||||||
s.subspec 'RCTHotUpdate' do |ss|
|
s.subspec 'RCTHotUpdate' do |ss|
|
||||||
ss.source_files = 'ios/RCTHotUpdate/*.{h,m}'
|
ss.source_files = 'ios/RCTHotUpdate/*.{h,m}'
|
||||||
ss.public_header_files = ['ios/RCTHotUpdate/RCTHotUpdate.h']
|
ss.public_header_files = ['ios/RCTHotUpdate/RCTHotUpdate.h']
|
||||||
end
|
end
|
||||||
|
|
||||||
s.subspec 'SSZipArchive' do |ss|
|
|
||||||
ss.source_files = 'ios/RCTHotUpdate/SSZipArchive/**/*.{h,m,c}'
|
|
||||||
ss.private_header_files = 'ios/RCTHotUpdate/SSZipArchive/**/*.h'
|
|
||||||
end
|
|
||||||
|
|
||||||
s.subspec 'BSDiff' do |ss|
|
s.subspec 'BSDiff' do |ss|
|
||||||
ss.source_files = 'ios/RCTHotUpdate/BSDiff/**/*.{h,m,c}'
|
ss.source_files = 'ios/RCTHotUpdate/BSDiff/**/*.{h,m,c}'
|
||||||
ss.private_header_files = 'ios/RCTHotUpdate/BSDiff/**/*.h'
|
ss.private_header_files = 'ios/RCTHotUpdate/BSDiff/**/*.h'
|
||||||
|
Reference in New Issue
Block a user