1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-18 03:06:10 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Compare commits

..

4 Commits

Author SHA1 Message Date
sunnylqm
10cb072fc3 improve errorUpdate message 2025-02-26 20:40:10 +08:00
sunnylqm
a432e5f1b1 Bump package version to 10.25.2 and improve linking event listener removal 2025-02-26 12:53:40 +08:00
sunnylqm
23d1fcd4d1 Bump package version to 10.25.1 2025-02-26 12:50:18 +08:00
sunnylqm
e3a748065a Fix linking event listener removal for legacy compatibility 2025-02-26 12:48:26 +08:00
7 changed files with 43 additions and 30 deletions

View File

@@ -12,7 +12,7 @@
"react-native-paper": "^5.13.1",
"react-native-safe-area-context": "^5.2.0",
"react-native-svg": "^15.11.1",
"react-native-update": "^10.24.2",
"react-native-update": "^10.25.2",
"react-native-vector-icons": "^10.2.0",
},
"devDependencies": {
@@ -1434,7 +1434,7 @@
"react-native-svg": ["react-native-svg@15.11.1", "", { "dependencies": { "css-select": "^5.1.0", "css-tree": "^1.1.3", "warn-once": "0.1.1" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-Qmwx/yJKt+AHUr4zjxx/Q69qwKtRfr1+uIfFMQoq3WFRhqU76aL9db1DyvPiY632DAsVGba1pHf92OZPkpjrdQ=="],
"react-native-update": ["react-native-update@10.24.2", "", { "dependencies": { "nanoid": "^3.3.3", "react-native-url-polyfill": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-native": ">=0.59.0" } }, "sha512-pMnAFWApyZkTFKJliENcKVl3wSjOH/e0mEaYjYodWjpmHGZVET/J/nZ46Q03/JRtXcVnYkaq//y3axMfgHC21g=="],
"react-native-update": ["react-native-update@10.25.2", "", { "dependencies": { "nanoid": "^3.3.3", "react-native-url-polyfill": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-native": ">=0.59.0" } }, "sha512-HI44TvCdkwXDbIzMKIcz4BK1my+dQYZz3GbiJJiv5/9Sqfl/uiLSr/Z9xUjX4O7G28N206KItORj7YK6yt/66w=="],
"react-native-url-polyfill": ["react-native-url-polyfill@2.0.0", "", { "dependencies": { "whatwg-url-without-unicode": "8.0.0-3" }, "peerDependencies": { "react-native": "*" } }, "sha512-My330Do7/DvKnEvwQc0WdcBnFPploYKp9CYlefDXzIdEaA+PAhDYllkvGeEroEzvc4Kzzj2O4yVdz8v6fjRvhA=="],

View File

@@ -1308,7 +1308,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-update (10.24.2):
- react-native-update (10.25.0):
- DoubleConversion
- glog
- hermes-engine
@@ -1322,8 +1322,8 @@ PODS:
- React-featureflags
- React-graphics
- React-ImageManager
- react-native-update/HDiffPatch (= 10.24.2)
- react-native-update/RCTPushy (= 10.24.2)
- react-native-update/HDiffPatch (= 10.25.0)
- react-native-update/RCTPushy (= 10.25.0)
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
@@ -1333,7 +1333,7 @@ PODS:
- ReactCommon/turbomodule/core
- SSZipArchive
- Yoga
- react-native-update/HDiffPatch (10.24.2):
- react-native-update/HDiffPatch (10.25.0):
- DoubleConversion
- glog
- hermes-engine
@@ -1356,7 +1356,7 @@ PODS:
- ReactCommon/turbomodule/core
- SSZipArchive
- Yoga
- react-native-update/RCTPushy (10.24.2):
- react-native-update/RCTPushy (10.25.0):
- DoubleConversion
- glog
- hermes-engine
@@ -1988,7 +1988,7 @@ SPEC CHECKSUMS:
React-Mapbuffer: a381120aea722d2244d4e4b663a10d4c3b2d4e51
React-microtasksnativemodule: d9b946675010659cddd1c7611c074216579c8ad3
react-native-safe-area-context: 5e53e2b0fc3a2994ad0c89a2486e545b6566d8c4
react-native-update: f3a3a5e028f0513f9350be61abf5c0135574b201
react-native-update: 7fd014ef3cd16406bc20284bfb40f9eb0c2ecc8e
React-nativeconfig: 67fa7a63ea288cb5b1d0dd2deaf240405fec164f
React-NativeModulesApple: 34b7a4d7441a4ee78d18109ff107c1ccf7c074a9
React-perflogger: d1149037ac466ad2141d4ae541ca16cb73b2343b

View File

@@ -23,7 +23,7 @@
"react-native-paper": "^5.13.1",
"react-native-safe-area-context": "^5.2.0",
"react-native-svg": "^15.11.1",
"react-native-update": "^10.24.2",
"react-native-update": "^10.25.2",
"react-native-vector-icons": "^10.2.0"
},
"devDependencies": {

View File

@@ -49,7 +49,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
private void removeDirectory(File file) throws IOException {
if (UpdateContext.DEBUG) {
Log.d("RNUpdate", "Removing " + file);
Log.d("react-native-update", "Removing " + file);
}
if (file.isDirectory()) {
File[] files = file.listFiles();
@@ -88,7 +88,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
BufferedSink sink = Okio.buffer(Okio.sink(writePath));
if (UpdateContext.DEBUG) {
Log.d("RNUpdate", "Downloading " + url);
Log.d("react-native-update", "Downloading " + url);
}
long bytesRead = 0;
@@ -98,7 +98,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
received += bytesRead;
sink.emit();
if (UpdateContext.DEBUG) {
Log.d("RNUpdate", "Progress " + received + "/" + contentLength);
Log.d("react-native-update", "Progress " + received + "/" + contentLength);
}
int percentage = (int)(received * 100.0 / contentLength + 0.5);
@@ -115,7 +115,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
sink.close();
if (UpdateContext.DEBUG) {
Log.d("RNUpdate", "Download finished");
Log.d("react-native-update", "Download finished");
}
}
@@ -244,7 +244,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
if (UpdateContext.DEBUG) {
Log.d("RNUpdate", "Unzip finished");
Log.d("react-native-update", "Unzip finished");
}
}
@@ -260,7 +260,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
File lastTarget = null;
for (File target: targets) {
if (UpdateContext.DEBUG) {
Log.d("RNUpdate", "Copying from resource " + fn + " to " + target);
Log.d("react-native-update", "Copying from resource " + fn + " to " + target);
}
if (lastTarget != null) {
copyFile(lastTarget, target);
@@ -352,7 +352,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
copyFromResource(copyList);
if (UpdateContext.DEBUG) {
Log.d("RNUpdate", "Unzip finished");
Log.d("react-native-update", "Unzip finished");
}
}
@@ -418,12 +418,12 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
throw new Error("bundle patch not found");
}
if (UpdateContext.DEBUG) {
Log.d("RNUpdate", "Unzip finished");
Log.d("react-native-update", "Unzip finished");
}
}
private void doCleanUp(DownloadTaskParams param) throws IOException {
if (UpdateContext.DEBUG) {
Log.d("RNUpdate", "Start cleaning up");
Log.d("react-native-update", "Start cleaning up");
}
File root = param.unzipDirectory;
for (File sub : root.listFiles()) {
@@ -499,7 +499,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
default:
break;
}
Log.e("pushy", "download task failed", e);
Log.e("react-native-update", "download task failed", e);
if (params[0].listener != null) {
params[0].listener.onDownloadFailed(e);

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "10.25.0",
"version": "10.25.3",
"description": "react-native hot update",
"main": "src/index",
"scripts": {

View File

@@ -361,6 +361,7 @@ export class Pushy {
let succeeded = '';
this.report({ type: 'downloading' });
let lastError: any;
let errorMessages: string[] = [];
const diffUrl = await testUrls(joinUrls(paths, diff));
if (diffUrl) {
log('downloading diff');
@@ -372,11 +373,13 @@ export class Pushy {
});
succeeded = 'diff';
} catch (e: any) {
lastError = e;
const errorMessage = `diff error: ${e.message}`;
errorMessages.push(errorMessage);
lastError = new Error(errorMessage);
if (__DEV__) {
succeeded = 'diff';
} else {
log(`diff error: ${e.message}, try pdiff`);
log(errorMessage);
}
}
}
@@ -390,11 +393,13 @@ export class Pushy {
});
succeeded = 'pdiff';
} catch (e: any) {
lastError = e;
const errorMessage = `pdiff error: ${e.message}`;
errorMessages.push(errorMessage);
lastError = new Error(errorMessage);
if (__DEV__) {
succeeded = 'pdiff';
} else {
log(`pdiff error: ${e.message}, try full patch`);
log(errorMessage);
}
}
}
@@ -408,11 +413,13 @@ export class Pushy {
});
succeeded = 'full';
} catch (e: any) {
lastError = e;
const errorMessage = `full patch error: ${e.message}`;
errorMessages.push(errorMessage);
lastError = new Error(errorMessage);
if (__DEV__) {
succeeded = 'full';
} else {
log(`full patch error: ${e.message}`);
log(errorMessage);
}
}
}
@@ -427,6 +434,7 @@ export class Pushy {
this.report({
type: 'errorUpdate',
data: { newVersion: hash },
message: errorMessages.join(';'),
});
if (lastError) {
throw lastError;

View File

@@ -325,11 +325,16 @@ export const UpdateProvider = ({
};
Linking.getInitialURL().then(parseLinking);
const linkingListener = Linking.addEventListener('url', ({ url }) =>
parseLinking(url),
);
const linkingHandler = ({ url }: { url: string }) => {
parseLinking(url);
};
const linkingListener = Linking.addEventListener('url', linkingHandler);
return () => {
linkingListener.remove();
if ('removeEventListener' in Linking) {
(Linking as any).removeEventListener('url', linkingHandler);
} else {
linkingListener.remove();
}
};
}, [parseTestPayload]);