npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-google-app-invites

v0.2.6

Published

Google App Invites for your react native applications

Downloads

23

Readme

react-native-google-app-invites

Let your users sign in with their Google account and Invite your contacts to use the app.

react-native-google-app-invites is a wrapper around Google App Invites so it can be used from an React Native application.

Requirements

  • iOS 7+
  • React Native >0.14
  • CocoaPods

Installation

npm install react-native-google-app-invites --save

iOS

You will need:

CocoaPods (Setup)

Google project configuration for iOS

  • Open https://developers.google.com/app-invites/ios/
  • Follow the instalation steps for CocoaPods

Android

Google project configuration

  • Install Google Repository package in Android SDK Manager:
  1. Run in terminal window android (will start Android SDK Manager)
  2. Install in Extras folder package Google Repository
  • Open https://developers.google.com/app-invites/android/
  • Follow the instalation steps
  • In android/setting.gradle
...
include ':react-native-google-app-invites', ':app'
project(':react-native-google-app-invites').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-app-invites/android')
  • In android/build.gradle
...
dependencies {
        classpath 'com.android.tools.build:gradle:1.3.1'
        classpath 'com.google.gms:google-services:1.5.0' // <--- add this
    }
  • In android/app/build.gradle
apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services' // <--- add this at the TOP
...
dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:0.14.+"
    compile project(":react-native-google-app-invites") // <--- add this
}
  • Register Module (in MainActivity.java)
import com.slowpath.googleappinvites.RNGoogleAppInvitesModule; // <--- import
import com.slowpath.googleappinvites.RNGoogleAppInvitesPackage;  // <--- import

public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
  ......

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mReactRootView = new ReactRootView(this);

    mReactInstanceManager = ReactInstanceManager.builder()
      .setApplication(getApplication())
      .setBundleAssetName("index.android.bundle")
      .setJSMainModuleName("index.android")
      .addPackage(new MainReactPackage())
      .addPackage(new RNGoogleAppInvitesPackage(this)) // <------ add this line to yout MainActivity class
      .setUseDeveloperSupport(BuildConfig.DEBUG)
      .setInitialLifecycleState(LifecycleState.RESUMED)
      .build();

    mReactRootView.startReactApplication(mReactInstanceManager, "AndroidRNSample", null);

    setContentView(mReactRootView);
  }

  // add this method inside your activity class
  @Override
  protected void onActivityResult(int requestCode, int resultCode, android.content.Intent data) {
      if (requestCode == RNGoogleAppInvitesModule.RC_APP_INVITES_IN) {
          RNGoogleAppInvitesModule.onActivityResult(resultCode, data);
      }
      super.onActivityResult(requestCode, resultCode, data);
  }

  ......

}

Usage

From your JS files for both iOS and Android:

var { NativeAppEventEmitter, DeviceEventEmitter } = require('react-native');
var GoogleAppInvites = require('react-native-google-app-invites');

if (Platform.OS === "ios") {
  GoogleAppInvites.configure(
    CLIENT_ID, // from .plist file
    SCOPES // array of authorization names: eg ['https://www.googleapis.com/auth/plus.login']
  );
} else {
  GoogleAppInvites.init()
}

let Emitter = (Platform.OS === "android") ? DeviceEventEmitter : NativeAppEventEmitter;

Emitter.addListener('googleAppInvitesError', (error) => {
  console.log('ERROR App Invites in', error);
});

Emitter.addListener('googleAppInviteIds', (body) => {
  console.log('User invited these IDS:', body);
});

GoogleAppInvites.invite("Message", "Title", "http://deepLink");