How to use the react-native-code-push.getUpdateMetadata function in react-native-code-push

To help you get started, we’ve selected a few react-native-code-push 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 birkir / react-native-appstore / src / index.js View on Github external
import { Navigation } from 'react-native-navigation';
import { Screens, startApp } from 'screens';
import { Sentry } from 'react-native-sentry';
import codePush from 'react-native-code-push';
import config from 'config';
import Store, { StoreProvider } from 'store';

// Initialize Sentry
if (!__DEV__) {
  Sentry.config(config.SENTRY_DSN).install();
}

// Set Sentry CodePush metadata
codePush.getUpdateMetadata().then((update) => {
  if (update) {
    Sentry.setVersion(`${update.appVersion}-codepush:${update.label}`);
  }
});

// Create new instance of the Store
const store = new Store(config.SECRET_TOKEN);

// Register screens
Array.from(Screens.entries()).forEach(([screenConst, screenModule]) =>
  Navigation.registerComponent(
    screenConst,
    screenModule,
    store,
    codePush(StoreProvider),
  ));
github rdev / now-mobile / src / screens / Main.js View on Github external
notification.finish(PushNotificationIOS.FetchResult.NoData);
			},
			requestPermissions: true,
		});
		// We only need to do some things on first ever render
		const fromSplash = this.props.navigation.getParam('fromSplash');
		if (!isAndroid) {
			const Spotlight = require('../extensions/spotlight');
			Spotlight.addListener(this.handleSpotlightClick);
			const id = await Spotlight.handleAppOpen();
			if (fromSplash && id) {
				this.props.navigation.push('DeploymentDetails', { id });
			}
		}

		const update = await codePush.getUpdateMetadata();
		if (fromSplash && update && update.isFirstRun && update.description) {
			this.props.navigation.navigate('WhatsNew', { description: update.description });
		}
	};
github HarishJangra / react-native-easy-starter / src / Services / CheckVersion.js View on Github external
const checkExtraCodepush = useCallback(async () => {
    const meta = await CodePush.getUpdateMetadata();
    console.log('[codepush] meta', meta);
  }, []);
github syun0216 / goforeat / app / hoc / CommonHOC.js View on Github external
_appStateTimer = setTimeout(() => {
            this._checkVersion();
            CodePush.getUpdateMetadata().then(localPackage => {
              if (localPackage == null) {
                this._checkForUpdate();
              } else {
                if (localPackage.isPending) {
                  localPackage.install(CodePush.InstallMode.ON_NEXT_RESUME);
                } else {
                  this._checkForUpdate();
                }
              }
            });
            clearTimeout(_appStateTimer);
          }, 1000);
        } else if (nextState == "background" && this.nextState != 'background') {
github birkir / kvikmyndr-app / src / store / update.ts View on Github external
return flow(function* () {
        self.updateMetadata = yield CodePush.getUpdateMetadata();
      })();
    },
github listenzz / react-native-engineering / app / App.tsx View on Github external
componentDidMount() {
    CodePush.getUpdateMetadata()
      .then(update => {
        if (update) {
          this.setState({
            version: `${update.appVersion}-codepush:${update.label}`,
          })
        }
      })
      .catch(e => {
        Sentry.captureException(e)
      })
  }