Skip to content

Commit 992fdf5

Browse files
authored
v1.1.2 (#95)
2 parents 6a9a6b2 + 71028b7 commit 992fdf5

File tree

19 files changed

+119
-203
lines changed

19 files changed

+119
-203
lines changed

app.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
expo: {
55
name: 'ЕТИС мобайл' + (IS_DEV ? ' (DEV)' : ''),
66
slug: 'etis-mobile',
7-
version: '1.1.1',
7+
version: '1.1.2',
88
owner: 'damego',
99
orientation: 'portrait',
1010
icon: './assets/icon.png',
@@ -23,7 +23,7 @@ export default {
2323
supportsTablet: true,
2424
},
2525
android: {
26-
versionCode: 10101000,
26+
versionCode: 10102000,
2727
adaptiveIcon: {
2828
foregroundImage: './assets/adaptive-icon.png',
2929
backgroundColor: '#FFFFFF',
@@ -53,7 +53,7 @@ export default {
5353
]
5454
},
5555
plugins: [
56-
['./src/plugins/copyDrawable.js', './assets/tab_icons'],
56+
['./src/plugins/copyDrawable.ts', './assets/tab_icons'],
5757
['./src/plugins/disabledForcedDarkModeAndroid.ts', {}],
5858
'@config-plugins/react-native-quick-actions',
5959
'sentry-expo',

src/components/LoadingScreen.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,8 @@ const EmptyCard = () => {
2727
);
2828
};
2929

30-
interface LoadingScreenProps {
31-
headerText?: string;
32-
onRefresh?(): Promise<void>;
33-
}
34-
35-
const LoadingScreen = ({ headerText, onRefresh }: LoadingScreenProps) => (
36-
<Screen headerText={headerText} onUpdate={onRefresh}>
30+
const LoadingScreen = ({ onRefresh }: { onRefresh?(): Promise<void> }) => (
31+
<Screen onUpdate={onRefresh}>
3732
<View style={{ marginTop: '10%' }} />
3833
<EmptyCard />
3934
<EmptyCard />

src/data/base.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { ITimeTable, ITimeTableGetProps } from '../models/timeTable';
2626
import { StudentInfo } from '../parser/menu';
2727
import { isLoginPage } from '../parser/utils';
2828
import { Response } from '../utils/http';
29+
import { reportParserError } from '../utils/sentry';
2930

3031
export interface BaseClient {
3132
getAnnounceData(payload: IGetPayload): Promise<IGetResult<string[]>>;
@@ -97,6 +98,7 @@ export class BasicClient<P extends IGetPayload, T> {
9798
} catch (e) {
9899
console.warn(`[PARSER] Ignoring a error from ${this.name}`);
99100
console.trace(e);
101+
reportParserError(e);
100102
}
101103
if (!parsedData) return failedResult;
102104

@@ -112,6 +114,8 @@ export class BasicClient<P extends IGetPayload, T> {
112114
if (cached?.data) {
113115
console.log(`[DATA] Retrieved ${this.name} from cache`);
114116
return cached;
117+
} else if (payload.requestType === RequestType.forceCache) {
118+
return errorResult;
115119
}
116120
const fetched = await this.tryFetch(payload);
117121

src/data/demoClient.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ICertificateTable } from '../models/certificate';
33
import { IMessagesData, MessageType } from '../models/messages';
44
import { IOrder } from '../models/order';
55
import { ISessionRating } from '../models/rating';
6-
import { GetResultType, IGetPayload, IGetResult } from '../models/results';
6+
import { GetResultType, IGetResult } from '../models/results';
77
import { ISessionMarks } from '../models/sessionMarks';
88
import { ISessionPoints } from '../models/sessionPoints';
99
import { ISessionQuestionnaire, ISessionQuestionnaireLink } from '../models/sessionQuestionnaire';
@@ -32,11 +32,12 @@ export default class DemoClient implements BaseClient {
3232
}
3333
async getSessionQuestionnaire(): Promise<IGetResult<ISessionQuestionnaire>> {
3434
const data: ISessionQuestionnaire =
35+
// eslint-disable-next-line @typescript-eslint/no-var-requires
3536
require('./demo-questionnaire.json') as ISessionQuestionnaire;
3637
return this.toResult(data);
3738
}
3839

39-
async getCertificateData(payload: IGetPayload): Promise<IGetResult<ICertificateTable>> {
40+
async getCertificateData(): Promise<IGetResult<ICertificateTable>> {
4041
return toResult({
4142
certificates: [
4243
{
@@ -109,8 +110,8 @@ export default class DemoClient implements BaseClient {
109110
{
110111
audienceText: 'ауд. 411/2 (2 корпус, 3 этаж)',
111112
audience: '411/2',
112-
floor: 3,
113-
building: 2,
113+
floor: '3',
114+
building: '2',
114115
isDistance: false,
115116
subject: 'Математический анализ (лек)',
116117
},
@@ -123,8 +124,8 @@ export default class DemoClient implements BaseClient {
123124
{
124125
audienceText: 'ауд. 411/2 (2 корпус, 3 этаж)',
125126
audience: '411/2',
126-
floor: 3,
127-
building: 2,
127+
floor: '3',
128+
building: '2',
128129
isDistance: false,
129130
subject: 'Комплексный анализ (лек)',
130131
},
@@ -137,8 +138,8 @@ export default class DemoClient implements BaseClient {
137138
{
138139
audienceText: 'ауд. 411/2 (2 корпус, 3 этаж)',
139140
audience: '411/2',
140-
floor: 3,
141-
building: 2,
141+
floor: '3',
142+
building: '2',
142143
isDistance: false,
143144
subject: 'Функциональный анализ (лек)',
144145
},
@@ -206,7 +207,7 @@ export default class DemoClient implements BaseClient {
206207
return this.toResult(data);
207208
}
208209

209-
async getOrdersData(payload: IGetPayload): Promise<IGetResult<IOrder[]>> {
210+
async getOrdersData(): Promise<IGetResult<IOrder[]>> {
210211
const data: IOrder[] = [
211212
{
212213
id: '1',

src/navigation/TabNavigation.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ const TabNavigator = () => {
5252

5353
const data = result.data;
5454

55-
dispatch(setStudentState(data));
55+
if (data) {
56+
dispatch(setStudentState(data));
57+
}
5658
};
5759

5860
useEffect(() => {

src/parser/timeTable.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,17 @@ export default function parseTimeTable(html) {
5353
weekInfo,
5454
days: [],
5555
};
56-
5756
const { days } = data;
5857

5958
$('.day', html).each((el, day) => {
6059
const daySelector = $(day);
6160
const pairs: IPair[] = [];
6261
const date = getTextField(daySelector.find('h3'));
63-
6462
if (!daySelector.children().last().hasClass('no_pairs')) {
6563
$('tr', day).each((index, tr) => {
6664
const lessons: ILesson[] = [];
6765
const pair = $(tr);
6866
const pairInfo = pair.find('.pair_info');
69-
7067
pairInfo.children().each((lessonIndex, lessonElement) => {
7168
const lesson = pairInfo.find(lessonElement);
7269
const subject = getTextField(lesson.find('.dis'));
@@ -79,17 +76,16 @@ export default function parseTimeTable(html) {
7976
building,
8077
floor,
8178
subject,
82-
isDistance: audience === 'Дистанционно'
79+
isDistance: audience === 'Дистанционно',
8380
});
84-
})
81+
});
8582

8683
const pairTime = getTextField(pair.find('.pair_num').find('.eval'));
8784
pairs.push({
8885
time: pairTime,
8986
position: index + 1,
90-
lessons
91-
})
92-
87+
lessons,
88+
});
9389
});
9490
}
9591
days.push({

src/plugins/copyDrawable.js

Lines changed: 0 additions & 97 deletions
This file was deleted.

src/plugins/copyDrawable.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import type { ConfigPlugin } from '@expo/config-plugins';
2-
import { withDangerousMod } from '@expo/config-plugins';
3-
import { copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync } from 'fs';
4-
import { basename, join } from 'path';
1+
const { withDangerousMod } = require('@expo/config-plugins');
2+
const { copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync } = require('fs');
3+
const { basename, join } = require('path');
54

65
const androidFolderPath = ['app', 'src', 'main', 'res', 'drawable'];
76

8-
const withDrawableAssets: ConfigPlugin<string | string[]> = (expoConfig, files) =>
7+
const withDrawableAssets = (expoConfig, files) =>
98
withDangerousMod(expoConfig, [
109
'android',
1110
(modConfig) => {
1211
if (modConfig.modRequest.platform === 'android') {
13-
const androidDwarablePath = join(
12+
const androidDrawablePath = join(
1413
modConfig.modRequest.platformProjectRoot,
1514
...androidFolderPath
1615
);
@@ -21,17 +20,17 @@ const withDrawableAssets: ConfigPlugin<string | string[]> = (expoConfig, files)
2120
files.forEach((file) => {
2221
const isFile = lstatSync(file).isFile();
2322
if (isFile) {
24-
copyFileSync(file, join(androidDwarablePath, basename(file)));
23+
copyFileSync(file, join(androidDrawablePath, basename(file)));
2524
} else {
26-
copyFolderRecursiveSync(file, androidDwarablePath);
25+
copyFolderRecursiveSync(file, androidDrawablePath);
2726
}
2827
});
2928
}
3029
return modConfig;
3130
},
3231
]);
3332

34-
async function copyFolderRecursiveSync(source: string, target: string) {
33+
async function copyFolderRecursiveSync(source, target) {
3534
if (!existsSync(target)) mkdirSync(target);
3635

3736
const files = readdirSync(source);
@@ -48,4 +47,4 @@ async function copyFolderRecursiveSync(source: string, target: string) {
4847
}
4948
}
5049

51-
export default withDrawableAssets;
50+
module.exports = withDrawableAssets;

src/redux/reducers/sessionTest.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/screens/auth/AuthFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const AuthFooter = () => {
3131
return (
3232
<View style={styles.view}>
3333
<Text style={[styles.infoText, globalStyles.textColor]}>
34-
Приложение ЕТИС мобайл является неоффициальным мобильным приложением для ЕТИС ПГНИУ
34+
Приложение ЕТИС мобайл является неофициальным мобильным приложением для ЕТИС ПГНИУ
3535
</Text>
3636
<TouchableOpacity onPress={() => Linking.openURL(PRIVACY_POLICY_URL)}>
3737
<Text style={styles.privacyPolicyText}>Политика конфиденциальности</Text>

src/screens/auth/Recovery.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const Recovery = ({ setShowModal }) => {
5050
};
5151

5252
return (
53-
<Screen headerText={'Восстановление доступа'}>
53+
<Screen>
5454
{!recaptchaToken && (
5555
<CustomReCaptcha
5656
onReceiveToken={onReceiveRecaptchaToken}

src/screens/signs/RatingPage.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ export default function RatingPage() {
7171
}
7272
if (!result.data) {
7373
if (!data) {
74-
const cached = await client.getRatingData({
75-
session: (await cache.getStudent()).currentSession,
76-
requestType: RequestType.forceCache,
77-
});
78-
if (cached.data) {
79-
setData(cached.data);
80-
}
74+
const student = await cache.getStudent();
75+
if (student?.currentSession) {
76+
const cached = await client.getRatingData({
77+
session: (await cache.getStudent()).currentSession,
78+
requestType: RequestType.forceCache,
79+
});
80+
if (cached.data) {
81+
setData(cached.data);
82+
}
83+
} else ToastAndroid.show('Нет данных для отображения', ToastAndroid.LONG);
8184
} else ToastAndroid.show('Нет данных для отображения', ToastAndroid.LONG);
8285
setLoading(false);
8386
return;

0 commit comments

Comments
 (0)