Skip to content

Commit 6946228

Browse files
committed
Merge branch 'master' of https://github.com/gitpoint/git-point into tests
2 parents bef3f38 + 521303b commit 6946228

19 files changed

+224
-24
lines changed

.babelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"issue": "issue",
2323
"api": "api",
2424
"config": "config",
25-
"utils": "utils"
25+
"utils": "utils",
26+
"package.json": "./package.json"
2627
}
2728
}
2829
],

android/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ android {
135135
}
136136

137137
dependencies {
138+
compile project(':react-native-photo-view')
138139
compile project(':react-native-config')
139140
compile project(':react-native-code-push')
140141
compile project(':react-native-device-info')

android/app/src/main/java/com/gitpoint/MainApplication.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.app.Application;
44

55
import com.facebook.react.ReactApplication;
6+
import com.reactnative.photoview.PhotoViewPackage;
67
import com.lugg.ReactNativeConfig.ReactNativeConfigPackage;
78
import com.microsoft.codepush.react.CodePush;
89
import com.learnium.RNDeviceInfo.RNDeviceInfo;
@@ -33,6 +34,7 @@ public boolean getUseDeveloperSupport() {
3334
protected List<ReactPackage> getPackages() {
3435
return Arrays.<ReactPackage>asList(
3536
new MainReactPackage(),
37+
new PhotoViewPackage(),
3638
new ReactNativeConfigPackage(),
3739
new CodePush(BuildConfig.CODEPUSH_ANDROID_DEPLOYMENT_KEY, MainApplication.this, BuildConfig.DEBUG),
3840
new RNDeviceInfo(),

android/settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
rootProject.name = 'GitPoint'
2+
include ':react-native-photo-view'
3+
project(':react-native-photo-view').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-photo-view/android')
24
include ':react-native-config'
35
project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android')
46
include ':react-native-code-push'

ios/GitPoint.xcodeproj/project.pbxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
};
66
objectVersion = 46;
77
objects = {
8-
98
/* Begin PBXBuildFile section */
109
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
1110
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gitpoint",
3-
"version": "0.0.1",
3+
"version": "1.1",
44
"private": true,
55
"scripts": {
66
"start": "react-native start",
@@ -60,6 +60,7 @@
6060
"react-native-htmlview": "^0.11.1",
6161
"react-native-material-design-searchbar": "^1.1.4",
6262
"react-native-parallax-scroll-view": "^0.19.0",
63+
"react-native-photo-view": "^1.3.0",
6364
"react-native-safari-view": "^2.0.0",
6465
"react-native-search-bar": "^3.0.0",
6566
"react-native-syntax-highlighter": "^1.2.1",
@@ -81,6 +82,7 @@
8182
"babel-plugin-transform-inline-environment-variables": "^6.8.0",
8283
"babel-preset-flow": "^6.23.0",
8384
"babel-preset-react-native": "1.9.1",
85+
"concurrently": "^3.5.0",
8486
"eslint": "^3.19.0",
8587
"eslint-config-airbnb": "^15.0.2",
8688
"eslint-config-airbnb-base": "~11.2.0",

src/auth/screens/auth-profile.screen.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
import { colors, fonts, normalize } from 'config';
1818
import { getUser, getOrgs, signOut } from 'auth';
1919
import { openURLInView } from 'utils';
20+
import { version } from 'package.json';
2021

2122
const mapStateToProps = state => ({
2223
user: state.auth.user,
@@ -161,7 +162,7 @@ class AuthProfile extends Component {
161162
/>
162163
</SectionList>}
163164

164-
<EntityInfo entity={user} />
165+
<EntityInfo entity={user} orgs={orgs} navigation={navigation} />
165166

166167
<SectionList
167168
title="ORGANIZATIONS"
@@ -200,7 +201,7 @@ class AuthProfile extends Component {
200201
style={styles.update}
201202
onPress={this.checkForUpdate}
202203
>
203-
<Text style={styles.updateText}>GitPoint v1.1</Text>
204+
<Text style={styles.updateText}>GitPoint v{version}</Text>
204205
<Text style={[styles.updateText, styles.updateTextSub]}>
205206
{this.state.updateText}
206207
</Text>

src/components/entity-info.component.js

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { colors, fonts } from 'config';
88

99
type Props = {
1010
entity: Object,
11+
orgs: Array,
12+
navigation: Object,
1113
};
1214

1315
const styles = StyleSheet.create({
@@ -42,9 +44,49 @@ const getBlogLink = url =>
4244
const getLocationLink = location =>
4345
`https://www.google.com/maps/place/${location.split(' ').join('+')}`;
4446

45-
export const EntityInfo = ({ entity }: Props) => {
47+
const getCompanyFormatted = company => {
48+
const companyFormatted = company.replace(/ /g, '');
49+
50+
return company.charAt(0) === '@'
51+
? companyFormatted.substring(1)
52+
: companyFormatted;
53+
};
54+
55+
const companyInOrgs = (company, orgs) =>
56+
orgs.some(org => org.login === getCompanyFormatted(company));
57+
58+
const navigateToCompany = (company, orgs, navigation) => {
59+
if (companyInOrgs(company, orgs)) {
60+
navigation.navigate('Organization', {
61+
organization: orgs.find(
62+
org => org.login === getCompanyFormatted(company)
63+
),
64+
});
65+
}
66+
};
67+
68+
export const EntityInfo = ({ entity, orgs, navigation }: Props) => {
4669
return (
4770
<SectionList title="INFO">
71+
{!!entity.company &&
72+
entity.company !== '' &&
73+
<ListItem
74+
title="Company"
75+
titleStyle={styles.listTitle}
76+
leftIcon={{
77+
name: 'organization',
78+
color: colors.grey,
79+
type: 'octicon',
80+
}}
81+
subtitle={entity.company}
82+
subtitleStyle={styles.listSubTitle}
83+
onPress={() => navigateToCompany(entity.company, orgs, navigation)}
84+
underlayColor={
85+
companyInOrgs(entity.company, orgs) ? colors.greyLight : null
86+
}
87+
hideChevron={!companyInOrgs(entity.company, orgs)}
88+
/>}
89+
4890
{!!entity.location &&
4991
entity.location !== '' &&
5092
<ListItem
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import React, { Component } from 'react';
2+
import {
3+
StyleSheet,
4+
Image,
5+
View,
6+
Modal,
7+
Dimensions,
8+
TouchableOpacity,
9+
TouchableHighlight,
10+
} from 'react-native';
11+
import { Icon } from 'react-native-elements';
12+
import PhotoView from 'react-native-photo-view';
13+
14+
import { colors } from 'config';
15+
16+
const styles = StyleSheet.create({
17+
modalContainer: {
18+
flex: 1,
19+
backgroundColor: colors.black,
20+
justifyContent: 'center',
21+
alignItems: 'center',
22+
},
23+
closeButton: {
24+
position: 'absolute',
25+
top: 30,
26+
right: 10,
27+
},
28+
});
29+
30+
export class ImageZoom extends Component {
31+
props: {
32+
uri: string,
33+
style: Object,
34+
};
35+
36+
constructor() {
37+
super();
38+
this.state = {
39+
imgZoom: false,
40+
};
41+
}
42+
43+
openModal() {
44+
this.setState({ imgZoom: true });
45+
}
46+
47+
closeModal() {
48+
this.setState({ imgZoom: false });
49+
}
50+
51+
render() {
52+
const window = Dimensions.get('window');
53+
const { uri, style } = this.props;
54+
55+
if (this.state.imgZoom) {
56+
return (
57+
<Modal animationType={'fade'}>
58+
<View style={styles.modalContainer}>
59+
<PhotoView
60+
resizeMode={'contain'}
61+
onTap={() => this.closeModal()}
62+
source={uri}
63+
minimumZoomScale={0.5}
64+
maximumZoomScale={3}
65+
style={{ width: window.width, height: window.height }}
66+
/>
67+
68+
<TouchableOpacity
69+
activeOpacity={0.5}
70+
onPress={() => this.closeModal()}
71+
style={styles.closeButton}
72+
>
73+
<Icon color={colors.white} size={28} name="x" type="octicon" />
74+
</TouchableOpacity>
75+
</View>
76+
</Modal>
77+
);
78+
}
79+
80+
return (
81+
<TouchableHighlight onPress={() => this.openModal()}>
82+
<Image style={style} source={uri} />
83+
</TouchableHighlight>
84+
);
85+
}
86+
}

src/components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ export * from './state-badge.component';
2121
export * from './user-list-item.component';
2222
export * from './user-profile.component';
2323
export * from './view-container.component';
24+
export * from './image-zoom.component';

0 commit comments

Comments
 (0)