Skip to content

Commit

Permalink
Merge pull request #39 from UCSD/v2.2fixes
Browse files Browse the repository at this point in the history
V2.2fixes
  • Loading branch information
a6wu authored Sep 15, 2016
2 parents ba276b4 + a6c8057 commit 6665215
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
22 changes: 18 additions & 4 deletions app/views/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,21 @@ var Home = React.createClass({
}

else {
this.setState({locationPermission: 'authorized'});
navigator.geolocation.getCurrentPosition(
(initialPosition) => { this.setState({currentPosition: initialPosition}) },
(error) => logger.log('ERR: navigator.geolocation.getCurrentPosition: ' + error.message),
{enableHighAccuracy: true, timeout: 20000, maximumAge: 1000}
);
this.geolocationWatchID = navigator.geolocation.watchPosition((currentPosition) => {
let lastPos = this.state.currentPosition;
this.setState({ currentPosition });

// Initial refresh
if(lastPos === null ) {
this.refreshAllCards('auto');
}
});
// Load all non-broken-out Cards
this.refreshAllCards('auto');
}
},

Expand Down Expand Up @@ -159,11 +164,20 @@ var Home = React.createClass({
if (response === "authorized") {
if(this.state.currentPosition === null ) {
this.geolocationWatchID = navigator.geolocation.watchPosition((currentPosition) => {
let lastPos = this.state.currentPosition;
this.setState({ currentPosition });

// Initial refresh
if(lastPos === null ) {
this.refreshAllCards('auto');
}
});
}
// Load all non-broken-out Cards
this.refreshAllCards('auto');
else {
// Load all non-broken-out Cars
this.refreshAllCards('auto');
}

} else {
this._requestPermission();
//this._alertForLocationPermission();
Expand Down
4 changes: 2 additions & 2 deletions app/views/welcomeWeek/WelcomeWeekView.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export default class WelcomeWeekView extends Component {
// Remove event from responses
// Add to row data
if(responseData[j].EventCollege === college.name) {
rowIDs[i].push(responseData[j].EventID);
dataBlob[college.name + ':' + responseData[j].EventID] = responseData.splice(j, 1)[0];
rowIDs[i].push(responseData[j].wtsEventID);
dataBlob[college.name + ':' + responseData[j].wtsEventID] = responseData.splice(j, 1)[0];
--j;
}
}
Expand Down

0 comments on commit 6665215

Please sign in to comment.