Remove NOT_RESTORED guard#53
Conversation
Security Checklist
Dependency update detected!
|
There was a problem hiding this comment.
Pull request overview
This PR removes the managerRestored guard from the getButtons method to fix a regression where the method incorrectly rejected with NOT_RESTORED during normal first-run usage. The change restores compatibility with the original Objective-C implementation by allowing getButtons to return the current button list (even if empty) as soon as FLICManager is configured, without requiring the state restoration callback that only fires in specific iOS scenarios.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
This change removes the
managerRestoredguard fromgetButtonsso that it no longer rejects withNOT_RESTOREDand instead always returns the current list of buttons onceFLICManageris configured. In the old Objective‑C implementation,getButtonssimply readFLICManager.sharedManager.buttons(possibly empty) without depending onmanagerDidRestoreState, which is only invoked during iOS state restoration and not on a fresh launch. By introducingmanagerRestoredas a hard precondition, the new TurboModule implementation causedgetButtonsto fail withNOT_RESTOREDon normal first‑run usage, even though the manager was initialized correctly. AligninggetButtonswith the old behavior fixes that regression while still keeping theNOT_INITIALIZEDguard and leavingmanagerDidRestoreStatefor logging and event emission only.Note
getButtonsno longer requires manager restore; manager state events are more consistent, JS marks initialized on restored; version bumped to beta.19.ios/Flic2.mm)getButtons: removemanagerRestoredprecondition so it always returns current buttons when manager is configured.restoredonly once and includestate/stateName.stateChanged; also emitrestoredwhen powered on if not previously restored.src/index.ts)managerStateChangewithevent==='restored', mark manager as initialized.2.0.0-beta.19.Written by Cursor Bugbot for commit e7431b6. This will update automatically on new commits. Configure here.