[RN] Fix remote JS debugging
This commit is contained in:
parent
acd83ede2f
commit
aef6e33c91
|
@ -43,7 +43,6 @@ export function appNavigate(uri) {
|
||||||
domain
|
domain
|
||||||
= _parseURIString(state['features/app'].app._getDefaultURL())
|
= _parseURIString(state['features/app'].app._getDefaultURL())
|
||||||
.domain;
|
.domain;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Kostiantyn Tsaregradskyi: We should probably detect if user is
|
// TODO Kostiantyn Tsaregradskyi: We should probably detect if user is
|
||||||
|
|
|
@ -125,6 +125,21 @@ export class AbstractApp extends Component {
|
||||||
dispatch(appWillUnmount(this));
|
dispatch(appWillUnmount(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a Location object from the window with information about the current
|
||||||
|
* location of the document. Explicitly defined to allow extenders to
|
||||||
|
* override because React Native does not usually have a location property
|
||||||
|
* on its window unless debugging remotely in which case the browser that is
|
||||||
|
* the remote debugger will provide a location property on the window.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @returns {Location} A Location object with information about the current
|
||||||
|
* location of the document.
|
||||||
|
*/
|
||||||
|
getWindowLocation() {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements React's {@link Component#render()}.
|
* Implements React's {@link Component#render()}.
|
||||||
*
|
*
|
||||||
|
@ -226,7 +241,7 @@ export class AbstractApp extends Component {
|
||||||
// If the execution environment provides a Location abstraction, then
|
// If the execution environment provides a Location abstraction, then
|
||||||
// this App at already at that location but it must be made aware of the
|
// this App at already at that location but it must be made aware of the
|
||||||
// fact.
|
// fact.
|
||||||
const windowLocation = this._getWindowLocation();
|
const windowLocation = this.getWindowLocation();
|
||||||
|
|
||||||
if (windowLocation) {
|
if (windowLocation) {
|
||||||
const href = windowLocation.toString();
|
const href = windowLocation.toString();
|
||||||
|
@ -272,21 +287,6 @@ export class AbstractApp extends Component {
|
||||||
return store;
|
return store;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a Location object from the window with information about the current
|
|
||||||
* location of the document. Explicitly defined to allow extenders to
|
|
||||||
* override because React Native does not usually have a location property
|
|
||||||
* on its window unless debugging remotely in which case the browser that is
|
|
||||||
* the remote debugger will provide a location property on the window.
|
|
||||||
*
|
|
||||||
* @protected
|
|
||||||
* @returns {Location} A Location object with information about the current
|
|
||||||
* location of the document.
|
|
||||||
*/
|
|
||||||
_getWindowLocation() {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Redux store to be used by this AbstractApp if such as store is
|
* Creates a Redux store to be used by this AbstractApp if such as store is
|
||||||
* not defined by the consumer of this AbstractApp through its
|
* not defined by the consumer of this AbstractApp through its
|
||||||
|
|
|
@ -52,7 +52,7 @@ export class App extends AbstractApp {
|
||||||
*
|
*
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
_getWindowLocation() {
|
getWindowLocation() {
|
||||||
return window.location;
|
return window.location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ export class App extends AbstractApp {
|
||||||
* @returns {string} The context root of window.location i.e. this Web App.
|
* @returns {string} The context root of window.location i.e. this Web App.
|
||||||
*/
|
*/
|
||||||
_getWindowLocationContextRoot() {
|
_getWindowLocationContextRoot() {
|
||||||
const pathname = this._getWindowLocation().pathname;
|
const pathname = this.getWindowLocation().pathname;
|
||||||
const contextRootEndIndex = pathname.lastIndexOf('/');
|
const contextRootEndIndex = pathname.lastIndexOf('/');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -93,7 +93,7 @@ export class App extends AbstractApp {
|
||||||
path = this._routePath2WindowLocationPathname(path);
|
path = this._routePath2WindowLocationPathname(path);
|
||||||
|
|
||||||
// Navigate to the specified Route.
|
// Navigate to the specified Route.
|
||||||
const windowLocation = this._getWindowLocation();
|
const windowLocation = this.getWindowLocation();
|
||||||
|
|
||||||
if (windowLocation.pathname === path) {
|
if (windowLocation.pathname === path) {
|
||||||
// The browser is at the specified path already and what remains is
|
// The browser is at the specified path already and what remains is
|
||||||
|
|
|
@ -40,7 +40,8 @@ function _setWebRTCReady(store, next, action) {
|
||||||
// execution enviroment has changed. The current location is not necessarily
|
// execution enviroment has changed. The current location is not necessarily
|
||||||
// available through window.location (e.g. on mobile) but the following
|
// available through window.location (e.g. on mobile) but the following
|
||||||
// works at the time of this writing.
|
// works at the time of this writing.
|
||||||
const windowLocation = window.location;
|
const windowLocation
|
||||||
|
= store.getState()['features/app'].app.getWindowLocation();
|
||||||
|
|
||||||
if (windowLocation) {
|
if (windowLocation) {
|
||||||
const href = windowLocation.href;
|
const href = windowLocation.href;
|
||||||
|
|
Loading…
Reference in New Issue