Skip to content

feat(bundle-update): add resetToBuiltInBundle API and bump to 1.1.37#33

Open
huhuanming wants to merge 2 commits intomainfrom
feat/reset-to-builtin-bundle
Open

feat(bundle-update): add resetToBuiltInBundle API and bump to 1.1.37#33
huhuanming wants to merge 2 commits intomainfrom
feat/reset-to-builtin-bundle

Conversation

@huhuanming
Copy link
Contributor

@huhuanming huhuanming commented Mar 12, 2026

Summary

  • Add resetToBuiltInBundle() API to react-native-bundle-update that clears the currentBundleVersion preference, allowing the app to revert to the built-in JS bundle on next restart
  • Implemented on both Android (SharedPreferences) and iOS (UserDefaults) with nitrogen bindings
  • Bump all packages version from 1.1.36 to 1.1.37

Test plan

  • Verify resetToBuiltInBundle() clears the bundle preference on Android
  • Verify resetToBuiltInBundle() clears the bundle preference on iOS
  • Verify app loads built-in bundle after calling resetToBuiltInBundle() and restarting

🤖 Generated with Claude Code


Open with Devin

Add resetToBuiltInBundle() method to clear currentBundleVersion preference,
allowing the app to revert to the built-in JS bundle on next restart.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

OneKeyLog.info("BundleUpdate", "resetToBuiltInBundle: clearing currentBundleVersion preference...")
let ud = UserDefaults.standard
if let cbv = ud.string(forKey: "currentBundleVersion") {
ud.removeObject(forKey: cbv)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 iOS resetToBuiltInBundle() erroneously removes unrelated UserDefaults entry keyed by bundle version string

In the iOS resetToBuiltInBundle() implementation, line 1037 calls ud.removeObject(forKey: cbv) where cbv is the value of currentBundleVersion (e.g., "1.0.0-100"). This removes an unrelated UserDefaults entry that was used for legacy signature storage. This line was copy-pasted from clearAllJSBundleData() (ReactNativeBundleUpdate.swift:1058) where it makes sense because that function clears ALL data. However, resetToBuiltInBundle() should only clear the currentBundleVersion preference. The Android implementation at ReactNativeBundleUpdate.kt:1076 confirms this — it only removes "currentBundleVersion" and does not touch any other keys. This extra removal could delete legacy signature data that should be preserved, since the user may want to switch back to that bundle version later via setCurrentUpdateBundleData.

Suggested change
ud.removeObject(forKey: cbv)
ud.removeObject(forKey: "currentBundleVersion")
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant