How to use the react-native-device-info.getVersion function in react-native-device-info

To help you get started, we’ve selected a few react-native-device-info examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zulip / zulip-mobile / src / sentry.js View on Github external
const preventNoise = (): void => {
  /* Sentry should not normally be used in debug mode. (For one thing, the
     debug-mode build process doesn't ordinarily create bundles or .map files,
     so you'll probably get nonsensical stack traces.) */
  if (process.env.NODE_ENV === 'development' && config.sentryKey !== null) {
    /* If you have some reason to initialize Sentry in debug mode anyway, please
       change the app's version name (currently specified in `ios/Info.plist`
       and/or `android/app/build.gradle`) to something that doesn't look like a
       normal version number -- preferably with your name and/or Github ID in
       it. This will allow events produced by these debug builds to be easily
       identified in the Sentry console. */
    if (DeviceInfo.getVersion().match(/^\d+\.\d+\.\d+$/)) {
      throw new Error('Sentry should not be initialized in debug builds');
    }
  }

  /* Jest has no reason to even _try_ to initialize Sentry, even if `sentryKey`
     is `null`. */
  // (See the following links concerning detecting Jest.)
  //   [1] https://jestjs.io/docs/en/24.0/getting-started.html#using-babel
  //   [2] https://stackoverflow.com/a/52231746
  if (process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID !== undefined) {
    throw new Error('Sentry must not be initialized during testing!');
  }
};
github ovr / ghubber / index.js View on Github external
// @author Dmitry Patsura  https://github.com/ovr
// @flow

import { Sentry } from 'react-native-sentry';
import { getVersion } from 'react-native-device-info';

// eslint-disable-next-line no-undef
if (SENTRY_ENABLED) {
    Sentry.config(
        'https://72052f3c63ed49beb78fff6830173c21@sentry.io/1269911',
        {
            release: getVersion()
        }
    ).install();
}

import './App';
github talentjiang / react_native_office / app / pages / main.js View on Github external
.then((responseData)=>{
        if (DeviceInfo.getVersion() != responseData.infos.appInfo.version && DeviceInfo.getVersion() < responseData.infos.appInfo.version){
            Alert.alert('新版本!',responseData.infos.appInfo.info, [{text: '立即更新',
              onPress: () =>{Linking.openURL(responseData.infos.appInfo.appDownloadUrl);}}])
        }else{
          console.log('最新版本!!!');
        }
      })
      .catch((error)=>{
github MetaMask / metamask-mobile / app / components / Views / Settings / AppInformation / index.js View on Github external
getAppInfo = () => {
		const appName = getApplicationName();
		const appVersion = getVersion();
		const buildNumber = getBuildNumber();

		return `${appName} v${appVersion} (${buildNumber})`;
	};
github guardian / editions / projects / Mallard / src / screens / settings-screen.tsx View on Github external
const SettingsScreen = ({ navigation }: NavigationInjectedProps) => {
    const query = useQuery(QUERY)
    const identityData = useIdentity()
    const canAccess = useAccess()
    const [, setVersionClickedTimes] = useState(0)
    const { signOutIdentity } = useContext(AccessContext)
    const styles = StyleSheet.create({
        signOut: {
            color: color.ui.supportBlue,
            ...getFont('sans', 1),
        },
    })

    const versionNumber = DeviceInfo.getVersion()

    if (query.loading) return null
    const { client } = query
    const { isUsingProdDevtools, isWeatherShown } = query.data

    const versionClickHandler = identityData
        ? () => {
              if (!isUsingProdDevtools && isStaffMember(identityData))
                  setVersionClickedTimes(t => {
                      if (t < 7) return t + 1
                      Alert.alert(
                          'Enable Developer Mode',
                          'Are you sure?',
                          [
                              {
                                  text: 'Enable',
github mattermost / mattermost-mobile / app / selectors / client_upgrade.js View on Github external
(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,
        };
    }
);
github infinitered / ignite / ignite-base / App / Containers / DeviceInfoScreen.js View on Github external
{title: 'Device Country', info: DeviceInfo.getDeviceCountry()},
  {title: 'User Agent', info: DeviceInfo.getUserAgent()},
  {title: 'Screen Width', info: Metrics.screenWidth},
  {title: 'Screen Height', info: Metrics.screenHeight}
]

const OS_DATA = [
  {title: 'Device System Name', info: DeviceInfo.getSystemName()},
  {title: 'Device ID', info: DeviceInfo.getDeviceId()},
  {title: 'Device Version', info: DeviceInfo.getSystemVersion()}
]

const APP_DATA = [
  {title: 'Bundle Id', info: DeviceInfo.getBundleId()},
  {title: 'Build Number', info: DeviceInfo.getBuildNumber()},
  {title: 'App Version', info: DeviceInfo.getVersion()},
  {title: 'App Version (Readable)', info: DeviceInfo.getReadableVersion()}
]

export default class DeviceInfoScreen extends React.Component {
  state: {
    isConnected: boolean,
    connectionInfo: Object | null,
    connectionInfoHistory: Array
  }

  constructor (props: Object) {
    super(props)

    this.state = {
      isConnected: false,
      connectionInfo: null,
github BlueWallet / BlueWallet / screen / settings / about.js View on Github external
* blockcypher.com API
            * Nodejs
            * react-native-elements
            * rn-nodeify
            * bignumber.js
            

             {
                this.props.navigation.navigate('Selftest');
              }}
              title="Run self test"
            />
            
            
              {DeviceInfo.getApplicationName()} ver {DeviceInfo.getVersion()} (build number {DeviceInfo.getBuildNumber()})
            
            {DeviceInfo.getBundleId()}
            
              w, h = {width}, {height}
            
          
        
      
    );
  }
}
github celo-org / celo-monorepo / packages / react-components / analytics / CeloAnalytics.tsx View on Github external
FreeDiskStorage: await DeviceInfo.getFreeDiskStorage(),
    InstallReferrer: await DeviceInfo.getInstallReferrer(),
    InstanceID: await DeviceInfo.getInstanceId(),
    LastUpdateTime: await DeviceInfo.getLastUpdateTime(),
    Manufacturer: await DeviceInfo.getManufacturer(),
    MaxMemory: await DeviceInfo.getMaxMemory(),
    Model: DeviceInfo.getModel(),
    ReadableVersion: DeviceInfo.getReadableVersion(),
    SerialNumber: await DeviceInfo.getSerialNumber(),
    SystemName: DeviceInfo.getSystemName(),
    SystemVersion: DeviceInfo.getSystemVersion(),
    TotalDiskCapacity: await DeviceInfo.getTotalDiskCapacity(),
    TotalMemory: await DeviceInfo.getTotalMemory(),
    UniqueID: DeviceInfo.getUniqueId(),
    UserAgent: await DeviceInfo.getUserAgent(),
    Version: DeviceInfo.getVersion(),
    isEmulator: await DeviceInfo.isEmulator(),
    isTablet: DeviceInfo.isTablet(),
  }
}