Ejemplo n.º 1
0
 componentDidMount() {
     OneSignal.configure({
         onNotificationOpened: this.handleNotification.bind(this)
     });
     AppState.addEventListener('change', this.handleAppStateChange);
     OneSignal.sendTags({user: '******'});
 }
Ejemplo n.º 2
0
  componentWillMount() {
    OneSignal.init('22fcdd38-fb1c-43ce-8619-947d613c84d4', {
      kOSSettingsKeyAutoPrompt: true,
    });
    OneSignal.configure();

    OneSignal.addEventListener('ids', this.onIds);

    this.subscription = this.props.client
      .watchQuery({ query: commonQueries.userInformation })
      .subscribe(({ data: updatedResult }) => {
        this.setState({ cartLength: updatedResult.me.cart.length });
      });
  }
    //  article: {
    //    title: notification.data.title,
    //    link: notification.data.url,
    //    action: notification.data.actionSelected
    //  }
    // });
// }

OneSignal.configure({
    onNotificationOpened: function(message, data, isActive) {
        console.log('MESSAGE: ', message);
        console.log('DATA: ', data);
        console.log('ISACTIVE: ', isActive);

        // var notification = {message: message, data: data, isActive: isActive};
        // console.log('NOTIFICATION OPENED: ', notification);
        //if (!_navigator) { // If we want to wait for an object to get initialized
        //    console.log('Navigator is null, adding notification to pending list...');
            // pendingNotifications.push(notification);
        //    return;
        // }
        // handleNotification(notification);
    }
});

class AwesomeProject extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
Ejemplo n.º 4
0
 * https://github.com/facebook/react-native
 */
'use strict';
import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';
import OneSignal from 'react-native-onesignal'; // Import package from node modules

OneSignal.configure({
  onNotificationOpened: function(message, data, isActive) {
      // Handle payload
      console.log('MESSAGE: ', message);
      console.log('DATA: ', data);
      console.log('ISACTIVE: ', isActive);
  }
});

OneSignal.idsAvailable((idsAvailable) => {
    console.log(idsAvailable);
});

class AwesomeProject extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
Ejemplo n.º 5
0
import React, {
    AppRegistry,
    Component,
    StatusBarIOS,
    AsyncStorage,
    AlertIOS
} from 'react-native';

// StatusBarIOS.setStyle('light-content');

import RootRouter from './App/Components/RootRouter';
import OneSignal from 'react-native-onesignal'; // Import package from node modules

OneSignal.configure({
    onNotificationOpened: function(message, data, isActive) {
        var notification = {message: message, data: data, isActive: isActive};
        console.log('NOTIFICATION OPENED: ', notification);
    }
});

class NativeStarter extends Component {
  constructor(props){
    super(props);
  }

  componentDidMount(){

    // TouchID.authenticate('지문인식')
    //       .then(success => {
    //
    //         this.setState({pushState: true});
    //         // AlertIOS.alert('지문인식 성공!');
Ejemplo n.º 6
0
  View
} from 'react-native';

import OneSignal from 'react-native-onesignal'; // Import package from node modules
// var _navigator; // If applicable, declare a variable for accessing your navigator object to handle payload.

OneSignal.configure({
    onIdsAvailable: function(device) {
        console.log('UserId = ', device.userId);
        console.log('PushToken = ', device.pushToken);
    },
  onNotificationOpened: function(message, data, isActive) {
      console.log('MESSAGE: ', message);
      console.log('DATA: ', data);
      console.log('ISACTIVE: ', isActive);
      // Do whatever you want with the objects here
      // _navigator.to('main.post', data.title, { // If applicable
      //  article: {
      //    title: data.title,
      //    link: data.url,
      //    action: data.actionSelected
      //  }
      // });
  }
});



class chatApp extends Component {
  render() {
    return (
Ejemplo n.º 7
0
import React, { Component } from 'react';
import { Root, Tabs } from './config/router';
import { Provider } from 'react-redux';
import configureStore from "./store";
import OneSignal from 'react-native-onesignal';

const store = configureStore();

const AppRoot = ({ store }) => (
    <Provider store={store}>
        <Root/>
    </Provider>
);

OneSignal.configure({});

const App = () => <AppRoot store={store}/>

export default App;