Skip to content

Commit

Permalink
add contributor guide (#579)
Browse files Browse the repository at this point in the history
* contributing

* fixes

* fix typo
  • Loading branch information
vonovak committed Dec 3, 2018
1 parent b448990 commit e069d43
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 9 deletions.
11 changes: 8 additions & 3 deletions README.md
Expand Up @@ -7,9 +7,10 @@
## Features

- Support all 3 types of authentication methods (standard, with server-side validation or with offline access (aka server side access))
- Native signin button
- Native signin buttons
- Consistent API between Android and iOS
- Promise-based JS API
- Typings for TypeScript and Flow

### Note

Expand All @@ -21,7 +22,7 @@ If you use React Native < `v0.47` stick with `v0.10.0` (`npm install react-nativ

`yarn add react-native-google-signin`

Then follow to the [Android guide](android-guide.md) and [iOS guide](ios-guide.md)
Then follow the [Android guide](docs/android-guide.md) and [iOS guide](docs/ios-guide.md)

## Public API

Expand Down Expand Up @@ -249,6 +250,10 @@ Example `userInfo` which is returned after successful sign in.
}
```

## Want to contribute?

Check out the [contributor guide](docs/CONTRIBUTING.md)!

## Notes

Calling the methods exposed by this package may involve remote network calls and you should thus take into account that such calls may take a long time to complete (eg. in case of poor network connection).
Expand All @@ -259,7 +264,7 @@ Read [iOS documentation](https://developers.google.com/identity/sign-in/ios/back

**serverAuthCode Note**: serverAuthCode is not null only if you specify a valid `webClientId` and set `offlineAccess` to true. once you get the auth code, you can send it to your backend server and exchange the code for an access token. Only with this freshly acquired token can you access user data.

Read [iOS documentation](https://developers.google.com/identity/sign-in/ios/offline-access) and [Android documentation](https://developers.google.com/identity/sign-in/android/offline-access) for more information
Read [iOS documentation](https://developers.google.com/identity/sign-in/ios/offline-access) and [Android documentation](https://developers.google.com/identity/sign-in/android/offline-access) for more information.

## Additional scopes

Expand Down
43 changes: 43 additions & 0 deletions docs/CONTRIBUTING.md
@@ -0,0 +1,43 @@
## Contributor Guide

Want to add a feature or fix a bug? Great! This short guide will help.

Development is best done using the example project. After you clone the repo, you need to

- get the config files from firebase: see [here](get-config-file.md)
- cd to the example folder
- run `yarn` to install deps
- create `config.js` with the following content:

```js
export default {
webClientId: 'your-id.apps.googleusercontent.com',
};
```

- cd to the `ios` folder and run `pod install`

Now the example project should build successfully on both platforms and you should be able to sign in using the example app.

### Making Change to Native Code

If you want to make changes to native code, just go ahead and import the example project into Android Studio, or open the `GoogleSigninSampleApp.xcworkspace` file in Xcode.

In Android Studio you'll see the reference to the `react-native-google-signin` project.
in Xcode, under Libraries, there'll be `RNGoogleSignIn` project.

You may edit the source codes of those projects - that will edit the files in the `android` and `ios` folders in the repo root (not in `node_modules`) so you can easily commit those changes.

### Making Change to JS Code

There is a little more work to make changes to JS code. The process is not ideal but works as follows:

- in the example folder, run `yarn watch`: this will watch any changes made to the files in the `<repo_root>/src` folder and copy them to `<example_folder>/node_modules/react-native-google-signin/src` so the react-native bundler can read them.
- note that this only watches the `src` folder so if you're working with other files you need to modify the watch script

Now you can make changes to JS code and test them out.

### Finalize

- from the root of the repo run `yarn prettier:write` to prettify the JS files
- open a PR with your changes! :tada:
2 changes: 1 addition & 1 deletion android-guide.md → docs/android-guide.md
Expand Up @@ -6,7 +6,7 @@ Please see the **FAQ** at bottom before opening new issues

You need the following packages

[![link config](https://github.com/apptailor/react-native-google-signin/raw/master/img/android-req.png)](#config)
[![link config](../img/android-req.png)](#config)

### 2. Google project configuration

Expand Down
2 changes: 1 addition & 1 deletion get-config-file.md → docs/get-config-file.md
Expand Up @@ -6,7 +6,7 @@ If you don't already have a project in Firebase you need to create one in order

1. Add your iOS and Android App inside Project settings.

![Project settings](img/project-settings.png)
![Project settings](../img/project-settings.png)

_Access project settings on top left pane next to Project Overview_

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions ios-guide.md → docs/ios-guide.md
Expand Up @@ -30,7 +30,7 @@ First time using cocoapods ? [check this out](./how-cocoapods.md)

At the end, the dependencis should be linked like in this picture (this is _with_ pods).

[![link config](img/buildPhasesWithPods.png)](img/buildPhasesWithPods.png?raw=true)
[![link config](../img/buildPhasesWithPods.png)](../img/buildPhasesWithPods.png?raw=true)

#### Without Cocoapods

Expand All @@ -41,7 +41,7 @@ At the end, the dependencis should be linked like in this picture (this is _with

At the end, the dependencis should be linked like in this picture (this is _without_ pods).

[![link config](img/buildPhasesWithoutPods.png)](img/buildPhasesWithoutPods.png?raw=true)
[![link config](../img/buildPhasesWithoutPods.png)](../img/buildPhasesWithoutPods.png?raw=true)

### 2. Google project configuration

Expand All @@ -54,7 +54,7 @@ At the end, the dependencis should be linked like in this picture (this is _with
- Configure URL types in the `Info` panel (see screenshot)
- add a URL with scheme set to your `REVERSED_CLIENT_ID` (found inside `GoogleService-Info.plist`)

[![link config](img/urlTypes.png)](img/urlTypes.png?raw=true)
[![link config](../img/urlTypes.png)](../img/urlTypes.png?raw=true)

### Modify your app to respond to the URL scheme (optional)

Expand Down
2 changes: 1 addition & 1 deletion example/index.js
Expand Up @@ -3,7 +3,7 @@ import React, { Component } from 'react';
import { AppRegistry, StyleSheet, Text, View, Alert, Button } from 'react-native';
import { GoogleSignin, GoogleSigninButton, statusCodes } from 'react-native-google-signin';
import type { User } from 'react-native-google-signin';
import config from './config';
import config from './config'; // see docs/CONTRIBUTING.md for details

type ErrorWithCode = Error & { code?: string };

Expand Down

0 comments on commit e069d43

Please sign in to comment.