-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kotlinify DevSupportManager interface (#44056)
Summary: Pull Request resolved: #44056 ## Changelog: [Internal] - Was looking into how devsupport is exactly implemented on different platforms (in the context of doing it for a new platform) and figured I may just well convert this to Koltin in the process (helped to understand inner working details as well). Reviewed By: christophpurrer Differential Revision: D56058560 fbshipit-source-id: 1e2ffcec480c5fa3fd8b6494c29a0db6f94aec78
- Loading branch information
1 parent
b15d438
commit 214a1e0
Showing
2 changed files
with
116 additions
and
134 deletions.
There are no files selected for viewing
134 changes: 0 additions & 134 deletions
134
...eactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSupportManager.java
This file was deleted.
Oops, something went wrong.
116 changes: 116 additions & 0 deletions
116
.../ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSupportManager.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.facebook.react.devsupport.interfaces | ||
|
||
import android.app.Activity | ||
import android.util.Pair | ||
import android.view.View | ||
import com.facebook.react.bridge.JSExceptionHandler | ||
import com.facebook.react.bridge.ReactContext | ||
import com.facebook.react.bridge.ReadableArray | ||
import com.facebook.react.common.SurfaceDelegate | ||
import com.facebook.react.modules.debug.interfaces.DeveloperSettings | ||
import java.io.File | ||
|
||
/** | ||
* Interface for accessing and interacting with development features. In dev mode, use the | ||
* implementation [BridgeDevSupportManager]. In production mode, use the dummy implementation | ||
* [ReleaseDevSupportManager]. | ||
*/ | ||
public interface DevSupportManager : JSExceptionHandler { | ||
|
||
public val devSettings: DeveloperSettings? | ||
public val redBoxHandler: RedBoxHandler? | ||
public val sourceMapUrl: String? | ||
public val sourceUrl: String? | ||
public val jSBundleURLForRemoteDebugging: String? | ||
public val downloadedJSBundleFile: String? | ||
public val lastErrorTitle: String? | ||
public val lastErrorStack: Array<StackFrame>? | ||
public val lastErrorType: ErrorType? | ||
public val lastErrorCookie: Int | ||
public val currentActivity: Activity? | ||
|
||
public var devSupportEnabled: Boolean | ||
|
||
public fun showNewJavaError(message: String?, e: Throwable?) | ||
|
||
public fun addCustomDevOption(optionName: String?, optionHandler: DevOptionHandler?) | ||
|
||
public fun createRootView(appKey: String?): View? | ||
|
||
public fun destroyRootView(rootView: View?) | ||
|
||
public fun showNewJSError(message: String?, details: ReadableArray?, errorCookie: Int) | ||
|
||
public fun updateJSError(message: String?, details: ReadableArray?, errorCookie: Int) | ||
|
||
public fun hideRedboxDialog() | ||
|
||
public fun showDevOptionsDialog() | ||
|
||
public fun startInspector() | ||
|
||
public fun stopInspector() | ||
|
||
public fun onNewReactContextCreated(reactContext: ReactContext?) | ||
|
||
public fun onReactInstanceDestroyed(reactContext: ReactContext?) | ||
|
||
public fun hasUpToDateJSBundleInCache(): Boolean | ||
|
||
public fun reloadSettings() | ||
|
||
public fun handleReloadJS() | ||
|
||
public fun reloadJSFromServer(bundleURL: String) | ||
|
||
public fun reloadJSFromServer(bundleURL: String, callback: BundleLoadCallback) | ||
|
||
public fun loadSplitBundleFromServer(bundlePath: String, callback: DevSplitBundleCallback) | ||
|
||
public fun isPackagerRunning(callback: PackagerStatusCallback) | ||
|
||
public fun setHotModuleReplacementEnabled(isHotModuleReplacementEnabled: Boolean) | ||
|
||
public fun setRemoteJSDebugEnabled(isRemoteJSDebugEnabled: Boolean) | ||
|
||
public fun setFpsDebugEnabled(isFpsDebugEnabled: Boolean) | ||
|
||
public fun toggleElementInspector() | ||
|
||
public fun downloadBundleResourceFromUrlSync(resourceURL: String, outputFile: File?): File? | ||
|
||
public fun registerErrorCustomizer(errorCustomizer: ErrorCustomizer?) | ||
|
||
public fun processErrorCustomizers( | ||
errorInfo: Pair<String, Array<StackFrame>>? | ||
): Pair<String, Array<StackFrame>>? | ||
|
||
public fun setPackagerLocationCustomizer(packagerLocationCustomizer: PackagerLocationCustomizer?) | ||
|
||
/** | ||
* Create the surface delegate that the provided module should use to interact with | ||
* | ||
* @param moduleName the module name that helps decide which surface it should interact with | ||
* @return a [SurfaceDelegate] instance | ||
*/ | ||
public fun createSurfaceDelegate(moduleName: String?): SurfaceDelegate? | ||
|
||
/** Attempt to open the JS debugger on the host machine. */ | ||
public fun openDebugger() | ||
|
||
/** | ||
* The PackagerLocationCustomizer allows you to have a dynamic packager location that is | ||
* determined right before loading the packager. Your customizer must call |callback|, as loading | ||
* will be blocked waiting for it to resolve. | ||
*/ | ||
public fun interface PackagerLocationCustomizer { | ||
public fun run(callback: Runnable?) | ||
} | ||
} |