forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert interfaces inside devsupport/interfaces to Kotlin
Summary: ## 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). Differential Revision: D56052137
- Loading branch information
1 parent
78d523d
commit da74521
Showing
12 changed files
with
113 additions
and
120 deletions.
There are no files selected for viewing
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
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
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
22 changes: 0 additions & 22 deletions
22
...ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevOptionHandler.java
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
...e/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevOptionHandler.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,21 @@ | ||
/* | ||
* 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 | ||
|
||
/** | ||
* Callback class for custom options that may appear in [DevSupportManager] developer options menu. | ||
* In case when option registered for this handler is selected from the menu, the instance method | ||
* [.onOptionSelected] will be triggered. | ||
*/ | ||
public fun interface DevOptionHandler { | ||
/** | ||
* Triggered in case when user select custom developer option from the developers options menu | ||
* displayed with [DevSupportManager]. | ||
*/ | ||
public fun onOptionSelected() | ||
} |
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
20 changes: 0 additions & 20 deletions
20
.../ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/ErrorCustomizer.java
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
...ve/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/ErrorCustomizer.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,21 @@ | ||
/* | ||
* 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.util.Pair | ||
|
||
/** Interface that lets parts of the app process the errors before showing the redbox */ | ||
public fun interface ErrorCustomizer { | ||
/** | ||
* The function that need to be registered using [DevSupportManager].registerErrorCustomizer and | ||
* is called before passing the error to the RedBox. | ||
*/ | ||
public fun customizeErrorInfo( | ||
errorInfo: Pair<String?, Array<StackFrame?>?>? | ||
): Pair<String?, Array<StackFrame?>?>? | ||
} |
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
40 changes: 0 additions & 40 deletions
40
...ve/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/RedBoxHandler.java
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
...tive/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/RedBoxHandler.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,40 @@ | ||
/* | ||
* 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.content.Context | ||
import android.text.SpannedString | ||
|
||
/** | ||
* Interface used by [BridgeDevSupportManager] to allow interception on any redboxes during | ||
* development and handling the information from the redbox. The implementation should be passed by | ||
* setRedBoxHandler in ReactInstanceManager. | ||
*/ | ||
public interface RedBoxHandler { | ||
/** Callback interface for [.reportRedbox]. */ | ||
public interface ReportCompletedListener { | ||
public fun onReportSuccess(spannedString: SpannedString?) | ||
|
||
public fun onReportError(spannedString: SpannedString?) | ||
} | ||
|
||
/** Handle the information from the redbox. */ | ||
public fun handleRedbox(title: String?, stack: Array<StackFrame?>?, errorType: ErrorType?) | ||
|
||
/** Whether the report feature is enabled. */ | ||
public fun isReportEnabled(): Boolean | ||
|
||
/** Report the information from the redbox and set up a callback listener. */ | ||
public fun reportRedbox( | ||
context: Context?, | ||
title: String?, | ||
stack: Array<StackFrame?>?, | ||
sourceUrl: String?, | ||
reportCompletedListener: ReportCompletedListener? | ||
) | ||
} |
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