Skip to content

Commit 507a1e3

Browse files
committed
WIP
1 parent ae424b4 commit 507a1e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+813
-3030
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ buck-out/
4040
android/app/libs
4141
android/keystores/debug.keystore
4242
Releases/
43+
ios/Pods
44+
config/development.ios.js
45+
config/development.js

app/views/Authentication/Demos/Providers.js

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,37 @@ import React from 'react'
33
import {
44
View,
55
Text,
6+
NativeModules
67
} from 'react-native'
78

9+
import env from '../../../../config/environment';
10+
import { Container, Header, Title, Content, Button } from 'native-base';
811
import appStyles from '../../../styles/app';
12+
import OAuthManager from 'react-native-oauth';
913

14+
const supportedProviders = OAuthManager.providers();
1015
export class Providers extends React.Component {
1116

1217
componentWillMount() {
1318
const {firestack} = this.props;
19+
const manager = new OAuthManager('firestackexample')
20+
manager.configure(env.auth);
21+
22+
this.manager = manager;
23+
}
24+
25+
loginWith(provider) {
26+
return (evt) => {
27+
console.log('loginWith', provider);
28+
this.manager
29+
.authorize(provider, {})
30+
.then(resp => {
31+
console.log('response ->', resp);
32+
})
33+
.catch(err => {
34+
console.log('error ->', err);
35+
})
36+
}
1437
}
1538

1639
componentWillUnmount() {
@@ -19,13 +42,19 @@ export class Providers extends React.Component {
1942

2043
render() {
2144
return (
22-
<View>
23-
<View style={appStyles.container}>
24-
<Text>
25-
This is a test for dealing with Auth.
26-
</Text>
27-
</View>
28-
</View>
45+
<Container>
46+
<Content>
47+
{supportedProviders.map(provider => {
48+
return (
49+
<Button
50+
key={provider}
51+
onPress={this.loginWith(provider)}>
52+
Login with {provider}
53+
</Button>
54+
)
55+
})}
56+
</Content>
57+
</Container>
2958
)
3059
}
3160

config/development.example.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
module.exports = {
22
firestack: {
3-
debug: '*',
4-
apiKey: "Your api key",
5-
authDomain: "Your auth domain",
6-
databaseURL: "Your database url",
7-
storageBucket: "Your storage bucket",
8-
googleAppId: 'Your google app ID'
9-
}
3+
debug: '*',
4+
apiKey: "Your api key",
5+
authDomain: "Your auth domain",
6+
databaseURL: "Your database url",
7+
storageBucket: "Your storage bucket",
8+
googleAppId: 'Your google app ID'
9+
},
10+
auth: {}
1011
}

config/development.ios.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
module.exports = {
22
firestack: {
33
debug: '*',
4-
cloudMessaging: {
5-
enabled: true
6-
}
74
}
85
}

config/development.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
firestack: {
33
debug: '*',
4-
}
4+
},
5+
auth: {}
56
}

ios/FirestackApp.xcodeproj/project.pbxproj

Lines changed: 62 additions & 13 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "242347836210DA0FD81821B3FF38531CD63A6B4C",
3+
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
4+
5+
},
6+
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
7+
"185F96754A06BC8FF2134DF1E4AA46B641DBED2D" : 0,
8+
"242347836210DA0FD81821B3FF38531CD63A6B4C" : 0
9+
},
10+
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "64B9E901-CA6F-4A7C-9DB7-CD4AA859D2A4",
11+
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
12+
"185F96754A06BC8FF2134DF1E4AA46B641DBED2D" : "OAuthManager\/",
13+
"242347836210DA0FD81821B3FF38531CD63A6B4C" : "FirestackApp\/"
14+
},
15+
"DVTSourceControlWorkspaceBlueprintNameKey" : "FirestackApp",
16+
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
17+
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "ios\/FirestackApp.xcworkspace",
18+
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
19+
{
20+
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:fullstackreact\/react-native-oauth.git",
21+
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
22+
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "185F96754A06BC8FF2134DF1E4AA46B641DBED2D"
23+
},
24+
{
25+
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:fullstackio\/FirestackApp.git",
26+
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
27+
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "242347836210DA0FD81821B3FF38531CD63A6B4C"
28+
}
29+
]
30+
}

ios/FirestackApp/AppDelegate.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#import "RCTBundleURLProvider.h"
1313
#import "RCTRootView.h"
14+
#import "OAuthManager.h"
1415

1516
@implementation AppDelegate
1617

@@ -29,9 +30,22 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2930
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
3031
UIViewController *rootViewController = [UIViewController new];
3132
rootViewController.view = rootView;
33+
34+
[OAuthManager setupOAuthHandler:application
35+
andDelegate:self
36+
view:rootView];
37+
3238
self.window.rootViewController = rootViewController;
3339
[self.window makeKeyAndVisible];
3440
return YES;
3541
}
3642

43+
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
44+
NSLog(@"application openURL called: %@", url);
45+
return [OAuthManager handleOpenUrl:application
46+
openURL:url
47+
sourceApplication:sourceApplication
48+
annotation:annotation];
49+
}
50+
3751
@end

ios/FirestackApp/Info.plist

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,27 @@
1818
<string>1.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
21+
<key>CFBundleURLTypes</key>
22+
<array>
23+
<dict>
24+
<key>CFBundleTypeRole</key>
25+
<string>Editor</string>
26+
<key>CFBundleURLName</key>
27+
<string>io.fullstack.FirestackExample</string>
28+
<key>CFBundleURLSchemes</key>
29+
<array>
30+
<string>firestackexample</string>
31+
</array>
32+
</dict>
33+
</array>
2134
<key>CFBundleVersion</key>
2235
<string>76</string>
2336
<key>LSRequiresIPhoneOS</key>
2437
<true/>
2538
<key>NSAppTransportSecurity</key>
2639
<dict>
40+
<key>NSAllowsArbitraryLoads</key>
41+
<true/>
2742
<key>NSExceptionDomains</key>
2843
<dict>
2944
<key>localhost</key>

ios/Podfile

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
source 'https://github.com/CocoaPods/Specs.git'
2-
#platform :ios, '8.0'
2+
platform :ios, '8.0'
33

44
def firestack_pods
55
[
@@ -16,15 +16,6 @@ def firestack_pods
1616
end
1717

1818
target 'FirestackApp' do
19-
use_frameworks!
2019
firestack_pods
21-
pod 'OAuthSwift', '~> 0.5.2'
22-
end
23-
24-
post_install do |installer|
25-
installer.pods_project.build_configurations.each do |config|
26-
# Configure Pod targets for Xcode 8 compatibility
27-
config.build_settings['SWIFT_VERSION'] = '2.1'
28-
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES'
29-
end
20+
pod 'DCTAuth', :git => 'https://github.com/danielctull/DCTAuth.git'
3021
end

0 commit comments

Comments
 (0)