Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
64a148b
created a function call to get user's events from the server
businessglitch Apr 9, 2019
6ef4840
updated functions to store user's calendarID in the database
businessglitch Apr 9, 2019
f4ab2ff
Created api helper calls for server's database
businessglitch Apr 9, 2019
236eb57
Added a call to grab the accessToken from Google calendar
businessglitch Apr 9, 2019
3c396f2
Added new reducers for allEvents
businessglitch Apr 9, 2019
b387373
added a new function to getTokens
businessglitch Apr 9, 2019
b5134ac
Storing the value of the University
businessglitch Apr 9, 2019
ca9d461
refactored call to insertFixedEvents
businessglitch Apr 9, 2019
90428cf
Added Category type to events
businessglitch Apr 9, 2019
3a437ac
Merged local branch with CDHK-216
businessglitch Apr 9, 2019
895749c
revert this
businessglitch Apr 9, 2019
dcdd8b3
fixed typo and have error checking
businessglitch Apr 9, 2019
739b3c7
revert this
businessglitch Apr 9, 2019
90f5faf
new function call to get specific user info
businessglitch Apr 10, 2019
13375b3
code clean up
businessglitch Apr 10, 2019
82abece
Stored Unavailable hours in the database
businessglitch Apr 10, 2019
bd7c100
Merge branch 'dev' into feature/CDHK-174
MarieEveLegault Apr 10, 2019
7086d92
Fixed linter
MarieEveLegault Apr 10, 2019
3248b79
Fixed errors caused due to merge conflicts
businessglitch Apr 11, 2019
cb9b4f9
linter errors
businessglitch Apr 11, 2019
0f20149
Merge branch 'dev' into feature/CDHK-174
businessglitch Apr 11, 2019
5c09c38
remove events from google calendar on pressing the back button
businessglitch Apr 11, 2019
7425fb6
resolved merge conflicts
businessglitch Apr 11, 2019
9f94e41
linter errors
businessglitch Apr 11, 2019
26b7955
Merge branch 'dev' of github.com:CDH-Studio/Kalend into feature/CDHK-174
businessglitch Apr 12, 2019
4004584
Set FirebaseID for the User;
businessglitch Apr 12, 2019
fd93390
Added messaging for iOS
BenJeau Apr 12, 2019
2833d94
Merged with branch
BenJeau Apr 12, 2019
ddf3441
Added helper call for firebase
businessglitch Apr 12, 2019
15d1b5c
uuid package added
businessglitch Apr 12, 2019
4b7ab51
Merge branch 'feature/CDHK-174' of github.com:CDH-Studio/Kalend into …
businessglitch Apr 12, 2019
8ed4239
Added a helper call to get user info
businessglitch Apr 12, 2019
47d866f
changes to api
businessglitch Apr 12, 2019
01ba3a4
Added message listener
BenJeau Apr 12, 2019
1610834
Merged
BenJeau Apr 12, 2019
fe4c2c5
fix broken changes
businessglitch Apr 12, 2019
29442ff
Added firebase functions
BenJeau Apr 15, 2019
d4c110a
Removed the firebase functions in the client side
BenJeau Apr 15, 2019
549e632
Added notification system
BenJeau Apr 16, 2019
2c94325
Changed notificationID
BenJeau Apr 16, 2019
4f36b71
Added statuses for the notification
BenJeau Apr 16, 2019
e22215b
Fixed linter errors
BenJeau Apr 16, 2019
862d883
Set Calendar permission
businessglitch Apr 16, 2019
162edfb
merge conflicts
businessglitch Apr 16, 2019
542ec82
fix broken code
businessglitch Apr 16, 2019
72f9f3b
revert this
businessglitch Apr 16, 2019
45ad5bf
Finished screen for notifications in compare schedule
BenJeau Apr 16, 2019
db939f2
Merge branch 'feature/CDHK-174' of https://github.com/CDH-Studio/Kale…
BenJeau Apr 16, 2019
f433655
Added backend to the Allow in notification management screen
BenJeau Apr 16, 2019
bf46502
Merge branch 'feature/CDHK-174' of github.com:CDH-Studio/Kalend into …
businessglitch Apr 17, 2019
e09e8b1
reolved merge conflicts
businessglitch Apr 17, 2019
1563b58
resolved linter errors
businessglitch Apr 17, 2019
c50b31d
fix broken code
businessglitch Apr 17, 2019
db5a158
linter err
businessglitch Apr 17, 2019
419d86e
Added firebase database to iOS and fixed error if person is not in fi…
BenJeau Apr 18, 2019
3912eda
Changed FAB color to white in selection of picture, fixed modal capit…
BenJeau Apr 18, 2019
c455238
Fixed linter error
BenJeau Apr 18, 2019
1598dab
Fix broken code
businessglitch Apr 19, 2019
e50a5dc
error checking
businessglitch Apr 19, 2019
e35cf7b
fix broken code
businessglitch Apr 19, 2019
f0a7cb4
Adapted compare schedule to show the name if there is a name and a pi…
BenJeau Apr 19, 2019
09a66f7
Merged
BenJeau Apr 19, 2019
c55fb85
Patched client for email receiver/sender"
BenJeau Apr 19, 2019
f399219
Changed senderEmail/receiverEmail at places I forgot to change it
BenJeau Apr 19, 2019
405f9b7
Changed the ip of the server to AWS
BenJeau Apr 19, 2019
aa669f5
display name and picture on sharing calendar
businessglitch Apr 19, 2019
2642ce2
merge conflicts
businessglitch Apr 19, 2019
0df74cf
Fixed error on Allow click and notificationPath of undefined
BenJeau Apr 19, 2019
c7271c3
Merge branch 'feature/CDHK-174' of https://github.com/CDH-Studio/Kale…
BenJeau Apr 19, 2019
7688dd8
Merged in dev
BenJeau Apr 19, 2019
961eff9
Fixed errors
BenJeau Apr 19, 2019
5b2a7bb
oopsie
businessglitch Apr 20, 2019
d5f6dec
Merge branch 'feature/CDHK-174' of github.com:CDH-Studio/Kalend into …
businessglitch Apr 20, 2019
308240d
Fixed small bugs and removed unecessary packages
BenJeau Apr 24, 2019
b59a60f
linter err
businessglitch Apr 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/actions/allEvents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {ADD_EVENT, CLEAR_EVENTS} from '../constants/reducer_constants/allEvents';

