mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-07 17:25:13 +08:00
Add download duration and error reporting to Pushy class
This commit is contained in:
@@ -353,6 +353,7 @@ export class Pushy {
|
|||||||
if (Pushy.progressHandlers[hash]) {
|
if (Pushy.progressHandlers[hash]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const patchStartTime = Date.now();
|
||||||
if (onDownloadProgress) {
|
if (onDownloadProgress) {
|
||||||
// @ts-expect-error harmony not in existing platforms
|
// @ts-expect-error harmony not in existing platforms
|
||||||
if (Platform.OS === 'harmony') {
|
if (Platform.OS === 'harmony') {
|
||||||
@@ -458,9 +459,18 @@ export class Pushy {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
const duration = Date.now() - patchStartTime;
|
||||||
|
const data: Record<string, any> = {
|
||||||
|
newVersion: hash,
|
||||||
|
diff: succeeded,
|
||||||
|
duration,
|
||||||
|
};
|
||||||
|
if (errorMessages.length > 0) {
|
||||||
|
data.error = errorMessages.join(';');
|
||||||
|
}
|
||||||
this.report({
|
this.report({
|
||||||
type: 'downloadSuccess',
|
type: 'downloadSuccess',
|
||||||
data: { newVersion: hash, diff: succeeded },
|
data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
log(`downloaded ${succeeded} hash:`, hash);
|
log(`downloaded ${succeeded} hash:`, hash);
|
||||||
|
Reference in New Issue
Block a user