@@ -52,7 +52,9 @@ open class ReactNative: NSObject, RCTReloadListener {
5252 DevHelper . setDebugMode ( enabled: AppPreferences . devModeEnabled && AppPreferences . remoteDebuggingEnabled)
5353
5454 showSplashScreen ( )
55-
55+
56+ // Register reload listener to intercept ALL reload triggers (dev menu, programmatic, etc.)
57+ // Only in developer apps or when three-finger gestures are enabled
5658 if mendixApp. isDeveloperApp || mendixApp. enableThreeFingerGestures {
5759 DispatchQueue . main. async {
5860 RCTRegisterReloadCommandListener ( self )
@@ -79,6 +81,10 @@ open class ReactNative: NSObject, RCTReloadListener {
7981 }
8082
8183 // MARK: - Reload Methods
84+
85+ /// Reloads the React Native instance. Always allowed - used for OTA updates.
86+ /// - Note: This is the main entry point for app-triggered reloads (OTA, programmatic).
87+ /// No permission check - OTA updates must work in production apps.
8288 public func reload( ) {
8389 guard let mendixApp = mendixApp else { return }
8490
@@ -93,24 +99,38 @@ open class ReactNative: NSObject, RCTReloadListener {
9399 if response. status == " SUCCESS " , let version = response. runtimeInfo? . version {
94100 MendixBackwardsCompatUtility . update ( version)
95101 }
96- self ? . reloadWithBridge ( )
102+ self ? . triggerReload ( )
97103 }
98104 } else {
99- reloadWithBridge ( )
105+ triggerReload ( )
100106 }
101107 }
102-
103- private func reloadWithBridge( ) {
104- RCTTriggerReloadCommandListeners ( " Reload command from app " )
108+
109+ private func triggerReload( ) {
110+ showSplashScreen ( )
111+ // Note: This bypasses RCTReloadListener notifications (only dev menu Cmd+R triggers those)
112+ ReactHostHelper ( ) . reload ( )
113+ }
114+
115+ private func updateBundleURL( _ url: URL ) {
116+ self . bundleUrl = url
117+ ReactHostHelper ( ) . updateBundleURL ( url)
105118 }
106119
120+ /// Reloads the React Native instance while preserving state.
121+ /// Guarded - only works in developer apps or when three-finger gestures are explicitly enabled.
122+ /// - Note: This is used for gesture-triggered reloads, not OTA updates.
107123 public func reloadWithState( ) {
108124 ReactHostHelper ( ) . reloadClientWithState ( )
109125 }
110126
111127 // MARK: - RCTReloadListener
128+ /// Intercepts ALL reload triggers (dev menu Cmd+R, programmatic, DevTools, etc.)
129+ /// Only called if listener was registered (i.e., isDeveloperApp || enableThreeFingerGestures)
112130 @objc public func didReceiveReloadCommand( ) {
113131 showSplashScreen ( )
132+ // Note: Actual reload is handled by RCTHost automatically
133+ // This callback is just for pre-reload side effects
114134 }
115135
116136 // MARK: - Debugging Methods
0 commit comments