Skip to content

Commit 10d6ee5

Browse files
Merge pull request #73 from Grad-Squad/cleanup/release7_ram
fix: a couple of crashes
2 parents 83e9b95 + cc36784 commit 10d6ee5

File tree

21 files changed

+25875
-166
lines changed

21 files changed

+25875
-166
lines changed

.github/workflows/integrate.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,36 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v2
12+
1213
- uses: actions/setup-node@v1
1314
with:
1415
node-version: 14
16+
1517
- uses: actions/cache@v2
1618
with:
1719
path: ~/.npm
1820
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
1921
restore-keys: |
2022
${{ runner.os }}-node-
23+
2124
- run: npm ci
25+
2226
- run: npm run test:ci
27+
28+
- name: Setup Expo
29+
uses: expo/expo-github-action@v7
30+
with:
31+
expo-version: 5.x
32+
token: ${{ secrets.EXPO_TOKEN }}
33+
34+
- name: Publish preview
35+
run: expo publish --release-channel=pr-${{ github.event.number }} --non-interactive
36+
37+
- name: Comment preview
38+
uses: expo/expo-github-action/preview-comment@v7
39+
with:
40+
channel: pr-${{ github.event.number }}
41+
2342
- uses: sarisia/actions-status-discord@v1
2443
if: always()
2544
with:

