feat: host the server-delivered mobile core (JS brain) in JavaScriptCore with native fallback - #55
Draft
pandeymangg wants to merge 1 commit into
Conversation
…ore with native fallback
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Ref ENG-2900
What & why
Was: The survey display decision (display types, recontact days, segments, display percentage, language resolution) is compiled into the SDK; changing it requires an SDK release plus a customer app store release.
Now:
setup()fetches a small JS bundle from the Formbricks server (/js/mobile/v1/core.umd.cjs), hosts it in JavaScriptCore, andtrack()asks it which survey to show. Any failure — no bundle, wrong protocol version, evaluation error — falls back to the untouched native logic, so behaviour without a bundle is identical to today.First iOS PR of the JS-brain epic (targets
epic/js-brain, not main). Server side: formbricks/formbricks#9152.Where to look
Sources/FormbricksSDK/MobileCore/MobileCoreRuntime.swift— JSContext host, serial-queue confined, protocol-version gateSources/FormbricksSDK/MobileCore/MobileCoreLoader.swift— fetch + per-host cache, offline fallbackSources/FormbricksSDK/Manager/SurveyManager.swift— brain-firsttrack(), native path unchanged as fallbackTesting
MobileCoreRuntimeTests(init validation, protocol rejection, state pass-through across the bridge, brain-throws fallback) run against real JavaScriptCore.Draft — remaining scope for ENG-2900
FormbricksConfig(disable remote code for enterprise policies).Note
AI model used —
claude-fable-5, reasoning effortunknown.