mattermost-mobile/app/selectors/client_upgrade.js
Jesse Hallam 58b72302d6 update eslint's comma-dangle rule to always-multiline (#1457)
* update eslint's `comma-dangle` rule to `always-multiline`

* add check and fix scripts to package.json

* Invoke `yarn fix` to adopt the updated eslint rules. No other changes are included.
2018-02-23 09:06:02 -05:00

33 lines
1 KiB
JavaScript

import {createSelector} from 'reselect';
import {Platform} from 'react-native';
import DeviceInfo from 'react-native-device-info';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import LocalConfig from 'assets/config';
const getClientUpgrade = createSelector(
getConfig,
(config) => {
const {AndroidMinVersion, AndroidLatestVersion, IosMinVersion, IosLatestVersion} = config;
let minVersion = IosMinVersion;
let latestVersion = IosLatestVersion;
let downloadLink = LocalConfig.MobileClientUpgradeIosIpaLink;
if (Platform.OS === 'android') {
minVersion = AndroidMinVersion;
latestVersion = AndroidLatestVersion;
downloadLink = LocalConfig.MobileClientUpgradeAndroidApkLink;
}
return {
currentVersion: DeviceInfo.getVersion(),
downloadLink,
forceUpgrade: LocalConfig.EnableForceMobileClientUpgrade,
latestVersion,
minVersion,
};
}
);
export default getClientUpgrade;