App.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import ErrorSnackbarProvider from 'common/ErrorSnackbar/ErrorSnackbarProvider';
1111
import ReactQueryClient from 'components/ReactQueryClient/ReactQueryClient';
1212
import { Provider as ReduxProvider } from 'react-redux';
1313
import { Platform, UIManager } from 'react-native';
14-
import FirstTimeMessages from 'components/FirstTimeMessages/FirstTimeMessages';
1514
import { LocalizationProvider } from './localization';
1615
import initStyles from './styles/init';
1716
import RootNavigator from './navigation/RootNavigator';
@@ -54,15 +53,17 @@ function App() {
5453
<GlobalStore>
5554
<ReduxProvider store={store}>
5655
<ErrorSnackbarProvider>
57-
<ReactQueryClient>
58-
<PaperProvider theme={theme}>
59-
<SafeAreaProvider>
60-
<StatusBar />
61-
<FirstTimeMessages />
62-
<RootNavigator />
63-
</SafeAreaProvider>
64-
</PaperProvider>
65-
</ReactQueryClient>
56+
<ReactQueryClient>
57+
<PaperProvider theme={theme}>
58+
<SafeAreaProvider>
59+
<StatusBar
60+
// eslint-disable-next-line react/style-prop-object
61+
style="dark"
62+
/>
63+
<RootNavigator />
64+
</SafeAreaProvider>
65+
</PaperProvider>
66+
</ReactQueryClient>
6667
</ErrorSnackbarProvider>
6768
</ReduxProvider>
6869
</GlobalStore>

api/endpoints/auth.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export const useAPIRegister = (mutationConfig) => {
138138
user: {
139139
email,
140140
password,
141+
identityProvider: 'lcl',
141142
},
142143
profile: {
143144
name,

app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "educate-mobile",
44
"slug": "educate-mobile",
55
"scheme": "educate-mobile",
6-
"version": "2022.2.0",
6+
"version": "2022.2.2",
77
"facebookScheme": "fb302939171663614",
88
"facebookAppId": "302939171663614",
99
"facebookDisplayName": "Educate",
@@ -28,7 +28,7 @@
2828
},
2929
"android": {
3030
"package": "com.squidsoft.educate",
31-
"versionCode": 4,
31+
"versionCode": 7,
3232
"adaptiveIcon": {
3333
"foregroundImage": "./assets/adaptive-icon.png",
3434
"backgroundColor": "#FFFFFF"

components/ExpandedPost/ExpandedPostContent/ExpandedPostContent.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useMemo } from 'react';
1+
import React, { useEffect, useMemo } from 'react';
22
import PropTypes from 'prop-types';
33
import { View } from 'react-native';
44
import EduText from 'common/EduText';
@@ -45,7 +45,9 @@ const ExpandedPostContent = ({ navigation, postId }) => {
4545
);
4646

4747
const dispatch = useDispatch();
48-
dispatch(setMaterialOwner(post?.author));
48+
useEffect(() => {
49+
dispatch(setMaterialOwner(post?.author));
50+
}, [post]);
4951

5052
if (isLoading) {
5153
return <ExpandedPostContentSkeleton navigation={navigation} />;

components/Home/CreatePost/AddMaterialList.jsx

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useMemo, useRef } from 'react';
22
import { StyleSheet, View } from 'react-native';
33
import { useLocalization } from 'localization';
44
import { Icon, MaterialTypeIconsMap } from 'common/Icon';
@@ -7,6 +7,7 @@ import { navigationPropType } from 'proptypes';
77
import { TransparentButton } from 'common/Input/Button';
88
import ScreenNames from 'navigation/ScreenNames';
99
import { MaterialTypes } from 'constants';
10+
import BottomSheet from '@gorhom/bottom-sheet';
1011

1112
const getItems = (t) => [
1213
{
@@ -38,19 +39,30 @@ const getItems = (t) => [
3839

3940
const AddMaterialList = ({ navigation }) => {
4041
const { t } = useLocalization();
42+
43+
const bottomSheetRef = useRef(null);
44+
45+
const snapPoints = useMemo(() => ['7%', '40%'], []);
4146
return (
42-
<View style={styles.wrapper}>
43-
{getItems(t).map(({ title, iconName, route }) => (
44-
<TransparentButton
45-
key={title}
46-
text={title}
47-
style={styles.row}
48-
textStyle={styles.rowTitle}
49-
leftIcon={<Icon name={iconName} />}
50-
onPress={() => navigation.navigate(route)}
51-
/>
52-
))}
53-
</View>
47+
<BottomSheet
48+
ref={bottomSheetRef}
49+
index={1}
50+
snapPoints={snapPoints}
51+
backgroundStyle={styles.backgroundStyle}
52+
>
53+
<View style={styles.wrapper}>
54+
{getItems(t).map(({ title, iconName, route }) => (
55+
<TransparentButton
56+
key={title}
57+
text={title}
58+
style={styles.row}
59+
textStyle={styles.rowTitle}
60+
leftIcon={<Icon name={iconName} />}
61+
onPress={() => navigation.navigate(route)}
62+
/>
63+
))}
64+
</View>
65+
</BottomSheet>
5466
);
5567
};
5668

@@ -59,11 +71,13 @@ AddMaterialList.defaultProps = {};
5971

6072
export default AddMaterialList;
6173

74+
const width = '80%';
75+
6276
const styles = StyleSheet.create({
6377
wrapper: {
64-
marginTop: 'auto',
78+
flex: 1,
6579

66-
width: '80%',
80+
width,
6781
alignSelf: 'center',
6882

6983
borderTopRightRadius: Constants.borderRadius,
@@ -72,6 +86,11 @@ const styles = StyleSheet.create({
7286
borderTopWidth: 2,
7387
borderRightWidth: 2,
7488
borderLeftWidth: 2,
89+
90+
backgroundColor: Colors.background,
91+
},
92+
backgroundStyle: {
93+
backgroundColor: 'transparent',
7594
},
7695
row: {
7796
...Styles.bottomBorder,

components/Home/Home.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { apiFeedQueryKey, useAPIFeed } from 'api/endpoints/posts';
44
import PostsContainer from 'components/Post/PostsContainer';
55
import { queryClient } from 'components/ReactQueryClient/ReactQueryClient';
66
import SearchBar from 'components/Search/SearchBar';
7+
import FirstTimeMessages from 'components/FirstTimeMessages/FirstTimeMessages';
78
import FeedEmptyComponent from './FeedEmptyComponent';
89

910
const Home = () => {
@@ -12,6 +13,7 @@ const Home = () => {
1213

1314
return (
1415
<Page>
16+
<FirstTimeMessages />
1517
<SearchBar
1618
isActive={isSearchActive}
1719
setIsActive={setIsSearchActive}
Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,24 @@
11
import React from 'react';
2-
import { StyleSheet, View, Image } from 'react-native';
3-
import EduText from 'common/EduText';
2+
import { StyleSheet } from 'react-native';
43
import Page from 'common/Page/Page';
54
import { IconNames } from 'common/Icon/Icon';
6-
import { AssetsConstants } from 'constants';
7-
import { Colors, Constants } from 'styles';
85
import Separator from 'common/Separator';
96
// eslint-disable-next-line import/no-extraneous-dependencies
107
import { useNavigation } from '@react-navigation/core';
118
import ScreenNames from 'navigation/ScreenNames';
129
import { useAxios } from 'api/AxiosProvider';
1310
import { useLocalization } from 'localization';
1411
import OptionButton from './OptionButton';
12+
import ProfileSection from './ProfileSection/ProfileSection';
1513

1614
const Options = () => {
1715
const navigation = useNavigation();
1816
const { updateAccessToken, updateRefreshToken } = useAxios();
1917
const { t } = useLocalization();
18+
2019
return (
2120
<Page>
22-
<View style={styles.userSection}>
23-
<Image
24-
style={styles.profilePic}
25-
source={AssetsConstants.images.defaultProfile}
26-
/>
27-
<View style={styles.profileInfoSection}>
28-
<EduText style={styles.profileName}>Profile Name</EduText>
29-
<EduText style={styles.profileRole}>Role</EduText>
30-
</View>
31-
</View>
21+
<ProfileSection />
3222
<OptionButton
3323
label={t('Options/Change Subjects you follow')}
3424
onPress={() => {
@@ -62,33 +52,4 @@ Options.defaultProps = {};
6252

6353
export default Options;
6454

65-
const styles = StyleSheet.create({
66-
userSection: {
67-
backgroundColor: Colors.foreground,
68-
paddingHorizontal: 10,
69-
paddingTop: Constants.fromScreenStartPadding + 10,
70-
paddingBottom: 15,
71-
72-
flexDirection: 'row',
73-
alignItems: 'flex-end',
74-
75-
borderColor: Colors.border,
76-
borderBottomWidth: 0.2,
77-
},
78-
profilePic: {
79-
width: 80,
80-
height: 80,
81-
82-
borderRadius: 80,
83-
},
84-
profileName: {
85-
fontSize: 28,
86-
},
87-
profileRole: {
88-
fontSize: 16,
89-
fontFamily: 'Lato_300Light',
90-
},
91-
profileInfoSection: {
92-
marginLeft: 15,
93-
},
94-
});
55+
const styles = StyleSheet.create({});
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { Image, StyleSheet, View } from 'react-native';
4+
import { useLocalization } from 'localization';
5+
import { useStore } from 'globalStore/GlobalStore';
6+
import { useAPIGetProfileById } from 'api/endpoints/profile';
7+
import EduText from 'common/EduText';
8+
import { AssetsConstants } from 'constants';
9+
import { Colors, Constants } from 'styles';
10+
import ProfileSectionSkeleton from './ProfileSectionSkeleton';
11+
12+
const ProfileSection = () => {
13+
const { t } = useLocalization();
14+
const [store] = useStore();
15+
16+
const { data, isLoading } = useAPIGetProfileById(store.profileId);
17+
return (
18+
<View style={styles.userSection}>
19+
{isLoading ? (
20+
<ProfileSectionSkeleton profilePicStyle={styles.profilePic} />
21+
) : (
22+
<>
23+
{data.profilePicture ? (
24+
<Image
25+
style={styles.profilePic}
26+
source={AssetsConstants.images.defaultProfile}
27+
/>
28+
) : (
29+
<Image
30+
style={styles.profilePic}
31+
source={AssetsConstants.images.defaultProfile}
32+
/>
33+
)}
34+
<View style={styles.profileInfoSection}>
35+
<EduText style={styles.profileName}>{data.name}</EduText>
36+
<EduText style={styles.profileRole}>
37+
{data.role === 'student'
38+
? t('Roles/Student')
39+
: t('Roles/Teacher')}
40+
</EduText>
41+
</View>
42+
</>
43+
)}
44+
</View>
45+
);
46+
};
47+
48+
ProfileSection.propTypes = {};
49+
ProfileSection.defaultProps = {};
50+
51+
export default ProfileSection;
52+
53+
const styles = StyleSheet.create({
54+
userSection: {
55+
backgroundColor: Colors.foreground,
56+
paddingHorizontal: 10,
57+
paddingTop: Constants.fromScreenStartPadding + 10,
58+
paddingBottom: 15,
59+
60+
flexDirection: 'row',
61+
alignItems: 'flex-end',
62+
63+
borderColor: Colors.border,
64+
borderBottomWidth: 0.2,
65+
},
66+
67+
profilePic: {
68+
width: 80,
69+
height: 80,
70+
71+
borderRadius: 80,
72+
},
73+
profileName: {
74+
fontSize: 28,
75+
},
76+
profileRole: {
77+
fontSize: 16,
78+
fontFamily: 'Lato_300Light',
79+
},
80+
profileInfoSection: {
81+
marginLeft: 15,
82+
},
83+
});

0 commit comments

Comments
 (0)