feat(bundle-update): add resetToBuiltInBundle API and bump to 1.1.37#33
feat(bundle-update): add resetToBuiltInBundle API and bump to 1.1.37#33huhuanming wants to merge 2 commits intomainfrom
Conversation
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>
| OneKeyLog.info("BundleUpdate", "resetToBuiltInBundle: clearing currentBundleVersion preference...") | ||
| let ud = UserDefaults.standard | ||
| if let cbv = ud.string(forKey: "currentBundleVersion") { | ||
| ud.removeObject(forKey: cbv) |
There was a problem hiding this comment.
🔴 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.
| ud.removeObject(forKey: cbv) | |
| ud.removeObject(forKey: "currentBundleVersion") |
Was this helpful? React with 👍 or 👎 to provide feedback.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
resetToBuiltInBundle()API to react-native-bundle-update that clears thecurrentBundleVersionpreference, allowing the app to revert to the built-in JS bundle on next restartTest plan
resetToBuiltInBundle()clears the bundle preference on AndroidresetToBuiltInBundle()clears the bundle preference on iOSresetToBuiltInBundle()and restarting🤖 Generated with Claude Code