react-native-bspatch 3.1.2 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +3 -3
  2. package/android/build.gradle +18 -40
  3. package/android/src/main/java/vn/reactnativebspatch/BsPatchModule.kt +148 -13
  4. package/android/src/main/java/vn/reactnativebspatch/OtaBundleResolver.kt +21 -3
  5. package/cpp/CMakeLists.txt +0 -3
  6. package/cpp/bsdiff/bspatch_wrapper.c +3 -2
  7. package/ios/OtaBundleResolver.swift +22 -5
  8. package/ios/RNBsPatch.mm +220 -32
  9. package/lib/commonjs/NativeBsPatch.js.map +1 -1
  10. package/lib/commonjs/index.js +1 -13
  11. package/lib/commonjs/index.js.map +1 -1
  12. package/lib/commonjs/ota/OtaProvider.js +21 -21
  13. package/lib/commonjs/ota/OtaProvider.js.map +1 -1
  14. package/lib/commonjs/ota/otaCore.js +50 -88
  15. package/lib/commonjs/ota/otaCore.js.map +1 -1
  16. package/lib/commonjs/ota/otaMetadata.js +46 -23
  17. package/lib/commonjs/ota/otaMetadata.js.map +1 -1
  18. package/lib/commonjs/ota/storage/GitHubRawStorage.js +22 -12
  19. package/lib/commonjs/ota/storage/GitHubRawStorage.js.map +1 -1
  20. package/lib/module/NativeBsPatch.js.map +1 -1
  21. package/lib/module/index.js +0 -8
  22. package/lib/module/index.js.map +1 -1
  23. package/lib/module/ota/OtaProvider.js +22 -22
  24. package/lib/module/ota/OtaProvider.js.map +1 -1
  25. package/lib/module/ota/otaCore.js +50 -87
  26. package/lib/module/ota/otaCore.js.map +1 -1
  27. package/lib/module/ota/otaMetadata.js +44 -21
  28. package/lib/module/ota/otaMetadata.js.map +1 -1
  29. package/lib/module/ota/storage/GitHubRawStorage.js +20 -10
  30. package/lib/module/ota/storage/GitHubRawStorage.js.map +1 -1
  31. package/lib/typescript/NativeBsPatch.d.ts +36 -1
  32. package/lib/typescript/NativeBsPatch.d.ts.map +1 -1
  33. package/lib/typescript/index.d.ts +0 -7
  34. package/lib/typescript/index.d.ts.map +1 -1
  35. package/lib/typescript/ota/OtaProvider.d.ts.map +1 -1
  36. package/lib/typescript/ota/otaCore.d.ts +2 -1
  37. package/lib/typescript/ota/otaCore.d.ts.map +1 -1
  38. package/lib/typescript/ota/otaMetadata.d.ts +5 -0
  39. package/lib/typescript/ota/otaMetadata.d.ts.map +1 -1
  40. package/lib/typescript/ota/storage/GitHubRawStorage.d.ts +2 -0
  41. package/lib/typescript/ota/storage/GitHubRawStorage.d.ts.map +1 -1
  42. package/package.json +2 -3
  43. package/react-native-bspatch.podspec +3 -25
  44. package/src/NativeBsPatch.ts +44 -1
  45. package/src/index.ts +0 -7
  46. package/src/ota/OtaProvider.tsx +37 -23
  47. package/src/ota/otaCore.ts +55 -94
  48. package/src/ota/otaMetadata.ts +44 -25
  49. package/src/ota/storage/GitHubRawStorage.ts +17 -22
  50. package/tools/build_ota.sh +18 -4
  51. package/tools/upload_ota.sh +3 -2
  52. package/ios/RNBsPatch.h +0 -8
@@ -239,6 +239,20 @@ step_done() {
239
239
  step_line "$1 ${DIM}· $((SECONDS - STEP_START))s${RESET}"; printf "\n"
240
240
  }
241
241
  step_fail() { if [ -t 1 ]; then printf "\n"; fi; } # leave the step line before error output
242
+ # run_logged LOG cmd… — run cmd with output to LOG; in a terminal, tick elapsed time + the log's last line
243
+ run_logged() {
244
+ local LOG="$1"; shift
245
+ "$@" > "$LOG" 2>&1 &
246
+ local PID=$!
247
+ if [ -t 1 ]; then
248
+ while kill -0 "$PID" 2>/dev/null; do
249
+ local LAST=$(tail -n 1 "$LOG" 2>/dev/null | tr -d '\r\033' | cut -c1-50)
250
+ step_progress "$((SECONDS - STEP_START))s${LAST:+ · $LAST}"
251
+ sleep 1
252
+ done
253
+ fi
254
+ wait "$PID"
255
+ }
242
256
  export -f human_size file_size
243
257
 
244
258
  # ── Release version (native app version the OTA targets) ─────────────────────
@@ -320,7 +334,7 @@ if [ "$ACTION" = "reset" ]; then
320
334
  fi
321
335
 
322
336
  # ── Ensure bsdiff compiled ───────────────────────────────────────────────────
323
- if [ ! -f "$BSDIFF" ]; then
337
+ if [ ! -f "$BSDIFF" ] || [ "$SCRIPT_DIR/bsdiff.c" -nt "$BSDIFF" ]; then
324
338
  clang -O2 -D BSDIFF_EXECUTABLE -o "$BSDIFF" "$SCRIPT_DIR/bsdiff.c" -lbz2
325
339
  info bsdiff "compiled"
326
340
  fi
@@ -369,14 +383,14 @@ build_platform() {
369
383
  if [ "$PLATFORM" == "android" ]; then
370
384
  step "Bundle JS"
371
385
  # Gradle's config noise goes to a log; shown only on failure
372
- if ! (cd "$ROOT/android" && ./gradlew ":app:createBundle${FLAVOR_CAP}ReleaseJsAndAssets" -Pkotlin.incremental=false --quiet) > "$BUILD_LOG" 2>&1; then
386
+ if ! run_logged "$BUILD_LOG" bash -c 'cd "$1/android" && ./gradlew ":app:createBundle${2}ReleaseJsAndAssets" -Pkotlin.incremental=false --quiet' _ "$ROOT" "$FLAVOR_CAP"; then
373
387
  step_fail; tail -n 40 "$BUILD_LOG"; echo " ❌ Gradle bundle failed (full log: $BUILD_LOG)"; exit 1
374
388
  fi
375
389
  BUNDLE_SOURCE="$ROOT/android/app/build/generated/assets/react/${FLAVOR_LOWER}Release/index.android.bundle"
376
390
  else
377
391
  step "Bundle JS"
378
- if ! npx react-native bundle --platform ios --dev false --entry-file index.js \
379
- --bundle-output "$WORKSPACE/source.bundle" --assets-dest "$OUTPUT/assets" > "$BUILD_LOG" 2>&1; then
392
+ if ! run_logged "$BUILD_LOG" npx react-native bundle --platform ios --dev false --entry-file index.js \
393
+ --bundle-output "$WORKSPACE/source.bundle" --assets-dest "$OUTPUT/assets"; then
380
394
  step_fail; tail -n 40 "$BUILD_LOG"; echo " ❌ Bundle failed (full log: $BUILD_LOG)"; exit 1
381
395
  fi
382
396
  BUNDLE_SOURCE="$WORKSPACE/source.bundle"
@@ -207,8 +207,9 @@ fi
207
207
 
208
208
  # 3. Commit and Push to GitHub
209
209
  cd "$GH_REPO_DIR"
210
- git config user.name "hungbv-taureau" 2>/dev/null || true
211
- git config user.email "hungbv@taureau.ai" 2>/dev/null || true
210
+ # Fallback identity only where none is configured (e.g. CI); never override the user's
211
+ git config user.name >/dev/null || git config user.name "react-native-bspatch"
212
+ git config user.email >/dev/null || git config user.email "react-native-bspatch@users.noreply.github.com"
212
213
  git add .
213
214
  if git diff --staged --quiet; then
214
215
  echo " ✓ Storage repository is up to date (no changes)."
package/ios/RNBsPatch.h DELETED
@@ -1,8 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import <React/RCTBridgeModule.h>
3
-
4
- @interface RNBsPatch : NSObject <RCTBridgeModule>
5
-
6
- - (void)markAsHealthy;
7
-
8
- @end