jitsi-meet/react/features/app/functions.native.js
Saúl Ibarra Corretgé e4c3e15791 rn: simplified code
There is no need for AbstractApp to require some getWindowLocation function.
It's only used in one place and we even polyfill it on mobile.

Thus replace it's usage with more specific functions.
2019-03-12 16:55:28 +01:00

41 lines
1019 B
JavaScript

// @flow
import { NativeModules } from 'react-native';
import { getAppProp } from '../base/app';
import { toState } from '../base/redux';
import { getServerURL } from '../base/settings';
/**
* Retrieves the default URL for the app. This can either come from a prop to
* the root App component or be configured in the settings.
*
* @param {Function|Object} stateful - The redux store or {@code getState}
* function.
* @returns {string} - Default URL for the app.
*/
export function getDefaultURL(stateful: Function | Object) {
const state = toState(stateful);
return getAppProp(state, 'defaultURL') || getServerURL(state);
}
/**
* Returns application name.
*
* @returns {string} The application name.
*/
export function getName() {
return NativeModules.AppInfo.name;
}
/**
* Returns the path to the Jitsi Meet SDK bundle on iOS. On Android it will be
* undefined.
*
* @returns {string|undefined}
*/
export function getSdkBundlePath() {
return NativeModules.AppInfo.sdkBundlePath;
}