How to use the react-native-push-notification.checkPermissions function in react-native-push-notification

To help you get started, we’ve selected a few react-native-push-notification 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 OriginProtocol / origin / mobile / src / components / origin-web3view.js View on Github external
const checkNotificationPermissions = () => {
    // Check if the user has enabled push notifications
    return PushNotification.checkPermissions(permissions => {
      if (!permissions.alert) {
        setModals([...modals, { type: 'enableNotifications' }])
      }
    })
  }
github DefinitelyTyped / DefinitelyTyped / types / react-native-push-notification / react-native-push-notification-tests.ts View on Github external
popInitialNotification: false,
    requestPermissions: true,
});

PushNotification.unregister();
PushNotification.localNotification = (details) => {};
PushNotification.localNotificationSchedule = (details) => {};
PushNotification.requestPermissions();
PushNotification.presentLocalNotification = (details) => {};
PushNotification.scheduleLocalNotification = (details) => {};
PushNotification.cancelLocalNotifications = (details) => {};
PushNotification.cancelAllLocalNotifications();
PushNotification.setApplicationIconBadgeNumber(1);
PushNotification.getApplicationIconBadgeNumber((badgeCount) => {});
PushNotification.popInitialNotification((notification) => {});
PushNotification.checkPermissions((checkPermissions) => {});
PushNotification.abandonPermissions();
PushNotification.registerNotificationActions(['Accept', 'Reject', 'Yes', 'No']);
PushNotification.clearAllNotifications();
github OriginProtocol / origin / mobile / src / PushNotifications.js View on Github external
async register() {
    const activeAddress = get(this.props, 'wallet.activeAccount.address')
    if (!activeAddress) {
      console.debug(
        'Could not register with notifications server, no active address'
      )
      return
    }

    console.debug(`Adding ${activeAddress} to mobile registry`)

    PushNotification.checkPermissions(async permissions => {
      const data = {
        eth_address: activeAddress,
        device_type: this.getNotificationType(),
        permissions: permissions
      }

      if (this.props.settings.deviceToken) {
        data['device_token'] = this.props.settings.deviceToken
      }

      fetch(this.getNotificationServerUrl(), {
        method: 'POST',
        headers: {
          Accept: 'application/json',
          'Content-Type': 'application/json',
          Authorization: `Bearer ${await this.getAuthToken()}`
github LiskHQ / lisk-mobile / src / utilities / notifications.js View on Github external
export const requestNotificationPermissions = () => new Promise((resolve, reject) => {
  if (Platform.OS === 'ios') {
    PushNotification.checkPermissions(({ alert, badge, sound }) => {
      if (!alert || !badge || !sound) {
        PushNotification.requestPermissions()
          .then((target) => {
            if (target.alert || target.badge || target.sound) {
              resolve();
            } else {
              reject();
            }
          });
      } else {
        resolve();
      }
    });
  } else {
    resolve();
  }
github keybase / client / shared / actions / platform-specific / push.native.js View on Github external
  new Promise((resolve, reject) => PushNotifications.checkPermissions(resolve))
const monsterStorageKey = 'shownMonsterPushPrompt'
github MetaMask / metamask-mobile / app / core / TransactionsNotificationManager.js View on Github external
requestPushNotificationsPermission = async () => {
		const promptCount = await AsyncStorage.getItem('@MetaMask:pushNotificationsPromptCount');
		if (!promptCount || Number(promptCount) < AppConstants.MAX_PUSH_NOTIFICATION_PROMPT_TIMES) {
			PushNotification.checkPermissions(permissions => {
				if (!permissions || !permissions.alert) {
					Alert.alert(
						strings('notifications.prompt_title'),
						strings('notifications.prompt_desc'),
						[
							{
								text: strings('notifications.prompt_cancel'),
								onPress: () => false,
								style: 'default'
							},
							{
								text: strings('notifications.prompt_ok'),
								onPress: () => PushNotification.requestPermissions()
							}
						],
						{ cancelable: false }
github keybase / client / shared / actions / platform-specific.native.js View on Github external
  return new Promise((resolve, reject) => PushNotifications.checkPermissions(resolve))
}
github zo0r / react-native-push-notification / example / NotifService.js View on Github external
checkPermission(cbk) {
    return PushNotification.checkPermissions(cbk);
  }