Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
devfd committed Aug 13, 2015
0 parents commit 0839e8d
Show file tree
Hide file tree
Showing 67 changed files with 1,491 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .gitignore
@@ -0,0 +1,28 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# node.js
#
node_modules/
npm-debug.log
1 change: 1 addition & 0 deletions .npmignore
@@ -0,0 +1 @@
examples
22 changes: 22 additions & 0 deletions LICENSE
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 Apptailor

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

6 changes: 6 additions & 0 deletions README.md
@@ -0,0 +1,6 @@
# react-native-geocoder
Use Google Signin from your react native apps

## Install
```
Binary file not shown.
Binary file added RNGoogleSignin/GoogleSignIn.bundle/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added RNGoogleSignin/GoogleSignIn.bundle/google.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RNGoogleSignin/GoogleSignIn.bundle/google@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RNGoogleSignin/GoogleSignIn.bundle/google@3x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RNGoogleSignin/GoogleSignIn.bundle/gplus.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RNGoogleSignin/GoogleSignIn.bundle/gplus@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RNGoogleSignin/GoogleSignIn.bundle/gplus@3x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
45 changes: 45 additions & 0 deletions RNGoogleSignin/GoogleSignIn.framework/Headers/GIDAuthentication.h
@@ -0,0 +1,45 @@
/*
* GIDAuthentication.h
* Google Sign-In iOS SDK
*
* Copyright 2014 Google Inc.
*
* Use of this SDK is subject to the Google APIs Terms of Service:
* https://developers.google.com/terms/
*/

#import <Foundation/Foundation.h>

// @relates GIDAuthentication
//
// The callback block that takes an access token or an error if attempt to refresh was unsuccessful.
typedef void (^GIDAccessTokenHandler)(NSString *accessToken, NSError *error);

// This class represents the OAuth 2.0 entities needed for sign-in.
@interface GIDAuthentication : NSObject <NSCoding>

// The client ID associated with the authentication.
@property(nonatomic, readonly) NSString *clientID;

// The OAuth2 access token to access Google services.
@property(nonatomic, readonly) NSString *accessToken;

// The estimated expiration date of the access token.
@property(nonatomic, readonly) NSDate *accessTokenExpirationDate;

// The OAuth2 refresh token to exchange for new access tokens.
@property(nonatomic, readonly) NSString *refreshToken;

// An OpenID Connect ID token that identifies the user. Send this token to your server to
// authenticate the user there. For more information on this topic, see
// https://developers.google.com/identity/sign-in/ios/backend-auth
@property(nonatomic, readonly) NSString *idToken;

// Gets the access token, which may be a new one from the refresh token if the original has already
// expired or is about to expire.
- (void)getAccessTokenWithHandler:(GIDAccessTokenHandler)handler;

// Refreshes the access token with the refresh token.
- (void)refreshAccessTokenWithHandler:(GIDAccessTokenHandler)handler;

@end
38 changes: 38 additions & 0 deletions RNGoogleSignin/GoogleSignIn.framework/Headers/GIDGoogleUser.h
@@ -0,0 +1,38 @@
/*
* GIDGoogleUser.h
* Google Sign-In iOS SDK
*
* Copyright 2014 Google Inc.
*
* Use of this SDK is subject to the Google APIs Terms of Service:
* https://developers.google.com/terms/
*/

#import <Foundation/Foundation.h>

@class GIDAuthentication;
@class GIDProfileData;

// This class represents a user account.
@interface GIDGoogleUser : NSObject <NSCoding>

// The Google user ID.
@property(nonatomic, readonly) NSString *userID;

// Representation of the Basic profile data. It is only available if |shouldFetchBasicProfile|
// is set and either |signInWithUser| or |SignIn| has been completed successfully.
@property(nonatomic, readonly) GIDProfileData *profile;

// The authentication object for the user.
@property(nonatomic, readonly) GIDAuthentication *authentication;

// The API scopes requested by the app in an array of |NSString|s.
@property(nonatomic, readonly) NSArray *accessibleScopes;

// For Google Apps hosted accounts, the domain of the user.
@property(nonatomic, readonly) NSString *hostedDomain;

// An OAuth2 authorization code for the home server.
@property(nonatomic, readonly) NSString *serverAuthCode;

@end
28 changes: 28 additions & 0 deletions RNGoogleSignin/GoogleSignIn.framework/Headers/GIDProfileData.h
@@ -0,0 +1,28 @@
/*
* GIDProfileData.h
* Google Sign-In iOS SDK
*
* Copyright 2014 Google Inc.
*
* Use of this SDK is subject to the Google APIs Terms of Service:
* https://developers.google.com/terms/
*/

#import <Foundation/Foundation.h>

// This class represents the basic profile information of a GIDGoogleUser.
@interface GIDProfileData : NSObject <NSCoding>

// The Google user's email.
@property(nonatomic, readonly) NSString *email;

// The Google user's name.
@property(nonatomic, readonly) NSString *name;

// Whether or not the user has profile image.
@property(nonatomic, readonly) BOOL hasImage;

// Gets the user's profile image URL for the given dimension in pixels for each side of the square.
- (NSURL *)imageURLWithDimension:(NSUInteger)dimension;

@end
187 changes: 187 additions & 0 deletions RNGoogleSignin/GoogleSignIn.framework/Headers/GIDSignIn.h
@@ -0,0 +1,187 @@
/*
* GIDSignIn.h
* Google Sign-In iOS SDK
*
* Copyright 2012 Google Inc.
*
* Use of this SDK is subject to the Google APIs Terms of Service:
* https://developers.google.com/terms/
*/

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class GIDGoogleUser;
@class GIDSignIn;

// The error domain for NSErrors returned by the Google Identity SDK.
extern NSString *const kGIDSignInErrorDomain;

// A list of potential error codes returned from the Google Identity SDK.
typedef NS_ENUM(NSInteger, GIDSignInErrorCode) {
// Indicates an unknown error has occured.
kGIDSignInErrorCodeUnknown = -1,
// Indicates a problem reading or writing to the application keychain.
kGIDSignInErrorCodeKeychain = -2,
// Indicates no appropriate applications are installed on the user's device which can handle
// sign-in. This code will only ever be returned if using webview and switching to browser have
// both been disabled.
kGIDSignInErrorCodeNoSignInHandlersInstalled = -3,
// Indicates there are no auth tokens in the keychain. This error code will be returned by
// signInSilently if the user has never signed in before with the given scopes, or if they have
// since signed out.
kGIDSignInErrorCodeHasNoAuthInKeychain = -4,
// Indicates the user canceled the sign in request.
kGIDSignInErrorCodeCanceled = -5,
};

// A protocol implemented by the delegate of |GIDSignIn| to receive a refresh token or an error.
@protocol GIDSignInDelegate

// The sign-in flow has finished and was successful if |error| is |nil|.
- (void)signIn:(GIDSignIn *)signIn
didSignInForUser:(GIDGoogleUser *)user
withError:(NSError *)error;

@optional

// Finished disconnecting |user| from the app successfully if |error| is |nil|.
- (void)signIn:(GIDSignIn *)signIn
didDisconnectWithUser:(GIDGoogleUser *)user
withError:(NSError *)error;

@end

// A protocol which may be implemented by consumers of |GIDSignIn| to be notified of when
// GIDSignIn has finished dispatching the sign-in request.
//
// This protocol is useful for developers who implement their own "Sign In with Google" button.
// Because there may be a brief delay between when the call to |signIn| is made, and when the
// app switch occurs, it is best practice to have the UI react to the user's input by displaying
// a spinner or other UI element. The |signInWillDispatch| method should be used to
// stop or hide the spinner.
@protocol GIDSignInUIDelegate <NSObject>

@optional

// The sign-in flow has finished selecting how to proceed, and the UI should no longer display
// a spinner or other "please wait" element.
- (void)signInWillDispatch:(GIDSignIn *)signIn error:(NSError *)error;

// If implemented, this method will be invoked when sign in needs to display a view controller.
// The view controller should be displayed modally (via UIViewController's |presentViewController|
// method, and not pushed unto a navigation controller's stack.
- (void)signIn:(GIDSignIn *)signIn presentViewController:(UIViewController *)viewController;

// If implemented, this method will be invoked when sign in needs to dismiss a view controller.
// Typically, this should be implemented by calling |dismissViewController| on the passed
// view controller.
- (void)signIn:(GIDSignIn *)signIn dismissViewController:(UIViewController *)viewController;

@end

// This class signs the user in with Google. It also provides single sign-on via a capable Google
// app if one is installed.
//
// For reference, please see "Google Sign-In for iOS" at
// https://developers.google.com/identity/sign-in/ios
// Here is sample code to use |GIDSignIn|:
// 1. Get a reference to the |GIDSignIn| shared instance:
// GIDSignIn *signIn = [GIDSignIn sharedInstance];
// 2. Set the OAuth 2.0 scopes you want to request:
// [signIn setScopes:[NSArray arrayWithObject:@"https://www.googleapis.com/auth/plus.login"]];
// 3. Call [signIn setDelegate:self];
// 4. Set up delegate method |signIn:didSignInForUser:withError:|.
// 5. Call |handleURL| on the shared instance from |application:openUrl:...| in your app delegate.
// 6. Call |signIn| on the shared instance;
@interface GIDSignIn : NSObject

// The authentication object for the current user, or |nil| if there is currently no logged in user.
@property(nonatomic, readonly) GIDGoogleUser *currentUser;

// The object to be notified when authentication is finished.
@property(nonatomic, weak) id<GIDSignInDelegate> delegate;

// The object to be notified when sign in dispatch selection is finished.
@property(nonatomic, weak) id<GIDSignInUIDelegate> uiDelegate;

// The client ID of the app from the Google APIs console. Must set for sign-in to work.
@property(nonatomic, copy) NSString *clientID;

// The API scopes requested by the app in an array of |NSString|s. The default value is |@[]|.
//
// This property is optional. If you set it, set it before calling |signIn|.
@property(nonatomic, copy) NSArray *scopes;

// Whether or not to fetch basic profile data after signing in. The data is saved in the
// |GIDGoogleUser.profileData| object.
//
// Setting the flag will add "email" and "profile" to scopes.
// Defaults to |YES|.
@property(nonatomic, assign) BOOL shouldFetchBasicProfile;

// Whether or not to switch to Chrome or Safari if no suitable Google apps are installed.
// Defaults to |YES|.
@property(nonatomic, assign) BOOL allowsSignInWithBrowser;

// Whether or not to support sign-in via a web view.
// Defaults to |YES|.
@property(nonatomic, assign) BOOL allowsSignInWithWebView;

// The language for sign-in, in the form of ISO 639-1 language code optionally followed by a dash
// and ISO 3166-1 alpha-2 region code, such as |@"it"| or |@"pt-PT"|. Only set if different from
// system default.
//
// This property is optional. If you set it, set it before calling |signIn|.
@property(nonatomic, copy) NSString *language;

// The client ID of the home web server. This will be returned as the |audience| property of the
// OpenID Connect ID token. For more info on the ID token:
// https://developers.google.com/accounts/docs/OAuth2Login#obtainuserinfo
//
// This property is optional. If you set it, set it before calling |signIn|.
@property(nonatomic, copy) NSString *serverClientID;

// The OpenID2 realm of the home web server. This allows Google to include the user's OpenID
// Identifier in the OpenID Connect ID token.
//
// This property is optional. If you set it, set it before calling |signIn|.
@property(nonatomic, copy) NSString *openIDRealm;

// Returns a shared |GIDSignIn| instance.
+ (GIDSignIn *)sharedInstance;

// This method should be called from your |UIApplicationDelegate|'s
// |application:openURL:sourceApplication:annotation|. Returns |YES| if |GIDSignIn| handled this
// URL.
- (BOOL)handleURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation;

// Checks whether the user has either currently signed in or has previous authentication saved in
// keychain.
- (BOOL)hasAuthInKeychain;

// Attempts to sign in a previously authenticated user without interaction. The delegate will be
// called at the end of this process indicating success or failure.
- (void)signInSilently;

// Starts the sign-in process. The delegate will be called at the end of this process. Note that
// this method should not be called when the app is starting up, (e.g in
// application:didFinishLaunchingWithOptions:). Instead use the |signInSilently| method.
- (void)signIn;

// Marks current user as being in the signed out state.
- (void)signOut;

// Disconnects the current user from the app and revokes previous authentication. If the operation
// succeeds, the OAuth 2.0 token is also removed from keychain.
- (void)disconnect;

// DEPRECATED: this method always calls back with |NO| on iOS 9 or above. Do not use this method.
// Checks if a Google app to handle sign in requests is installed on the user's device on iOS 8 or
// below.
- (void)checkGoogleSignInAppInstalled:(void (^)(BOOL isInstalled))callback
DEPRECATED_MSG_ATTRIBUTE("This method always calls back with |NO| on iOS 9 or above.");

@end

0 comments on commit 0839e8d

Please sign in to comment.