Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,15 @@
"contributions": [
"code"
]
},
{
"login": "Arjun-sna",
"name": "Arjun",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

"avatar_url": "https://avatars3.githubusercontent.com/u/9337254?v=4",
"profile": "https://github.com/Arjun-sna",
"contributions": [
"code"
]
}
]
}
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ Thank you to all the people who have already contributed to GitPoint!
| [<img src="https://avatars3.githubusercontent.com/u/5528931?v=4" width="100px;"/><br /><sub><b>Dyesse YUMBA</b></sub>](https://github.com/dyesseyumba)<br />[🔧](#tool-dyesseyumba "Tools") | [<img src="https://avatars0.githubusercontent.com/u/20456165?v=4" width="100px;"/><br /><sub><b>Bink</b></sub>](https://binkpitch.me/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=binkpitch "Code") | [<img src="https://avatars2.githubusercontent.com/u/10085841?v=4" width="100px;"/><br /><sub><b>khvilaboa</b></sub>](https://github.com/khvilaboa)<br />[🌍](#translation-khvilaboa "Translation") | [<img src="https://avatars1.githubusercontent.com/u/40802?v=4" width="100px;"/><br /><sub><b>James Glover</b></sub>](http://jamesmglover.com)<br />[💻](https://github.com/gitpoint/git-point/commits?author=jglover "Code") [⚠️](https://github.com/gitpoint/git-point/commits?author=jglover "Tests") | [<img src="https://avatars2.githubusercontent.com/u/3025600?v=4" width="100px;"/><br /><sub><b>Jose Luis Naranjo</b></sub>](https://co.linkedin.com/in/josenaranjo/en)<br />[💻](https://github.com/gitpoint/git-point/commits?author=josenaranjo "Code") | [<img src="https://avatars0.githubusercontent.com/u/1285032?v=4" width="100px;"/><br /><sub><b>Tobias Lohse</b></sub>](http://MrLoh.se)<br />[💻](https://github.com/gitpoint/git-point/commits?author=MrLoh "Code") |
| [<img src="https://avatars3.githubusercontent.com/u/5467717?v=4" width="100px;"/><br /><sub><b>Serhii Baraniuk</b></sub>](https://www.facebook.com/serhii.baraniuk)<br />[⚠️](https://github.com/gitpoint/git-point/commits?author=kenitive "Tests") | [<img src="https://avatars2.githubusercontent.com/u/57701?v=4" width="100px;"/><br /><sub><b>Ben Snider</b></sub>](http://www.bensnider.com/)<br />[⚠️](https://github.com/gitpoint/git-point/commits?author=stupergenius "Tests") | [<img src="https://avatars1.githubusercontent.com/u/23706543?v=4" width="100px;"/><br /><sub><b>Simon Hoyos</b></sub>](https://www.linkedin.com/in/simonhoyos/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=shmesa22 "Code") [🎨](#design-shmesa22 "Design") | [<img src="https://avatars3.githubusercontent.com/u/10438692?v=4" width="100px;"/><br /><sub><b>Damien Leroy</b></sub>](https://github.com/ShiiFu)<br />[🌍](#translation-ShiiFu "Translation") | [<img src="https://avatars1.githubusercontent.com/u/686676?v=4" width="100px;"/><br /><sub><b>botbotbot</b></sub>](http://dev.im-bot.com)<br />[⚠️](https://github.com/gitpoint/git-point/commits?author=ibotdotout "Tests") | [<img src="https://avatars1.githubusercontent.com/u/8254906?v=4" width="100px;"/><br /><sub><b>Dmytro Kytsmen</b></sub>](https://github.com/Kietzmann)<br />[🌍](#translation-Kietzmann "Translation") |
| [<img src="https://avatars0.githubusercontent.com/u/3683673?v=4" width="100px;"/><br /><sub><b>TheCodeTalker</b></sub>](https://thecodetalker.github.io/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=TheCodeTalker "Code") | [<img src="https://avatars0.githubusercontent.com/u/2670744?v=4" width="100px;"/><br /><sub><b>Leonardo</b></sub>](https://github.com/LeoCp)<br />[💻](https://github.com/gitpoint/git-point/commits?author=LeoCp "Code") | [<img src="https://avatars2.githubusercontent.com/u/13105865?v=4" width="100px;"/><br /><sub><b>Stephen</b></sub>](https://github.com/coderste)<br />[📖](https://github.com/gitpoint/git-point/commits?author=coderste "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/5565340?v=4" width="100px;"/><br /><sub><b>Zahra Traboulsi</b></sub>](http://www.zahra.tech)<br />[💻](https://github.com/gitpoint/git-point/commits?author=ZahraTee "Code") [⚠️](https://github.com/gitpoint/git-point/commits?author=ZahraTee "Tests") | [<img src="https://avatars3.githubusercontent.com/u/13391685?v=4" width="100px;"/><br /><sub><b>Joseba Carral</b></sub>](http://codevs.es)<br />[🌍](#translation-jcarral "Translation") | [<img src="https://avatars2.githubusercontent.com/u/5800039?v=4" width="100px;"/><br /><sub><b>CTownsdin</b></sub>](https://github.com/CTownsdin)<br />[💻](https://github.com/gitpoint/git-point/commits?author=CTownsdin "Code") |
| [<img src="https://avatars0.githubusercontent.com/u/7470681?v=4" width="100px;"/><br /><sub><b>Apostolis Economou</b></sub>](https://github.com/apoeco)<br />[💻](https://github.com/gitpoint/git-point/commits?author=apoeco "Code") |
| [<img src="https://avatars0.githubusercontent.com/u/7470681?v=4" width="100px;"/><br /><sub><b>Apostolis Economou</b></sub>](https://github.com/apoeco)<br />[💻](https://github.com/gitpoint/git-point/commits?author=apoeco "Code") | [<img src="https://avatars3.githubusercontent.com/u/9337254?v=4" width="100px;"/><br /><sub><b>Arjun</b></sub>](https://github.com/Arjun-sna)<br />[💻](https://github.com/gitpoint/git-point/commits?author=Arjun-sna "Code") |
<!-- ALL-CONTRIBUTORS-LIST:END -->
7 changes: 7 additions & 0 deletions routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
EventsScreen,
PrivacyPolicyScreen,
UserOptionsScreen,
LanguageSettingsScreen,
} from 'auth';

// User
Expand Down Expand Up @@ -200,6 +201,12 @@ const sharedRoutes = {
title: navigation.state.params.title,
}),
},
LanguageSettings: {
screen: LanguageSettingsScreen,
navigationOptions: ({ navigation }) => ({
title: navigation.state.params.title,
}),
},
};

const HomeStackNavigator = StackNavigator(
Expand Down
1 change: 1 addition & 0 deletions src/auth/screens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './auth-profile.screen';
export * from './events.screen';
export * from './privacy-policy.screen';
export * from './user-options.screen';
export * from './language-setting.screen';
113 changes: 113 additions & 0 deletions src/auth/screens/language-setting.screen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/* eslint-disable no-shadow */
import React, { Component } from 'react';
import { FlatList } from 'react-native';
import styled from 'styled-components/native';
import { connect } from 'react-redux';
import { ListItem } from 'react-native-elements';
import { colors, fonts } from 'config';
import { changeLocale } from 'auth';
import { bindActionCreators } from 'redux';
import { emojifyText, translate } from 'utils';
import { NavigationActions } from 'react-navigation';
import { ViewContainer } from 'components';
import languages from './language-settings';

const ListTitle = styled.Text`
color: ${colors.black};
${fonts.fontPrimary};
`;

const Language = styled.View`
flex-direction: row;
`;

const Flag = styled.Text`
padding-right: 7;
color: ${colors.black}; // random any color for the correct display emoji
`;

const StyledListItem = styled(ListItem).attrs({
containerStyle: {
borderBottomColor: colors.greyLight,
borderBottomWidth: 1,
height: 50,
justifyContent: 'center',
},
titleStyle: props => ({
color: props.signOut ? colors.red : colors.black,
...fonts.fontPrimary,
}),
underlayColor: colors.greyLight,
hideChevron: props => props.hideChevron,
})``;

class LanguageSettings extends Component {
props: {
locale: string,
changeLocale: () => void,
};

componentWillReceiveProps(nextState) {
if (nextState.locale !== this.props.locale) {
const navigationParams = NavigationActions.setParams({
params: {
title: translate('auth.userOptions.language', nextState.locale),
},
key: nextState.navigation.state.key,
});

nextState.navigation.dispatch(navigationParams);
}
}

renderListItem = ({ item }) => {
const { locale, changeLocale } = this.props;

return (
<StyledListItem
title={
<Language>
<Flag>{emojifyText(item.emojiCode)}</Flag>
<ListTitle>{item.name}</ListTitle>
</Language>
}
hideChevron={locale !== item.code}
rightIcon={{ name: 'check' }}
onPress={() => changeLocale(item.code)}
/>
);
};

render() {
const { locale } = this.props;

return (
<ViewContainer>
<FlatList
data={languages}
renderItem={this.renderListItem}
keyExtractor={(item, index) => index}
extraData={locale}
/>
</ViewContainer>
);
}
}

const mapStateToProps = state => ({
locale: state.auth.locale,
user: state.auth.user,
});

const mapDispatchToProps = dispatch =>
bindActionCreators(
{
changeLocale,
},
dispatch
);

export const LanguageSettingsScreen = connect(
mapStateToProps,
mapDispatchToProps
)(LanguageSettings);
61 changes: 12 additions & 49 deletions src/auth/screens/user-options.screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,17 @@ import React, { Component } from 'react';
import styled from 'styled-components/native';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { ScrollView, FlatList } from 'react-native';
import { ScrollView } from 'react-native';
import { ListItem } from 'react-native-elements';
import { NavigationActions } from 'react-navigation';
import CookieManager from 'react-native-cookies';

import { ViewContainer, SectionList } from 'components';
import { colors, fonts, normalize } from 'config';
import {
resetNavigationTo,
openURLInView,
translate,
emojifyText,
} from 'utils';
import { resetNavigationTo, openURLInView, translate } from 'utils';
import { version } from 'package.json';
import codePush from 'react-native-code-push';
import { signOut, changeLocale } from 'auth';
import languages from './language-settings';
import { signOut } from 'auth';

const mapStateToProps = state => ({
locale: state.auth.locale,
Expand All @@ -30,16 +24,10 @@ const mapDispatchToProps = dispatch =>
bindActionCreators(
{
signOut,
changeLocale,
},
dispatch
);

const ListTitle = styled.Text`
color: ${colors.black};
${fonts.fontPrimary};
`;

const Update = styled.TouchableOpacity`
flex: 1;
align-items: center;
Expand All @@ -55,15 +43,6 @@ const UpdateTextSub = UpdateText.extend`
font-size: ${normalize(11)};
`;

const Language = styled.View`
flex-direction: row;
`;

const Flag = styled.Text`
padding-right: 7;
color: ${colors.black}; // random any color for the correct display emoji
`;

const StyledListItem = styled(ListItem).attrs({
containerStyle: {
borderBottomColor: colors.greyLight,
Expand All @@ -88,7 +67,6 @@ const updateText = locale => ({
class UserOptions extends Component {
props: {
locale: string,
changeLocale: () => void,
signOut: () => void,
navigation: Object,
user: Object,
Expand Down Expand Up @@ -152,35 +130,20 @@ class UserOptions extends Component {
}

render() {
const { locale, changeLocale, navigation } = this.props;
const { locale, navigation } = this.props;

return (
<ViewContainer>
<ScrollView>
<SectionList title={translate('auth.userOptions.language', locale)}>
<FlatList
data={languages}
renderItem={({ item }) => {
return (
<StyledListItem
title={
<Language>
<Flag>{emojifyText(item.emojiCode)}</Flag>
<ListTitle>{item.name}</ListTitle>
</Language>
}
hideChevron={locale !== item.code}
rightIcon={{ name: 'check' }}
onPress={() => changeLocale(item.code)}
/>
);
}}
keyExtractor={(item, index) => index}
extraData={locale}
/>
</SectionList>

<SectionList>
<StyledListItem
title={translate('auth.userOptions.language', locale)}
onPress={() =>
navigation.navigate('LanguageSettings', {
title: translate('auth.userOptions.language', locale),
locale,
})}
/>
<StyledListItem
title={translate('common.openInBrowser', locale)}
onPress={() => openURLInView(this.props.user.html_url)}
Expand Down