Skip to content

Commit

Permalink
Pull down to refresh implemented (#132)
Browse files Browse the repository at this point in the history
* Added react-native-cli to avoid onboarding issues in the future

* Pull down to refresh implemented in profile page

* Pull down to refresh implemented in Repository page. Closes #103.

* Fixed some merge issues

* Fixing some more merging issues

* Forgot to add myself as a contributor.

* Fetching user data and fetching repository data have been moved into their own functions.

* Fixed some merge issues.

* Renamed the function that fetches the information to be a bit more descriptive

* Again, fixing my own merge issues. Doing it here with code highlight and VSCode yelling at me is easier than on the Github editor.

* Fixed some merge issues, _again_

* Added pull to refresh to the non auth profile screen. Other minor improv.

* Fixing indentation inside of `<ScrollView />`

* Removing extra newline

* Adding a newline between our components and vendor components.

* Added myself as a contributor. Code and Bug Reports

* Valid NPM versions need to include three parts (x.y.z)

* Removed the double ScrollView. Parallax can now take in refreshControl. Profile Screen, Repo, and Auth User screen have pull to refresh.

* Pull down to refresh now in Issue/PR page (comment list)

* Fixed some merging issues and yarn lockfile

* Organizations are now refreshable

* Better behavior on the AuthUser pull to refresh

* Even better experience when refreshing AuthProfile. Now we have a flag when we _have_ a profile

* Refreshing on Issues (specifically) works again

* Used '!!' instead of '|| false' as per suggestion 

Temporal fix, I still want to figure out why isPendingComments and isPendingIssue are undefined.
  • Loading branch information
SammyIsra authored and Houssein Djirdeh committed Jul 31, 2017
1 parent 278fac2 commit b7fb8f8
Show file tree
Hide file tree
Showing 11 changed files with 273 additions and 105 deletions.
10 changes: 10 additions & 0 deletions .all-contributorsrc
Expand Up @@ -183,6 +183,16 @@
"code"
]
},
{
"login": "SammyIsra",
"name": "Sammy Israwi",
"avatar_url": "https://avatars0.githubusercontent.com/u/8962228?v=4",
"profile": "https://github.com/SammyIsra",
"contributions": [
"code",
"bug"
]
},
{
"login": "RogerAbyss",
"name": "Chao Ren",
Expand Down
8 changes: 4 additions & 4 deletions README.md
@@ -1,6 +1,6 @@
<h1 align="center"> GitPoint </h1> <br>
<p align="center">
 <a href="https://gitpoint.co/">
<a href="https://gitpoint.co/">
<img alt="GitPoint" title="GitPoint" src="http://i.imgur.com/VShxJHs.png" width="450">
</a>
</p>
Expand All @@ -17,8 +17,8 @@

## Introduction

[![Build Status](https://img.shields.io/travis/gitpoint/git-point/master.svg?style=flat-square)](https://travis-ci.org/gitpoint/git-point)
[![All Contributors](https://img.shields.io/badge/all_contributors-19-orange.svg?style=flat-square)](#contributors)
[![Build Status](https://img.shields.io/travis/gitpoint/git-point.svg?style=flat-square)](https://travis-ci.org/gitpoint/git-point)
[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![Gitter chat](https://img.shields.io/badge/chat-on_gitter-008080.svg?style=flat-square)](https://gitter.im/git-point)

Expand Down Expand Up @@ -67,5 +67,5 @@ Please take a look at the [contributing guidelines](./CONTRIBUTING.md) for a det
| [<img src="https://avatars0.githubusercontent.com/u/12476932?v=3" width="100px;"/><br /><sub>Houssein Djirdeh</sub>](https://houssein.me)<br />[💬](#question-housseindjirdeh "Answering Questions") [💻](https://github.com/gitpoint/git-point/commits?author=housseindjirdeh "Code") [🎨](#design-housseindjirdeh "Design") [📖](https://github.com/gitpoint/git-point/commits?author=housseindjirdeh "Documentation") [👀](#review-housseindjirdeh "Reviewed Pull Requests") | [<img src="https://avatars2.githubusercontent.com/u/16705071?v=3" width="100px;"/><br /><sub>gejose</sub>](https://github.com/gejose)<br />[💻](https://github.com/gitpoint/git-point/commits?author=gejose "Code") | [<img src="https://avatars3.githubusercontent.com/u/14151327?v=3" width="100px;"/><br /><sub>rmevans9</sub>](https://github.com/rmevans9)<br />[💻](https://github.com/gitpoint/git-point/commits?author=rmevans9 "Code") | [<img src="https://avatars1.githubusercontent.com/u/4408379?v=3" width="100px;"/><br /><sub>Alexey Pyltsyn</sub>](http://lex111.ru)<br />[💻](https://github.com/gitpoint/git-point/commits?author=lex111 "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3Alex111 "Bug reports") | [<img src="https://avatars2.githubusercontent.com/u/10660468?v=3" width="100px;"/><br /><sub>Jason Etcovitch</sub>](https://jasonet.co)<br />[💻](https://github.com/gitpoint/git-point/commits?author=JasonEtco "Code") | [<img src="https://avatars1.githubusercontent.com/u/1166143?v=3" width="100px;"/><br /><sub>Hosmel Quintana</sub>](http://hosmelq.com)<br />[💻](https://github.com/gitpoint/git-point/commits?author=hosmelq "Code") | [<img src="https://avatars0.githubusercontent.com/u/464978?v=3" width="100px;"/><br /><sub>Alejandro Ñáñez Ortiz</sub>](http://co.linkedin.com/in/alejandronanez/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=alejandronanez "Code") [👀](#review-alejandronanez "Reviewed Pull Requests") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [<img src="https://avatars3.githubusercontent.com/u/3055294?v=3" width="100px;"/><br /><sub>Patrick Wang</sub>](https://patw.me)<br />[💻](https://github.com/gitpoint/git-point/commits?author=patw0929 "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3Apatw0929 "Bug reports") | [<img src="https://avatars5.githubusercontent.com/u/627794?v=4" width="100px;"/><br /><sub>Mike Kavouras</sub>](https://github.com/mikekavouras)<br />[💻](https://github.com/gitpoint/git-point/commits?author=mikekavouras "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3Amikekavouras "Bug reports") | [<img src="https://avatars4.githubusercontent.com/u/4848554?v=4" width="100px;"/><br /><sub>Peter Lazar</sub>](https://github.com/peterlazar1993)<br />[💻](https://github.com/gitpoint/git-point/commits?author=peterlazar1993 "Code") | [<img src="https://avatars6.githubusercontent.com/u/5106887?v=4" width="100px;"/><br /><sub>June Domingo</sub>](https://github.com/junedomingo)<br />[💻](https://github.com/gitpoint/git-point/commits?author=junedomingo "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3Ajunedomingo "Bug reports") | [<img src="https://avatars7.githubusercontent.com/u/9287184?v=4" width="100px;"/><br /><sub>Antoine</sub>](http://www.jaaccelere.com)<br />[💻](https://github.com/gitpoint/git-point/commits?author=Antoine38660 "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3AAntoine38660 "Bug reports") | [<img src="https://avatars6.githubusercontent.com/u/13142418?v=4" width="100px;"/><br /><sub>Wang Shidong</sub>](https://wsdjeg.github.io)<br />[💻](https://github.com/gitpoint/git-point/commits?author=wsdjeg "Code") | [<img src="https://avatars4.githubusercontent.com/u/2190589?v=4" width="100px;"/><br /><sub>Swapnil Joshi</sub>](http://swapnilmj.users.sourceforge.net/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=swapnilmj "Code") |
| [<img src="https://avatars5.githubusercontent.com/u/408959?v=4" width="100px;"/><br /><sub>Rolf Koenders</sub>](https://github.com/RolfKoenders)<br />[💻](https://github.com/gitpoint/git-point/commits?author=RolfKoenders "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3ARolfKoenders "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/10191084?v=4" width="100px;"/><br /><sub>Andrew Dassonville</sub>](https://andrewda.me)<br />[💻](https://github.com/gitpoint/git-point/commits?author=andrewda "Code") [💬](#question-andrewda "Answering Questions") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3Aandrewda "Bug reports") [👀](#review-andrewda "Reviewed Pull Requests") | [<img src="https://avatars0.githubusercontent.com/u/2076088?v=4" width="100px;"/><br /><sub>Anton</sub>](https://medium.com/@antondomashnev)<br />[💻](https://github.com/gitpoint/git-point/commits?author=Antondomashnev "Code") | [<img src="https://avatars0.githubusercontent.com/u/14795799?v=4" width="100px;"/><br /><sub>Xuezheng Ma</sub>](https://github.com/xuezhma)<br />[💻](https://github.com/gitpoint/git-point/commits?author=xuezhma "Code") | [<img src="https://avatars1.githubusercontent.com/u/8122587?v=4" width="100px;"/><br /><sub>Chao Ren</sub>](https://github.com/RogerAbyss)<br />[🐛](https://github.com/gitpoint/git-point/issues?q=author%3ARogerAbyss "Bug reports") [💻](https://github.com/gitpoint/git-point/commits?author=RogerAbyss "Code") |
| [<img src="https://avatars5.githubusercontent.com/u/408959?v=4" width="100px;"/><br /><sub>Rolf Koenders</sub>](https://github.com/RolfKoenders)<br />[💻](https://github.com/gitpoint/git-point/commits?author=RolfKoenders "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3ARolfKoenders "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/10191084?v=4" width="100px;"/><br /><sub>Andrew Dassonville</sub>](https://andrewda.me)<br />[💻](https://github.com/gitpoint/git-point/commits?author=andrewda "Code") [💬](#question-andrewda "Answering Questions") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3Aandrewda "Bug reports") [👀](#review-andrewda "Reviewed Pull Requests") | [<img src="https://avatars0.githubusercontent.com/u/2076088?v=4" width="100px;"/><br /><sub>Anton</sub>](https://medium.com/@antondomashnev)<br />[💻](https://github.com/gitpoint/git-point/commits?author=Antondomashnev "Code") | [<img src="https://avatars0.githubusercontent.com/u/14795799?v=4" width="100px;"/><br /><sub>Xuezheng Ma</sub>](https://github.com/xuezhma)<br />[💻](https://github.com/gitpoint/git-point/commits?author=xuezhma "Code") | [<img src="https://avatars0.githubusercontent.com/u/8962228?v=4" width="100px;"/><br /><sub>Sammy Israwi</sub>](https://github.com/SammyIsra)<br />[💻](https://github.com/gitpoint/git-point/commits?author=SammyIsra "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3ASammyIsra "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/8122587?v=4" width="100px;"/><br /><sub>Chao Ren</sub>](https://github.com/RogerAbyss)<br />[🐛](https://github.com/gitpoint/git-point/issues?q=author%3ARogerAbyss "Bug reports") [💻](https://github.com/gitpoint/git-point/commits?author=RogerAbyss "Code") |
<!-- ALL-CONTRIBUTORS-LIST:END -->
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -99,6 +99,7 @@
"lint-staged": "^3.2.6",
"pre-commit": "^1.2.2",
"prettier": "^1.3.1",
"react-native-cli": "^2.0.1",
"react-test-renderer": "16.0.0-alpha.6"
},
"jest": {
Expand Down
3 changes: 3 additions & 0 deletions src/auth/auth.reducer.js
Expand Up @@ -12,6 +12,7 @@ const initialState = {
isAuthenticated: false,
accessToken: null,
user: {},
hasInitialUser: false,
orgs: [],
events: [],
isPendingUser: false,
Expand Down Expand Up @@ -50,6 +51,7 @@ export const authReducer = (state = initialState, action = {}) => {
case LOGOUT.SUCCESS:
return {
...initialState,
hasInitialUser: false,
};
case LOGOUT.FAILURE:
return {
Expand All @@ -67,6 +69,7 @@ export const authReducer = (state = initialState, action = {}) => {
...state,
user: action.payload,
isPendingUser: false,
hasInitialUser: true,
};
case GET_AUTH_USER.ERROR:
return {
Expand Down
108 changes: 65 additions & 43 deletions src/auth/screens/auth-profile.screen.js
@@ -1,14 +1,18 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { StyleSheet, Text, TouchableOpacity } from 'react-native';
import {
StyleSheet,
Text,
TouchableOpacity,
RefreshControl,
} from 'react-native';
import { ListItem } from 'react-native-elements';
import codePush from 'react-native-code-push';

import {
ViewContainer,
UserProfile,
SectionList,
LoadingContainer,
ParallaxScroll,
UserListItem,
EntityInfo,
Expand All @@ -23,6 +27,7 @@ const mapStateToProps = state => ({
orgs: state.auth.orgs,
isPendingUser: state.auth.isPendingUser,
isPendingOrgs: state.auth.isPendingOrgs,
hasInitialUser: state.auth.hasInitialUser,
});

const mapDispatchToProps = dispatch => ({
Expand Down Expand Up @@ -85,6 +90,7 @@ class AuthProfile extends Component {
orgs: Array,
isPendingUser: boolean,
isPendingOrgs: boolean,
hasInitialUser: boolean,
navigation: Object,
};

Expand All @@ -93,8 +99,7 @@ class AuthProfile extends Component {
};

componentDidMount() {
this.props.getUserByDispatch();
this.props.getOrgsByDispatch();
this.refreshProfile();
}

checkForUpdate = () => {
Expand All @@ -115,6 +120,11 @@ class AuthProfile extends Component {
}
};

refreshProfile = () => {
this.props.getUserByDispatch();
this.props.getOrgsByDispatch();
};

signOutUser() {
const { signOutByDispatch, navigation } = this.props;

Expand All @@ -127,36 +137,50 @@ class AuthProfile extends Component {
}

render() {
const { user, orgs, isPendingUser, isPendingOrgs, navigation } = this.props;
const {
user,
orgs,
isPendingUser,
isPendingOrgs,
navigation,
hasInitialUser,
} = this.props;

const loading = isPendingUser || isPendingOrgs;

return (
<ViewContainer>
{loading && <LoadingContainer animating={loading} center />}

{!loading &&
<ParallaxScroll
renderContent={() =>
<UserProfile
type="user"
initialUser={user}
user={user}
navigation={navigation}
/>}
stickyTitle={user.login}
>
{user.bio &&
user.bio !== '' &&
<SectionList title="BIO">
<ListItem
subtitle={emojifyText(user.bio)}
subtitleStyle={styles.listSubTitle}
hideChevron
/>
</SectionList>}
<ParallaxScroll
renderContent={() =>
<UserProfile
type="user"
initialUser={hasInitialUser ? user : {}}
user={hasInitialUser ? user : {}}
navigation={navigation}
/>}
refreshControl={
<RefreshControl
refreshing={loading}
onRefresh={this.refreshProfile}
/>
}
stickyTitle={user.login}
>
{hasInitialUser &&
user.bio &&
user.bio !== '' &&
<SectionList title="BIO">
<ListItem
subtitle={emojifyText(user.bio)}
subtitleStyle={styles.listSubTitle}
hideChevron
/>
</SectionList>}

<EntityInfo entity={user} orgs={orgs} navigation={navigation} />
{!loading &&
<EntityInfo entity={user} orgs={orgs} navigation={navigation} />}

{!isPendingOrgs &&
<SectionList
title="ORGANIZATIONS"
noItems={orgs.length === 0}
Expand All @@ -179,8 +203,9 @@ class AuthProfile extends Component {
You may have to request approval for them.
</Text>
</Text>
</SectionList>
</SectionList>}

{!loading &&
<SectionList>
<ListItem
title="Privacy Policy"
Expand All @@ -194,20 +219,17 @@ class AuthProfile extends Component {
hideChevron
onPress={() => this.signOutUser()}
/>
</SectionList>

<TouchableOpacity
style={styles.update}
onPress={this.checkForUpdate}
>
<Text style={styles.updateText}>
GitPoint v{version}
</Text>
<Text style={[styles.updateText, styles.updateTextSub]}>
{this.state.updateText}
</Text>
</TouchableOpacity>
</ParallaxScroll>}
</SectionList>}

<TouchableOpacity style={styles.update} onPress={this.checkForUpdate}>
<Text style={styles.updateText}>
GitPoint v{version}
</Text>
<Text style={[styles.updateText, styles.updateTextSub]}>
{this.state.updateText}
</Text>
</TouchableOpacity>
</ParallaxScroll>
</ViewContainer>
);
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/parallax-scroll.component.js
Expand Up @@ -17,6 +17,7 @@ type Props = {
menuAction?: Function,
navigation: Object,
children?: React.Element<*>,
refreshControl?: React.Element<*>,
};

const styles = StyleSheet.create({
Expand Down Expand Up @@ -59,6 +60,7 @@ export const ParallaxScroll = ({
menuAction,
navigation,
children,
refreshControl,
}: Props) =>
<ParallaxScrollView
backgroundColor={colors.primaryDark}
Expand Down Expand Up @@ -102,6 +104,7 @@ export const ParallaxScroll = ({
/>
</View>}
</View>}
refreshControl={refreshControl}
>
{children}
</ParallaxScrollView>;
Expand All @@ -111,4 +114,5 @@ ParallaxScroll.defaultProps = {
showMenu: false,
menuAction: undefined,
children: null,
refreshControl: null,
};

0 comments on commit b7fb8f8

Please sign in to comment.