How to use the react-native-onesignal.getPermissionSubscriptionState function in react-native-onesignal

To help you get started, we’ve selected a few react-native-onesignal 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 flow-typed / flow-typed / definitions / npm / react-native-onesignal_v3.x.x / flow_v0.69.0-v0.103.x / test_react-native-onesignal.js View on Github external
it("must return PermissionSubscriptionState", () => {
  OneSignal.getPermissionSubscriptionState(state => {
    // $ExpectError - read only state
    state.abc = "123";

    (state: PermissionSubscriptionState);
  });
});
github flow-typed / flow-typed / definitions / npm / react-native-onesignal_v3.x.x / flow_v0.104.x- / test_react-native-onesignal.js View on Github external
it('must return PermissionSubscriptionState', () => {
  OneSignal.getPermissionSubscriptionState(state => {
    // $ExpectError - read only state
    state.abc = '123';

    (state: PermissionSubscriptionState);
  });
});
github Flaque / quirk / src / onboarding / OnboardingScreen.tsx View on Github external
componentDidMount() {
    OneSignal.init(ONESIGNAL_SECRET, {
      kOSSettingsKeyAutoPrompt: false,
      kOSSettingsKeyInFocusDisplayOption: 0,
    });

    OneSignal.getPermissionSubscriptionState(status => {
      if (!status.hasPrompted && Platform.OS === "ios") {
        this.setState({
          showNotificationsPrompt: true,
        });
        return;
      }

      if (!status.subscriptionEnabled && Platform.OS === "android") {
        this.setState({
          showNotificationsPrompt: true,
        });
        return;
      }
    });

    // Triggers a fade in for fancy reasons
github StoDevX / AAO-React-Native / source / redux / parts / notifications.js View on Github external
return dispatch => {
		OneSignal.getPermissionSubscriptionState(permissions => {
			dispatch({
				type: SET_PERMISSIONS,
				payload: {
					enabled: permissions.notificationsEnabled,
					hasPrompted: permissions.hasPrompted,
				},
			})
		})

		OneSignal.getTags(tags => {
			if (!tags) {
				return
			}

			if (tags.stack && tags.message) {
				// it's an error
github Flaque / quirk / src / SettingsScreen.tsx View on Github external
});

    // Check subscription status
    if (await isGrandfatheredIntoFreeSubscription()) {
      this.setState({
        isGrandfatheredIntoSubscription: true,
      });
    } else {
      const expDate = await latestExpirationDate();
      this.setState({
        subscriptionExpirationDate: expDate,
      });
    }

    // Check notification status
    OneSignal.getPermissionSubscriptionState(status => {
      this.setState({
        areNotificationsOn: !!status.subscriptionEnabled,
        isReady: true,
      });
    });
  };