Skip to content

Commit

Permalink
firebase authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
sampocs committed Apr 8, 2019
1 parent 8c2a40a commit fe735e8
Show file tree
Hide file tree
Showing 13 changed files with 1,001 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ npm-debug.*
*.p12
*.key
*.mobileprovision
firebaseConfig.js
6 changes: 6 additions & 0 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import { createStore } from 'redux'
import { Provider } from 'react-redux';
import mainReducer from './reducers/mainReducer.js'

import firebase from 'firebase';
import { firebaseConfig } from './firebaseConfig'
if (!firebase.apps.length) {
firebase.initializeApp(firebaseConfig);
}

const store = createStore(mainReducer)

export default class App extends React.Component {
Expand Down
12 changes: 12 additions & 0 deletions actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export const SELECT_TODAY = 'SELECT_TODAY'
export const ADD_HABIT_TO_SETTINGS = 'ADD_HABIT_TO_SETTINGS'
export const ADD_HABIT_TO_HISTORY = 'ADD_HABIT_TO_HISTORY'
export const UPDATE_NOTES = 'UPDATE_NOTES'
export const UPDATE_EMAIL = 'UPDATE_EMAIL'
export const UPDATE_FIREBASE_USER = 'UPDATE_FIREBASE_USER'


//Action Creators
Expand Down Expand Up @@ -88,4 +90,14 @@ export const updateNote = (habitName, date, notes) => ({
habitName,
date,
notes
})

export const updateEmail = (email) => ({
type: UPDATE_EMAIL,
email
})

export const updateFirebaseUser = (firebaseUser) => ({
type: UPDATE_FIREBASE_USER,
firebaseUser
})
4 changes: 4 additions & 0 deletions assets/data/dummyData.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ dummyData.settings.habitSettings = {
icon: 'broom'
}
}
dummyData.settings.user = {
email: '',
firebaseUser: {}
}



Expand Down
8 changes: 8 additions & 0 deletions constants/FirebaseErrors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
DuplicateEmail: 'auth/email-already-in-use',
InvalidEmail: 'auth/invalid-email',
WeakPassword: 'auth/weak-password',
WrongPassword: 'auth/wrong-password',
UserNotFound: 'auth/user-not-found',
PermissionDenied: 'permission-denied'
}
1 change: 0 additions & 1 deletion navigation/AppNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import MetricsHomeScreen from '../screens/MetricsHomeScreen';
export default createAppContainer(createSwitchNavigator({
//For development purposes, place your desired screen on top (rememeber to import the screen)
//i.e. (Start: MetricsSpecificHabitScreen),
Start: MainTabNavigator,
Auth: AuthenticationNavigator,
Main: MainTabNavigator,
}));
Loading

0 comments on commit fe735e8

Please sign in to comment.