Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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!');
}
};
// @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';
.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)=>{
getAppInfo = () => {
const appName = getApplicationName();
const appVersion = getVersion();
const buildNumber = getBuildNumber();
return `${appName} v${appVersion} (${buildNumber})`;
};
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',
(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,
};
}
);
{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,
* 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}
);
}
}
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(),
}
}