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.
Fix fetching sourcemap in genymotion. Fixes facebook#5338
Summary:Source maps are broken on Genymotion right now as they aren't being loaded from the correct URL. refer - facebook#5338 (comment) **Test plan** Build and install UIExplorer from master branch in genymotion and enable hot reload. When you change a file and save it, you'll see a Yellow box due to source map fetching failed, as per the referenced comment. Doing the same for this branch doesn't produce any yellow boxes. Closes facebook#6594 Differential Revision: D3088218 Pulled By: martinbigio fb-gh-sync-id: 0d1c19cc263de5c6c62061c399eef33fa4ac4a7b shipit-source-id: 0d1c19cc263de5c6c62061c399eef33fa4ac4a7b
- Loading branch information
Showing
6 changed files
with
68 additions
and
40 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
33 changes: 33 additions & 0 deletions
33
ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoHelpers.java
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,33 @@ | ||
package com.facebook.react.modules.systeminfo; | ||
|
||
import android.os.Build; | ||
|
||
public class AndroidInfoHelpers { | ||
|
||
public static final String EMULATOR_LOCALHOST = "10.0.2.2:8081"; | ||
public static final String GENYMOTION_LOCALHOST = "10.0.3.2:8081"; | ||
public static final String DEVICE_LOCALHOST = "localhost:8081"; | ||
|
||
private static boolean isRunningOnGenymotion() { | ||
return Build.FINGERPRINT.contains("vbox"); | ||
} | ||
|
||
private static boolean isRunningOnStockEmulator() { | ||
return Build.FINGERPRINT.contains("generic"); | ||
} | ||
|
||
public static String getServerHost() { | ||
// Since genymotion runs in vbox it use different hostname to refer to adb host. | ||
// We detect whether app runs on genymotion and replace js bundle server hostname accordingly | ||
|
||
if (isRunningOnGenymotion()) { | ||
return GENYMOTION_LOCALHOST; | ||
} | ||
|
||
if (isRunningOnStockEmulator()) { | ||
return EMULATOR_LOCALHOST; | ||
} | ||
|
||
return DEVICE_LOCALHOST; | ||
} | ||
} |
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