export function clearAllEvents () {
const action = {
type: CLEAR_EVENTS
};

return action;
}

export function addEvents (event) {
const action = {
type: ADD_EVENT,
event
};

return action;
}



16 changes: 14 additions & 2 deletions src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
SET_SELECTED_SCHEDULE,
SET_UNAVAILABLE_HOURS,
SET_SCHOOL_INFORMATION,
SET_SELECTED_CALENDAR,
UPDATE_NFE,
SET_LANGUAGE,
SET_BOTTOM_STRINGS,
SET_IMG,
Expand All @@ -25,7 +27,6 @@ import {
DELETE_COURSE,
DELETE_GENERATED_CALENDAR,
UPDATE_FE,
UPDATE_NFE,
UPDATE_COURSE,
CLEAR_GENERATED_CALENDAR,
CLEAR_CALENDAR,
Expand All @@ -43,6 +44,7 @@ import {
CLEAR_DASHBOARD_DATA,
} from '../constants';

export * from './allEvents';

/*** UPDATE ***/
export function updateFixedEvents (index, event) {
Expand Down Expand Up @@ -249,6 +251,15 @@ export function setSchoolInformation (info) {
return action;
}

export function setSelectedCalendar(index) {
const action = {
type: SET_SELECTED_CALENDAR,
index
};

return action;
}

export function setLanguage (language) {
const action = {
type: SET_LANGUAGE,
Expand All @@ -257,6 +268,7 @@ export function setLanguage (language) {

return action;
}

export function setDashboardData (data) {
const action = {
type: SET_DASHBOARD_DATA,
Expand Down Expand Up @@ -422,4 +434,4 @@ export function clearBottomString () {
};

return action;
}
}
2 changes: 1 addition & 1 deletion src/components/screens/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Dashboard extends React.PureComponent {
}

componentDidMount() {
this.setState({isVisible: true});
this.setState({isVisible: true});
this.willFocusSubscription = this.props.navigation.addListener(
'willFocus',
() => {
Expand Down
60 changes: 43 additions & 17 deletions src/components/screens/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import updateNavigation from '../NavigationHelper';
import { bindActionCreators } from 'redux';
import { googleSignIn, googleIsSignedIn, googleGetCurrentUserInfo } from '../../services/google_identity';
import { createCalendar, getCalendarID2 } from '../../services/service';
import { storeUserInfoService, updateUser } from '../../services/api/storage_services';
import { homeStyles as styles } from '../../styles';
import { getStrings } from '../../services/helper';

Expand All @@ -33,27 +34,52 @@ class Home extends React.PureComponent {
* Sets the user information
*/
setUser = (userInfo) => {
this.props.logonUser(userInfo);
this.props.logonUser(userInfo);
storeUserInfoService(userInfo)
.then(res => res.json())
.then((success) => {
if (success) {
this.props.logonUser(userInfo);
this.setCalendar().then(id => {
updateUser({values:[id], columns:['CALENDARID']});
this.props.navigation.navigate(DashboardNavigator);
});
} else {
alert('There was an error setting Users data');
}
})
.catch((err) => {
console.log('err', err);
});
}

/**
* Creates the Kalend calendar in the user's Google Account
*/
setCalendar() {
getCalendarID2().then(data => {
if (data.calendarID === undefined) {
createCalendar().then(data => {
this.props.setCalendarID(data.calendarID);
this.props.setCalendarColor(data.calendarColor);
this.props.navigation.navigate(DashboardNavigator);
return new Promise( async (resolve, reject) => {
await getCalendarID2()
.then( data => {
if (data.calendarID === undefined) {
createCalendar()
.then(id => {
this.props.setCalendarID(id);
this.props.setCalendarColor(data.calendarColor);
resolve(id);
});
} else {

this.props.setCalendarID(data.calendarID);
this.props.setCalendarColor(data.calendarColor);
resolve(data.calendarID);
}
}).catch(err => {
reject(err);
alert(err);
});
} else {
this.props.setCalendarID(data.calendarID);
this.props.setCalendarColor(data.calendarColor);
this.props.navigation.navigate(DashboardNavigator);
}
});
}
}


/**
* Log In the user with their Google Account
Expand All @@ -75,18 +101,19 @@ class Home extends React.PureComponent {
googleGetCurrentUserInfo().then((userInfo) => {
if (userInfo !== undefined) {
this.setUser(userInfo);
this.setCalendar();
}
googleSignIn().then((userInfo) => {
if (userInfo !== null) {
this.setUser(userInfo);
this.setCalendar();
}
this.state.clicked = false;
});
});
} else {
this.setCalendar();
this.setCalendar().then(id => {
updateUser({values:[id], columns:['CALENDARID']});
});
this.props.navigation.navigate(DashboardNavigator);
}
});
}
Expand Down Expand Up @@ -120,7 +147,6 @@ class Home extends React.PureComponent {
color={GoogleSigninButton.Color.Light}
onPress={this.signIn} />
</View>

<TouchableOpacity style={styles.cdhSection}
onPress={ ()=>{
Linking.openURL('https://cdhstudio.ca/fr');
Expand Down
66 changes: 39 additions & 27 deletions src/components/screens/ReviewEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { StatusBar, ScrollView, View, Text, TouchableOpacity, Platform,Alert } f
import { FAB } from 'react-native-paper';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import { connect } from 'react-redux';
import { deleteCourse, deleteFixedEvent, deleteNonFixedEvent, clearGeneratedCalendars, clearGeneratedNonFixedEvents, clearCourse, clearFixedEvents, setNavigationScreen } from '../../actions';
import { deleteCourse, deleteFixedEvent, deleteNonFixedEvent, clearGeneratedCalendars, clearGeneratedNonFixedEvents, addEvents, clearCourse, clearFixedEvents, setNavigationScreen } from '../../actions';
import { SchoolScheduleRoute, FixedEventRoute, NonFixedEventRoute, ScheduleCreationRoute, SchoolInformationRoute, CourseRoute } from '../../constants/screenNames';
import EventOverview from '../EventOverview';
import updateNavigation from '../NavigationHelper';
import { store } from '../../store';
import { bindActionCreators } from 'redux';
import { storeGeneratedCalendars } from '../../services/api/storage_services';
import { reviewEventStyles as styles, white, blue, statusBlueColor } from '../../styles';
import { insertFixedEventsToGoogle } from '../../services/service';
import { getStrings } from '../../services/helper';
Expand Down Expand Up @@ -188,8 +190,8 @@ class ReviewEvent extends React.PureComponent {
* Goes to the appropriate Schedule Creation Screen
*/
navigateCreationScreen = () => {
this.props.dispatch(clearGeneratedCalendars());
this.props.dispatch(clearGeneratedNonFixedEvents());
this.props.clearGeneratedCalendars();
this.props.clearGeneratedNonFixedEvents();

if (this.state.schoolScheduleData.length == 0 && this.state.nonFixedEventData.length == 0 && this.state.fixedEventData.length == 0 ) {
Alert.alert(
Expand All @@ -203,29 +205,34 @@ class ReviewEvent extends React.PureComponent {
return;
}

if (this.state.nonFixedEventData.length == 0) {
insertFixedEventsToGoogle()
.then(() => {
this.props.dispatch(clearCourse());
this.props.dispatch(clearFixedEvents());
this.props.dispatch(setNavigationScreen({successfullyInsertedEvents: true}));
this.props.navigation.pop();
})
.catch(err => {
if (err) {
Alert.alert(
this.strings.error,
err,
[
{text: this.strings.ok},
],
{cancelable: false}
);
}
});
} else {
this.props.navigation.navigate(ScheduleCreationRoute, {title: getStrings().ScheduleCreation.title});
}
insertFixedEventsToGoogle()
.then((promises) => {
if (this.state.nonFixedEventData.length == 0) {
storeGeneratedCalendars(promises).then(success => {
if(success) {
this.props.clearCourse();
this.props.clearFixedEvents();
this.props.setNavigationScreen({successfullyInsertedEvents: true});
this.props.navigation.pop();
}
});
} else {
this.props.navigation.navigate(ScheduleCreationRoute, {title: getStrings().ScheduleCreation.title});
}
})
.catch(err => {
console.log('err', err);
if (err) {
Alert.alert(
this.strings.error,
err,
[
{text: this.strings.ok},
],
{cancelable: false}
);
}
});
}

render() {
Expand Down Expand Up @@ -359,4 +366,9 @@ function mapStateToProps(state) {
};
}

export default connect(mapStateToProps, null)(ReviewEvent);

let mapDispatchToProps = (dispatch) => {
return bindActionCreators({ addEvents, clearGeneratedNonFixedEvents, clearGeneratedCalendars, clearCourse, clearFixedEvents, setNavigationScreen}, dispatch);
};

export default connect(mapStateToProps, mapDispatchToProps)(ReviewEvent);
37 changes: 12 additions & 25 deletions src/components/screens/ScheduleCreation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { StatusBar, BackHandler, Alert, Text, View, Platform } from 'react-nativ
import * as Progress from 'react-native-progress';
import { Surface } from 'react-native-paper';
import { HeaderBackButton } from 'react-navigation';
import { generateCalendars, setUserInfo, insertFixedEventsToGoogle } from '../../services/service';
import { generateCalendars, setUserInfo } from '../../services/service';
import { connect } from 'react-redux';
import { addEvents } from '../../actions';
import { bindActionCreators } from 'redux';
import { DashboardNavigator, ScheduleSelectionRoute, ReviewEventRoute } from '../../constants/screenNames';
import { scheduleCreateStyles as styles, dark_blue, white } from '../../styles';
import updateNavigation from '../NavigationHelper';
Expand Down Expand Up @@ -39,29 +41,10 @@ class ScheduleCreation extends React.PureComponent {
componentWillMount() {
// Adds a little delay before going to the next screen
setUserInfo();
insertFixedEventsToGoogle()
.then(() => {
if (this.props.NonFixedEventsReducer.length != 0) {
setTimeout(() =>{
this.generateScheduleService();
}, 3000);
} else {
this.setState({goToNextScreen: true});
this.navigateToSelection();
}
})
.catch(err => {
if (err) {
Alert.alert(
this.strings.error,
err,
[
{text: this.strings.ok, onPress: () => this.props.navigation.pop()},
],
{cancelable: false}
);
}
});
setTimeout(() =>{
this.generateScheduleService();
}, 3000);

BackHandler.addEventListener('hardwareBackPress', this.handleBackButton);
this.props.navigation.setParams({onBackPress: this.handleBackButton});
}
Expand Down Expand Up @@ -154,4 +137,8 @@ let mapStateToProps = (state) => {
};
};

export default connect(mapStateToProps, null)(ScheduleCreation);
let mapDispatchToProps = (dispatch) => {
return bindActionCreators({ addEvents }, dispatch);
};

export default connect(mapStateToProps, mapDispatchToProps)(ScheduleCreation);
2 changes: 1 addition & 1 deletion src/components/screens/ScheduleSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Platform, StatusBar, View, BackHandler, Alert, Text, ScrollView, Dimensions, TouchableOpacity, FlatList } from 'react-native';
import { connect } from 'react-redux';
import { HeaderBackButton } from 'react-navigation';
import { setSelectedSchedule, deleteGeneratedCalendar, clearGeneratedCalendars, clearGeneratedNonFixedEvents } from '../../actions';
import { setSelectedSchedule, deleteGeneratedCalendar, clearGeneratedCalendars, clearGeneratedNonFixedEvents} from '../../actions';
import { calendarColors, calendarInsideColors } from '../../../config/config';
import { DashboardNavigator, ScheduleSelectionDetailsRoute, ReviewEventRoute } from '../../constants/screenNames';
import updateNavigation from '../NavigationHelper';
Expand Down
Loading