Coder Social home page Coder Social logo

zalesky / react-native-hockeyapp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from martincik/react-native-hockeyapp

0.0 2.0 0.0 118 KB

HockeyApp integration for React Native with Android and iOS support

License: MIT License

Objective-C 33.39% Java 60.07% JavaScript 6.54%

react-native-hockeyapp's Introduction

react-native-hockeyapp

HockeyApp integration for React Native.

Requirements

  • iOS 7+
  • Android
  • React Native >0.17
  • CocoaPods

Installation

npm install react-native-hockeyapp --save

iOS

You will need:

CocoaPods (Setup)

Podfile

Add to your ios/Podfile:

pod "HockeySDK"

Run pod install

Add Pods.xcodeproj to your project

Drag-and-drop ./ios/Pods/Pods.xcodeproj into your Project > Libraries.

Add files from RNHockeyApp/ folder to your project

Drag-and-drop files from ./node_modules/react-native-hockeyapp/RNHockeyApp into your Project > Libraries.

Changes to AppDelegate.m

If you wish to use Device UUID authentication or Web authentication, the following must be added to ios/AppDelegate.m

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
  if( [[BITHockeyManager sharedHockeyManager].authenticator handleOpenURL:url
                                                        sourceApplication:sourceApplication
                                                               annotation:annotation]) {
    return YES;
  }

  /* Your own custom URL handlers */

  return NO;
}

Android (React Native >= 0.29)

Google project configuration

  • In android/setting.gradle
...
include ':react-native-hockeyapp', ':app'
project(':react-native-hockeyapp').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-hockeyapp/android')
  • In android/build.gradle
...
repositories {
    jcenter()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.3.1'
    classpath 'net.hockeyapp.android:HockeySDK:4.1.0' // <--- add this
}
  • In android/app/build.gradle
apply plugin: "com.android.application"
...
dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:0.29.+"
    compile project(":react-native-hockeyapp") // <--- add this
}
  • Manifest file
<application ..>
    <activity android:name="net.hockeyapp.android.UpdateActivity" />
    <activity android:name="net.hockeyapp.android.FeedbackActivity" />
</application>
  • Register Module (in MainApplication.java)
import com.slowpath.hockeyapp.RNHockeyAppModule; // <--- import
import com.slowpath.hockeyapp.RNHockeyAppPackage;  // <--- import

public class MainApplication extends Application implements ReactApplication {
  ......

  @Override
  protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
      new RNHockeyAppPackage(MainApplication.this), // <------ add this line to yout MainApplication class
      new MainReactPackage());
  }

  ......

}

Android (React Native 0.17 - 0.28) - Only react-native-hockeyapp:0.4.2 or less

Google project configuration

  • In android/setting.gradle
...
include ':react-native-hockeyapp', ':app'
project(':react-native-hockeyapp').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-hockeyapp/android')
  • In android/build.gradle
...
repositories {
    jcenter()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.3.1'
    classpath 'net.hockeyapp.android:HockeySDK:4.1.2' // <--- add this
}
  • In android/app/build.gradle
apply plugin: "com.android.application"
...
dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:0.17.+"
    compile project(":react-native-hockeyapp") // <--- add this
}
  • Manifest file
<application ..>
    <activity android:name="net.hockeyapp.android.UpdateActivity" />
    <activity android:name="net.hockeyapp.android.FeedbackActivity" />
</application>
  • Register Module (in MainActivity.java)
import com.slowpath.hockeyapp.RNHockeyAppModule; // <--- import
import com.slowpath.hockeyapp.RNHockeyAppPackage;  // <--- import

public class MainActivity extends ReactActivity {
  ......

  @Override
  protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
      new RNHockeyAppPackage(this), // <------ add this line to yout MainActivity class
      new MainReactPackage());
  }

  ......

}

Usage

From your JS files for both iOS and Android:

var HockeyApp = require('react-native-hockeyapp');

componentWillMount() {
    HockeyApp.configure(HOCKEY_APP_ID, true);
}

componentDidMount() {
    HockeyApp.start();
    HockeyApp.checkForUpdate(); // optional
}

You have available these methods:

HockeyApp.configure(HockeyAppId: string, autoSendCrashReports: boolean = true, authenticationType: AuthenticationType = AuthenticationType.Anonymous, appSecret: string = '', ignoreDefaultHandler: string = false); // Configure the settings
HockeyApp.start(); // Start the HockeyApp integration
HockeyApp.checkForUpdate(); // Check if there's new version and if so trigger update
HockeyApp.feedback(); // Ask user for feedback.
HockeyApp.addMetadata(metadata: object); // Add metadata to crash report.  The argument must be an object with key-value pairs.
HockeyApp.generateTestCrash(); // Generate test crash. Only works in no-debug mode.

The following authentication methods are available:

  1. AuthenticationType.Anonymous - Anonymous Authentication
  2. AuthenticationType.EmailSecret - HockeyApp email & App Secret
  3. AuthenticationType.EmailPassword - HockeyApp email & password
  4. AuthenticationType.DeviceUUID - HockeyApp registered device UUID
  5. AuthenticationType.Web - HockeyApp Web Auth (iOS only)

Contributions

See https://github.com/slowpath/react-native-hockeyapp/graphs/contributors

react-native-hockeyapp's People

Contributors

berickson1 avatar bourgois avatar dj-ivan avatar dryganets avatar dtivel avatar grabcode avatar jberendes avatar jeveloper avatar martincik avatar ncnlinh avatar raffij avatar rspeyer avatar samueljmurray avatar thadcodes avatar zalesky avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.