@olea-bps/base 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/AppBar/index.js +84 -0
- package/components/AppBar/styles.js +27 -0
- package/components/BookDetail/index.js +268 -0
- package/components/BookDetail/styles.js +124 -0
- package/components/ComponentJobsFilter/index.js +188 -0
- package/components/ComponentJobsFilter/styles.js +12 -0
- package/components/ConnectivityWarning/index.js +65 -0
- package/components/ConnectivityWarning/styles.js +19 -0
- package/components/ContactDetail/index.js +232 -0
- package/components/ContactDetail/styles.js +32 -0
- package/components/CourseDetail/index.js +357 -0
- package/components/CourseDetail/styles.js +59 -0
- package/components/CourseDetailDialog/index.js +169 -0
- package/components/CourseDetailDialog/styles.js +116 -0
- package/components/CourseInfo/index.js +219 -0
- package/components/CourseInfo/styles.js +40 -0
- package/components/DevelopmentDialog/index.js +214 -0
- package/components/DevelopmentDialog/styles.js +10 -0
- package/components/EventCodeInput/index.js +149 -0
- package/components/EventCodeInput/styles.js +108 -0
- package/components/FlexMenuEntry/index.js +84 -0
- package/components/FlexMenuEntry/styles.js +27 -0
- package/components/MainMenuEntry/index.js +88 -0
- package/components/MainMenuEntry/styles.js +28 -0
- package/components/MealItem/index.js +87 -0
- package/components/MealItem/styles.js +84 -0
- package/components/MensaMenu/index.js +305 -0
- package/components/MensaMenu/styles.js +94 -0
- package/components/MensaSlider/index.js +188 -0
- package/components/MensaSlider/styles.js +53 -0
- package/components/Modal/index.js +106 -0
- package/components/Modal/styles.js +8 -0
- package/components/NewsDetail/index.js +377 -0
- package/components/NewsDetail/styles.js +77 -0
- package/components/NewsList/index.js +120 -0
- package/components/NewsList/styles.js +19 -0
- package/components/NewsListItem/index.js +89 -0
- package/components/NewsListItem/styles.js +32 -0
- package/components/OtherCourses/index.js +152 -0
- package/components/OtherCourses/styles.js +10 -0
- package/components/PtsDeparture/index.js +140 -0
- package/components/PtsDeparture/styles.js +7 -0
- package/components/PtsStation/index.js +186 -0
- package/components/PtsStation/styles.js +47 -0
- package/components/QuickLinks/index.js +127 -0
- package/components/QuickLinks/styles.js +45 -0
- package/components/RoomDetail/index.js +281 -0
- package/components/RoomDetail/styles.js +56 -0
- package/components/ScaledImage/index.js +92 -0
- package/components/SearchResults/index.js +362 -0
- package/components/SearchResults/styles.js +59 -0
- package/components/SettingSection/index.js +54 -0
- package/components/SettingSection/styles.js +15 -0
- package/components/SettingsDialog/index.js +52 -0
- package/components/SettingsDialog/styles.js +12 -0
- package/components/SettingsDialogRadio/index.js +66 -0
- package/components/SettingsDialogRadio/styles.js +7 -0
- package/components/SettingsDialogSelect/index.js +73 -0
- package/components/SettingsDialogSelect/styles.js +7 -0
- package/components/TimetableCodeInput/index.js +205 -0
- package/components/TimetableCodeInput/styles.js +28 -0
- package/components/TimetableDay/index.js +252 -0
- package/components/TimetableDay/styles.js +103 -0
- package/components/TimetableEvent/index.js +163 -0
- package/components/TimetableEvent/styles.js +108 -0
- package/components/TimetableList/index.js +180 -0
- package/components/TimetableList/styles.js +106 -0
- package/components/TimetableMonth/index.js +156 -0
- package/components/TimetableMonth/styles.js +29 -0
- package/components/TimetableWeek/index.js +230 -0
- package/components/TimetableWeek/styles.js +58 -0
- package/components/TopNews/index.js +282 -0
- package/components/TopNews/styles.js +125 -0
- package/components/TopNewsHtwk/index.js +279 -0
- package/components/TopNewsHtwk/styles.js +142 -0
- package/components/WebView/index.js +108 -0
- package/components/WebView/styles.js +11 -0
- package/context/context-callmanager/TucCallManager.js +74 -0
- package/context/context-callmanager/index.js +128 -0
- package/context/context-canteen/AsistServerApiProvider.js +126 -0
- package/context/context-canteen/CollektorVersion2ApiProvider.js +100 -0
- package/context/context-canteen/index.js +692 -0
- package/context/context-connectivity/index.js +85 -0
- package/context/context-event/AsistServerClient.js +82 -0
- package/context/context-event/index.js +205 -0
- package/context/context-flex-menu/AsistServerApiProvider.js +0 -0
- package/context/context-flex-menu/CollectorVersion2ApiProvider.js +32 -0
- package/context/context-flex-menu/index.js +160 -0
- package/context/context-info-dialog/CollektorVersion2ApiProvider.js +53 -0
- package/context/context-info-dialog/ProviderErrors.js +22 -0
- package/context/context-info-dialog/index.js +190 -0
- package/context/context-mails/MailService.js +147 -0
- package/context/context-mails/TucUnseenApiProvider.js +65 -0
- package/context/context-mails/index.js +131 -0
- package/context/context-news/CollektorVersion2ApiProvider.js +68 -0
- package/context/context-news/index.js +155 -0
- package/context/context-public-transport-ticket/CollektorVersion2ApiProvider.js +45 -0
- package/context/context-public-transport-ticket/ProviderErrors.js +11 -0
- package/context/context-public-transport-ticket/index.js +175 -0
- package/context/context-timetable/CollectorVersion2ApiProvider.js +102 -0
- package/context/context-timetable/ProviderErrors.js +22 -0
- package/context/context-timetable/TimetableService.js +357 -0
- package/context/context-timetable/index.js +215 -0
- package/context/context-user/index.js +586 -0
- package/index.js +178 -0
- package/libraries/base-api-provider/hooks.js +24 -0
- package/libraries/base-api-provider/http-api-provider.js +168 -0
- package/libraries/base-api-provider/index.js +20 -0
- package/libraries/core/api/canteens.js +88 -0
- package/libraries/core/api/corona.js +45 -0
- package/libraries/core/api/courses.js +54 -0
- package/libraries/core/api/device.js +98 -0
- package/libraries/core/api/feed.js +144 -0
- package/libraries/core/api/feedback.js +123 -0
- package/libraries/core/api/jobs.js +48 -0
- package/libraries/core/api/library.js +67 -0
- package/libraries/core/api/lostfound.js +77 -0
- package/libraries/core/api/occupancy.js +44 -0
- package/libraries/core/api/officehours.js +25 -0
- package/libraries/core/api/poi.js +25 -0
- package/libraries/core/api/pts.js +68 -0
- package/libraries/core/api/rooms.js +31 -0
- package/libraries/core/api/survey.js +121 -0
- package/libraries/core/api/telephone.js +32 -0
- package/libraries/core/api/tucrooms.js +31 -0
- package/libraries/core/constants/actions.js +75 -0
- package/libraries/core/constants/api.js +146 -0
- package/libraries/core/constants/enums.js +5 -0
- package/libraries/core/helper/date.js +9 -0
- package/libraries/core/helper/format.helper.js +2 -0
- package/libraries/core/index.js +60 -0
- package/libraries/core/redux/actions/notifications.js +6 -0
- package/libraries/core/redux/actions/setting.js +75 -0
- package/libraries/core/redux/actions/state.js +74 -0
- package/libraries/core/redux/asyncDispatch.js +27 -0
- package/libraries/core/redux/reducers/api.js +190 -0
- package/libraries/core/redux/reducers/index.js +32 -0
- package/libraries/core/redux/reducers/notifications.js +16 -0
- package/libraries/core/redux/reducers/setting.js +99 -0
- package/libraries/core/redux/reducers/state.js +122 -0
- package/libraries/core/redux/selectors.js +123 -0
- package/libraries/core/redux/store.js +40 -0
- package/libraries/core/services/data.js +96 -0
- package/libraries/core/services/root-navigation.js +36 -0
- package/libraries/core/services/search.js +175 -0
- package/libraries/core-plugins/enums/replaceTypes.js +53 -0
- package/libraries/core-plugins/index.js +21 -0
- package/libraries/core-plugins/redux/actions/plugin.js +13 -0
- package/libraries/core-plugins/redux/reducers/plugin.js +210 -0
- package/libraries/icons-openasist/index.js +143 -0
- package/libraries/notifications/index.js +268 -0
- package/libraries/notifications/services/subscriber.service.js +123 -0
- package/libraries/react-native-webview-autoheight/README.md +47 -0
- package/libraries/react-native-webview-autoheight/index.js +140 -0
- package/libraries/react-native-webview-autoheight/package.json +37 -0
- package/libraries/react-native-webview-autoheight/utils.js +268 -0
- package/libraries/redux-offline/.eslintignore +1 -0
- package/libraries/redux-offline/.github/ISSUE_TEMPLATE/redux-offline-core-issues-template.md +25 -0
- package/libraries/redux-offline/.prettierrc +6 -0
- package/libraries/redux-offline/LICENSE +21 -0
- package/libraries/redux-offline/README.md +133 -0
- package/libraries/redux-offline/flow-typed/npm/redux-logger_vx.x.x.js +109 -0
- package/libraries/redux-offline/flow-typed/npm/redux_v4.x.x.js +100 -0
- package/libraries/redux-offline/lib/actions.js +46 -0
- package/libraries/redux-offline/lib/config.js +15 -0
- package/libraries/redux-offline/lib/constants.js +17 -0
- package/libraries/redux-offline/lib/defaults/defaultCommit.js +11 -0
- package/libraries/redux-offline/lib/defaults/defaultRollback.js +11 -0
- package/libraries/redux-offline/lib/defaults/detectNetwork.js +33 -0
- package/libraries/redux-offline/lib/defaults/detectNetwork.native.js +211 -0
- package/libraries/redux-offline/lib/defaults/discard.js +18 -0
- package/libraries/redux-offline/lib/defaults/effect.js +87 -0
- package/libraries/redux-offline/lib/defaults/index.js +32 -0
- package/libraries/redux-offline/lib/defaults/offlineStateLens.js +24 -0
- package/libraries/redux-offline/lib/defaults/persist.js +9 -0
- package/libraries/redux-offline/lib/defaults/persist.native.js +17 -0
- package/libraries/redux-offline/lib/defaults/persistAutoRehydrate.js +8 -0
- package/libraries/redux-offline/lib/defaults/queue.js +27 -0
- package/libraries/redux-offline/lib/defaults/retry.js +29 -0
- package/libraries/redux-offline/lib/index.js +115 -0
- package/libraries/redux-offline/lib/middleware.js +56 -0
- package/libraries/redux-offline/lib/offlineActionTracker.js +43 -0
- package/libraries/redux-offline/lib/send.js +112 -0
- package/libraries/redux-offline/lib/types.js +3 -0
- package/libraries/redux-offline/lib/updater.js +111 -0
- package/libraries/redux-offline/package.json +69 -0
- package/libraries/redux-offline/src/__tests__/defaults/discard.js +22 -0
- package/libraries/redux-offline/src/__tests__/defaults/effect.js +118 -0
- package/libraries/redux-offline/src/__tests__/index.js +116 -0
- package/libraries/redux-offline/src/__tests__/middleware.js +185 -0
- package/libraries/redux-offline/src/__tests__/offlineActionTracker.js +54 -0
- package/libraries/redux-offline/src/__tests__/send.js +208 -0
- package/libraries/redux-offline/src/actions.js +36 -0
- package/libraries/redux-offline/src/config.js +9 -0
- package/libraries/redux-offline/src/constants.js +18 -0
- package/libraries/redux-offline/src/defaults/defaultCommit.js +7 -0
- package/libraries/redux-offline/src/defaults/defaultRollback.js +7 -0
- package/libraries/redux-offline/src/defaults/detectNetwork.js +16 -0
- package/libraries/redux-offline/src/defaults/detectNetwork.native.js +148 -0
- package/libraries/redux-offline/src/defaults/discard.js +19 -0
- package/libraries/redux-offline/src/defaults/effect.js +86 -0
- package/libraries/redux-offline/src/defaults/index.js +25 -0
- package/libraries/redux-offline/src/defaults/offlineStateLens.js +11 -0
- package/libraries/redux-offline/src/defaults/persist.js +4 -0
- package/libraries/redux-offline/src/defaults/persist.native.js +9 -0
- package/libraries/redux-offline/src/defaults/persistAutoRehydrate.js +4 -0
- package/libraries/redux-offline/src/defaults/queue.js +20 -0
- package/libraries/redux-offline/src/defaults/retry.js +18 -0
- package/libraries/redux-offline/src/index.js +138 -0
- package/libraries/redux-offline/src/middleware.js +52 -0
- package/libraries/redux-offline/src/offlineActionTracker.js +40 -0
- package/libraries/redux-offline/src/send.js +111 -0
- package/libraries/redux-offline/src/types.js +127 -0
- package/libraries/redux-offline/src/updater.js +141 -0
- package/libraries/redux-offline/typings.d.ts +150 -0
- package/libraries/redux-offline/yarn.lock +6460 -0
- package/libraries/stored-state/index.js +155 -0
- package/package.json +68 -0
- package/views/Callmanager/index.js +148 -0
- package/views/Callmanager/styles.js +62 -0
- package/views/Canteens/index.js +383 -0
- package/views/Canteens/styles.js +89 -0
- package/views/Dashboard/index.js +176 -0
- package/views/Dashboard/styles.js +16 -0
- package/views/DashboardHtwk/index.js +197 -0
- package/views/DashboardHtwk/styles.js +24 -0
- package/views/Event/index.js +373 -0
- package/views/Event/styles.js +63 -0
- package/views/FeedList/index.js +165 -0
- package/views/FeedList/styles.js +15 -0
- package/views/FeedNews/index.js +243 -0
- package/views/FeedNews/styles.js +32 -0
- package/views/Flexmenu/index.js +185 -0
- package/views/Flexmenu/styles.js +62 -0
- package/views/FlexmenuWebview/index.js +167 -0
- package/views/FlexmenuWebview/styles.js +16 -0
- package/views/Howhy/index.js +151 -0
- package/views/Howhy/styles.js +11 -0
- package/views/Jobs/index.js +217 -0
- package/views/Jobs/styles.js +41 -0
- package/views/MainMenu/index.js +283 -0
- package/views/MainMenu/styles.js +36 -0
- package/views/NewsTabbar/index.js +164 -0
- package/views/NewsTabbar/styles.js +27 -0
- package/views/Opal/index.js +136 -0
- package/views/Opal/styles.js +11 -0
- package/views/PublicTransportTicket/index.js +173 -0
- package/views/PublicTransportTicket/styles.js +17 -0
- package/views/Search/index.js +186 -0
- package/views/Search/styles.js +67 -0
- package/views/SettingsAccessibility/index.js +148 -0
- package/views/SettingsAccessibility/styles.js +13 -0
- package/views/SettingsAppInfo/index.js +86 -0
- package/views/SettingsAppInfo/styles.js +18 -0
- package/views/SettingsCanteens/index.js +249 -0
- package/views/SettingsCanteens/styles.js +33 -0
- package/views/SettingsGeneral/index.js +173 -0
- package/views/SettingsGeneral/styles.js +28 -0
- package/views/SettingsNotifications/index.js +204 -0
- package/views/SettingsNotifications/styles.js +38 -0
- package/views/SettingsUser/index.js +170 -0
- package/views/SettingsUser/styles.js +17 -0
- package/views/TimetableCalendar/index.js +387 -0
- package/views/TimetableCalendar/styles.js +121 -0
- package/views/TimetableList/index.js +402 -0
- package/views/TimetableList/styles.js +55 -0
- package/views/Webviews/index.js +158 -0
- package/views/Webviews/styles.js +11 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import {Platform, Dimensions} from "react-native";
|
|
2
|
+
|
|
3
|
+
export default function(theme) {
|
|
4
|
+
const width = Dimensions.get('window').width;
|
|
5
|
+
const height = Dimensions.get('window').height;
|
|
6
|
+
const headerImageHeight = height / 2;
|
|
7
|
+
return {
|
|
8
|
+
appHeader: {
|
|
9
|
+
flex: 1,
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
alignItems: 'baseline',
|
|
12
|
+
},
|
|
13
|
+
appHeaderSearchButton: {
|
|
14
|
+
position: 'absolute',
|
|
15
|
+
top: Platform.OS === 'ios' ? theme.paddings.default : theme.paddings.xlarge,
|
|
16
|
+
right: theme.paddings.default
|
|
17
|
+
},
|
|
18
|
+
appHeaderSearch: {},
|
|
19
|
+
appHeaderContainer: {
|
|
20
|
+
flex: 1,
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
alignContent: 'center',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
height: headerImageHeight,
|
|
25
|
+
},
|
|
26
|
+
universityIconWrapper: {
|
|
27
|
+
flex: 1,
|
|
28
|
+
zIndex: 9,
|
|
29
|
+
backgroundColor: theme.colors.topNewsIconBackground,
|
|
30
|
+
},
|
|
31
|
+
universityIcon: {
|
|
32
|
+
width: width * .6,
|
|
33
|
+
height: (width) * .1,
|
|
34
|
+
margin: (width * .15) / 4,
|
|
35
|
+
marginLeft: theme.paddings.default,
|
|
36
|
+
|
|
37
|
+
},
|
|
38
|
+
universityTitle: {
|
|
39
|
+
marginTop: theme.paddings.large,
|
|
40
|
+
marginLeft: theme.paddings.default,
|
|
41
|
+
color: theme.colors.primaryText,
|
|
42
|
+
fontSize: theme.fontSizes.universityTitle,
|
|
43
|
+
...theme.fonts.bold,
|
|
44
|
+
lineHeight: theme.lineHeights.xxl,
|
|
45
|
+
textAlign: 'left',
|
|
46
|
+
alignSelf: 'flex-start',
|
|
47
|
+
marginBottom: theme.paddings.small
|
|
48
|
+
},
|
|
49
|
+
newsImage: {
|
|
50
|
+
height: width/16*9,
|
|
51
|
+
width: width
|
|
52
|
+
},
|
|
53
|
+
backgroundImageWrapper: {
|
|
54
|
+
position:'relative',
|
|
55
|
+
overflow: 'hidden',
|
|
56
|
+
backgroundColor: 'blue'
|
|
57
|
+
},
|
|
58
|
+
imageOverlay: {
|
|
59
|
+
height: headerImageHeight,
|
|
60
|
+
width: width,
|
|
61
|
+
flex: 1
|
|
62
|
+
},
|
|
63
|
+
newsItem: {
|
|
64
|
+
backgroundColor: theme.colors.background,
|
|
65
|
+
paddingHorizontal: theme.paddings.default,
|
|
66
|
+
paddingTop: theme.paddings.xsmall,
|
|
67
|
+
paddingBottom: theme.paddings.xsmall,
|
|
68
|
+
},
|
|
69
|
+
newsItemCategory: {
|
|
70
|
+
marginBottom: 5,
|
|
71
|
+
fontSize: theme.fontSizes.s
|
|
72
|
+
},
|
|
73
|
+
newsItemTitle: {
|
|
74
|
+
...theme.fonts.thin,
|
|
75
|
+
fontSize: theme.fontSizes.title,
|
|
76
|
+
lineHeight: theme.lineHeights.titleBig,
|
|
77
|
+
marginBottom: theme.paddings.small,
|
|
78
|
+
},
|
|
79
|
+
newsItemText: {
|
|
80
|
+
...theme.fonts.thin,
|
|
81
|
+
fontSize: theme.fontSizes.l,
|
|
82
|
+
lineHeight: theme.lineHeights.l
|
|
83
|
+
},
|
|
84
|
+
newsItemReadMore: {
|
|
85
|
+
textDecorationLine: 'underline'
|
|
86
|
+
},
|
|
87
|
+
newsItemActionbar: {
|
|
88
|
+
borderBottomColor: theme.colors.accent,
|
|
89
|
+
borderBottomWidth: 1,
|
|
90
|
+
//borderStyle: 'dotted', // TODO Not available on iOS at the moment (also dashed)
|
|
91
|
+
borderStyle: 'solid',
|
|
92
|
+
paddingBottom: theme.paddings.none,
|
|
93
|
+
marginTop: theme.paddings.none,
|
|
94
|
+
flex: 1,
|
|
95
|
+
flexDirection: 'row'
|
|
96
|
+
},
|
|
97
|
+
newsItemDate: {
|
|
98
|
+
fontSize: theme.fontSizes.s,
|
|
99
|
+
...theme.fonts.bold,
|
|
100
|
+
color: theme.colors.subtitle,
|
|
101
|
+
flex: 1,
|
|
102
|
+
alignItems: 'center',
|
|
103
|
+
alignSelf: 'center',
|
|
104
|
+
flexDirection: 'row',
|
|
105
|
+
},
|
|
106
|
+
newsItemAuthor: {
|
|
107
|
+
fontSize: theme.fontSizes.s,
|
|
108
|
+
...theme.fonts.bold,
|
|
109
|
+
color: theme.colors.subtitle,
|
|
110
|
+
flex: 1,
|
|
111
|
+
alignSelf: 'flex-start',
|
|
112
|
+
flexDirection: 'row',
|
|
113
|
+
},
|
|
114
|
+
newsItemActions: {
|
|
115
|
+
flex: 1,
|
|
116
|
+
alignItems: 'flex-end',
|
|
117
|
+
justifyContent: 'flex-end'
|
|
118
|
+
},
|
|
119
|
+
newsItemAction: {
|
|
120
|
+
marginRight: -4
|
|
121
|
+
},
|
|
122
|
+
modalContainer: {
|
|
123
|
+
flex: 1
|
|
124
|
+
},
|
|
125
|
+
tape: {
|
|
126
|
+
position: 'absolute',
|
|
127
|
+
top: '16.7%', // 16.7 % = 0.5/3 of height as per CI
|
|
128
|
+
bottom: '16.7%', // 16.7 % = 0.5/3 of height as per CI
|
|
129
|
+
zIndex: 10,
|
|
130
|
+
flex: 1,
|
|
131
|
+
width: width * 0.1143, // 11.43% width as per CI
|
|
132
|
+
resizeMode: 'cover',
|
|
133
|
+
backgroundColor: theme.colors.tapeColor
|
|
134
|
+
},
|
|
135
|
+
tapeLeft: {
|
|
136
|
+
left: theme.paddings.default - ((width * 0.1143) / 3) // 2/3 overlay
|
|
137
|
+
},
|
|
138
|
+
tapeRight: {
|
|
139
|
+
right: theme.paddings.default - ((width * 0.1143) / 3) // 2/3 overlay
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
* you may not use this file except in compliance with the License.
|
|
4
|
+
* You may obtain a copy of the License at
|
|
5
|
+
*
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
* See the License for the specific language governing permissions and
|
|
12
|
+
* limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import { StyleSheet, ActivityIndicator } from 'react-native';
|
|
17
|
+
import { connect } from 'react-redux'
|
|
18
|
+
import { withTheme } from "react-native-paper";
|
|
19
|
+
import { WebView } from 'react-native-webview';
|
|
20
|
+
import merge from 'lodash/merge';
|
|
21
|
+
|
|
22
|
+
import componentStyles from "./styles";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Webview View
|
|
26
|
+
*
|
|
27
|
+
* Use this víew to show a webpage (via url).
|
|
28
|
+
*
|
|
29
|
+
* Parameters:
|
|
30
|
+
* - none
|
|
31
|
+
*
|
|
32
|
+
* Navigation-Parameters:
|
|
33
|
+
* - title: Header title
|
|
34
|
+
* - url: Webpage Url
|
|
35
|
+
*/
|
|
36
|
+
class WebviewComponent extends React.Component {
|
|
37
|
+
static navigationOptions = {
|
|
38
|
+
header: null
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
state = {
|
|
42
|
+
refreshing: false,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Styles of this component
|
|
46
|
+
styles;
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
webView = {
|
|
51
|
+
canGoBack: false,
|
|
52
|
+
ref: null,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
constructor(props) {
|
|
56
|
+
super(props);
|
|
57
|
+
|
|
58
|
+
// ------------------------------------------------------------------------
|
|
59
|
+
// PLUGIN FUNCTIONALITY
|
|
60
|
+
// ------------------------------------------------------------------------
|
|
61
|
+
|
|
62
|
+
const {pluginStyles, theme} = this.props;
|
|
63
|
+
this.styles = componentStyles(theme);
|
|
64
|
+
|
|
65
|
+
if (pluginStyles) {
|
|
66
|
+
this.styles = merge(this.styles, pluginStyles);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
this.styles = StyleSheet.create(this.styles);
|
|
70
|
+
|
|
71
|
+
// ------------------------------------------------------------------------
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
onShouldStartLoadWithRequest = (event) =>{
|
|
75
|
+
const {url, constPage} = this.props;
|
|
76
|
+
if(constPage){
|
|
77
|
+
if(event.url === url)
|
|
78
|
+
return true;
|
|
79
|
+
else
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
render() {
|
|
85
|
+
const {colors, customScript} = this.props.theme;
|
|
86
|
+
const {url} = this.props;
|
|
87
|
+
|
|
88
|
+
const script = `function hideHead(){document.getElementById("header").style.display = 'none';}hideHead();`
|
|
89
|
+
return (
|
|
90
|
+
<WebView
|
|
91
|
+
injectedJavaScript={url.includes("tuc.cloud") ? script + customScript : customScript}
|
|
92
|
+
javaScriptEnabled
|
|
93
|
+
onMessage={(event) => {}}
|
|
94
|
+
source={{uri: url}}
|
|
95
|
+
ref={ref => this.webView.ref = ref}
|
|
96
|
+
startInLoadingState={true}
|
|
97
|
+
renderLoading={() => <ActivityIndicator style={this.styles.activity} size="large" color={colors.loadingIndicator}/>}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const mapStateToProps = state => {
|
|
104
|
+
return {
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export default connect(mapStateToProps, null)(withTheme(WebviewComponent))
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import HttpApiProvider, { JsonContentType } from '../../libraries/base-api-provider';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* API-Client for Kollektor
|
|
5
|
+
*/
|
|
6
|
+
export default class TucCallManager extends HttpApiProvider {
|
|
7
|
+
|
|
8
|
+
static #standardPathSegments = ['services', 'nutzer', 'parallelruf']
|
|
9
|
+
|
|
10
|
+
setParallelCall(parallelCallId, parallelCall) {
|
|
11
|
+
const parallelCallRessourceUrl = this.parallelCallUrl(parallelCallId);
|
|
12
|
+
|
|
13
|
+
return this.patch(
|
|
14
|
+
parallelCallRessourceUrl,
|
|
15
|
+
parallelCall,
|
|
16
|
+
).then(
|
|
17
|
+
response => {
|
|
18
|
+
console.debug(response.status);
|
|
19
|
+
return response.json();
|
|
20
|
+
}
|
|
21
|
+
).then(
|
|
22
|
+
jsonResponse => {
|
|
23
|
+
console.debug(jsonResponse);
|
|
24
|
+
return jsonResponse;
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
getParallelCalls() {
|
|
30
|
+
const parallelCallRessourceUrl = this.getParallelCallsUrl();
|
|
31
|
+
|
|
32
|
+
return this.get(
|
|
33
|
+
parallelCallRessourceUrl,
|
|
34
|
+
{
|
|
35
|
+
'Content-Type': JsonContentType,
|
|
36
|
+
}
|
|
37
|
+
).then(
|
|
38
|
+
response => response.json()
|
|
39
|
+
).then(
|
|
40
|
+
jsonResponse => {
|
|
41
|
+
console.debug(this.constructor.name, ':', 'get parallel calls', ':', jsonResponse);
|
|
42
|
+
return jsonResponse?.map(
|
|
43
|
+
parallelCall => ({
|
|
44
|
+
...parallelCall,
|
|
45
|
+
enableMobileConnect: parallelCall?.enableMobileConnect === 'true',
|
|
46
|
+
isMobilePhone: parallelCall?.isMobilePhone === 'true',
|
|
47
|
+
})
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
getParallelCallsUrl() {
|
|
54
|
+
return this.extendBaseUrl(TucCallManager.#standardPathSegments);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
parallelCallUrl(parallelCallId) {
|
|
58
|
+
return this.extendBaseUrl([...TucCallManager.#standardPathSegments, parallelCallId]);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Erstellt eine TucCallManager-Instanz
|
|
63
|
+
* @param {string} baseUrl URL, welche als Basis für die Anfragen verwendet werden soll
|
|
64
|
+
* @param {string} mainLanguage Die zu prioriserende Hauptsprache
|
|
65
|
+
* @param {string} accessToken Zugriffstoken, welches der Provider für den Nutzerzugriff verwendet.
|
|
66
|
+
* @returns {TucCallManager} Erstellelte TucCallManager-Instanz
|
|
67
|
+
*/
|
|
68
|
+
static from(baseUrl, mainLanguage = 'de', accessToken) {
|
|
69
|
+
const acceptingLanguages = HttpApiProvider.languagesFromMainLanguages(mainLanguage);
|
|
70
|
+
const acceptingContentTypes = HttpApiProvider.contentTypesFromContentType(JsonContentType);
|
|
71
|
+
|
|
72
|
+
return new TucCallManager(baseUrl, acceptingLanguages, acceptingContentTypes, accessToken);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
* you may not use this file except in compliance with the License.
|
|
4
|
+
* You may obtain a copy of the License at
|
|
5
|
+
*
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
* See the License for the specific language governing permissions and
|
|
12
|
+
* limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { createContext, useContext, useMemo, useEffect, useState, useCallback } from 'react';
|
|
16
|
+
|
|
17
|
+
import { useTheme } from 'react-native-paper';
|
|
18
|
+
|
|
19
|
+
import { useAccessToken, useLogoutEffect } from '../context-user';
|
|
20
|
+
|
|
21
|
+
import TucCallManager from './TucCallManager';
|
|
22
|
+
|
|
23
|
+
const TucCallManagerProviderName = 'tuc-call-manager';
|
|
24
|
+
|
|
25
|
+
const CallManagerContext = createContext();
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Provider for telephone context
|
|
29
|
+
*/
|
|
30
|
+
function CallManagerContextProvider({ children }) {
|
|
31
|
+
const componentName = CallManagerContextProvider.name;
|
|
32
|
+
const theme = useTheme();
|
|
33
|
+
|
|
34
|
+
// Einstellungen für API-Provider
|
|
35
|
+
const callManagerApiSettings = theme?.appSettings?.modules?.callManager?.api;
|
|
36
|
+
const callManagerApiProvider = callManagerApiSettings?.provider;
|
|
37
|
+
const callManagerApiBaseUrl = callManagerApiSettings?.baseUrl;
|
|
38
|
+
|
|
39
|
+
const accessToken = useAccessToken();
|
|
40
|
+
|
|
41
|
+
const [parallelCalls, setParallelCalls] = useState();
|
|
42
|
+
|
|
43
|
+
// Estellen des API-Providers bzw. erneuern wenn sich Einstellungen sich ändern.
|
|
44
|
+
const apiProvider = useMemo(
|
|
45
|
+
() => {
|
|
46
|
+
switch (callManagerApiProvider?.toLowerCase()) {
|
|
47
|
+
case TucCallManagerProviderName:
|
|
48
|
+
console.debug(componentName, ':', 'use tu chemnitz call manager');
|
|
49
|
+
return new TucCallManager.from(callManagerApiBaseUrl, 'de', accessToken);
|
|
50
|
+
default:
|
|
51
|
+
console.log(`${componentName}: Can't build api provider: ${callManagerApiProvider}`)
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
[callManagerApiProvider, callManagerApiBaseUrl, accessToken]
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
async function refreshParallelCalls() {
|
|
59
|
+
return apiProvider.getParallelCalls()
|
|
60
|
+
.then(
|
|
61
|
+
parallelCalls => {
|
|
62
|
+
setParallelCalls(parallelCalls);
|
|
63
|
+
console.debug(componentName, ':', 'get parralel calls', ':', parallelCalls);
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
useEffect(
|
|
69
|
+
() => {
|
|
70
|
+
refreshParallelCalls?.()
|
|
71
|
+
?.catch?.(
|
|
72
|
+
reason => {
|
|
73
|
+
setParallelCalls([]);
|
|
74
|
+
console.debug(componentName, ':', 'can`t get parralel calls', ':', reason);
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
[apiProvider]
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
function changeParallelCall(parallelCallId, parallelCall) {
|
|
82
|
+
return apiProvider.setParallelCall(parallelCallId, parallelCall);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Dieser Effekt setzt den State der Parrelelrufe zurück, wenn der Nutzer sich abmeldet.
|
|
86
|
+
useLogoutEffect(
|
|
87
|
+
useCallback(
|
|
88
|
+
user => {
|
|
89
|
+
console.debug(componentName, ':', 'remove paralel calls from', user.sub, 'in memory');
|
|
90
|
+
setParallelCalls(undefined);
|
|
91
|
+
},
|
|
92
|
+
[]
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<CallManagerContext.Provider
|
|
98
|
+
value={{
|
|
99
|
+
parallelCalls: parallelCalls,
|
|
100
|
+
refreshParallelCalls: refreshParallelCalls,
|
|
101
|
+
changeParallelCall: changeParallelCall,
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
{children}
|
|
105
|
+
</CallManagerContext.Provider>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function useCallManagerContext() {
|
|
110
|
+
return useContext(CallManagerContext);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function useParallelCalls() {
|
|
114
|
+
const callManagerContext = useCallManagerContext();
|
|
115
|
+
|
|
116
|
+
return [
|
|
117
|
+
callManagerContext?.parallelCalls,
|
|
118
|
+
callManagerContext?.refreshParallelCalls,
|
|
119
|
+
callManagerContext?.changeParallelCall
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
CallManagerContext as default,
|
|
125
|
+
CallManagerContextProvider,
|
|
126
|
+
useCallManagerContext,
|
|
127
|
+
useParallelCalls,
|
|
128
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import HttpApiProvider, { JsonContentType } from '../../libraries/base-api-provider';
|
|
2
|
+
|
|
3
|
+
const categories = {
|
|
4
|
+
E: 'employee',
|
|
5
|
+
G: 'guest',
|
|
6
|
+
S: 'student',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Provider that provides a REST interface to the ASiST server.
|
|
11
|
+
* The getByCode method can be used to retrieve the lectures for a personal timetable code.
|
|
12
|
+
* @extends HttpApiProvider
|
|
13
|
+
*/
|
|
14
|
+
export default class AsistServerApiProvider extends HttpApiProvider {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Short code of the university to be queried by the ASiST server.
|
|
18
|
+
* @type {String}
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
#university
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} baseUrl - URL of the ASiST server that is extended for API requests.
|
|
25
|
+
* @param {string} university - Short code of the university to be queried by the ASiST server.
|
|
26
|
+
* @param {string[]} acceptingLanguages - List of languages that are queried by the ASiST server. The priority is based on the order of the languages in the array.
|
|
27
|
+
*/
|
|
28
|
+
constructor(baseUrl, university, acceptingLanguages) {
|
|
29
|
+
// ContentTypes wird auf JSON festgesetzt, da der ASiST-Server nur JSON spricht.
|
|
30
|
+
super(baseUrl, acceptingLanguages, [JsonContentType]);
|
|
31
|
+
|
|
32
|
+
this.#university = university;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns the request URL to get all canteens from the asist server.
|
|
37
|
+
* @returns {URL} URL that can be used to query canteens.
|
|
38
|
+
*/
|
|
39
|
+
getAllUrl() {
|
|
40
|
+
return this.extendBaseUrl(['v3', this.#university, 'canteens', 'all']);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Requests the canteens from the ASiST server.
|
|
45
|
+
* @returns {Object[]} List of canteens.
|
|
46
|
+
*/
|
|
47
|
+
getCanteens() {
|
|
48
|
+
const getAllUrl = this.getAllUrl();
|
|
49
|
+
|
|
50
|
+
return this.get(getAllUrl)
|
|
51
|
+
.then(response => response.json())
|
|
52
|
+
.then(jsonResponse => jsonResponse?.canteens ?? [])
|
|
53
|
+
.then(canteens => AsistServerApiProvider.convertCanteens(canteens));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
getMenu(canteenId, date) {
|
|
57
|
+
const getAllUrl = this.getAllUrl();
|
|
58
|
+
|
|
59
|
+
return this.get(getAllUrl)
|
|
60
|
+
.then(response => response.json())
|
|
61
|
+
.then(jsonResponse => jsonResponse?.canteens ?? [])
|
|
62
|
+
.then(canteens => canteens.find(canteen => canteen.id === canteenId))
|
|
63
|
+
.then(canteen => canteen?.menuItems ?? [])
|
|
64
|
+
.then(meals => meals.filter(meal => meal.date === date))
|
|
65
|
+
.then(menu => AsistServerApiProvider.convertMenu(menu));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static convertCanteens(canteens) {
|
|
69
|
+
return canteens.map(
|
|
70
|
+
canteen =>
|
|
71
|
+
({
|
|
72
|
+
id: canteen.id?.toString?.() ?? canteen.id,
|
|
73
|
+
title: canteen.title,
|
|
74
|
+
type: canteen.type,
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static convertMenu(menu) {
|
|
80
|
+
return menu.map(meal => this.convertMeal(meal));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static convertMeal(meal) {
|
|
84
|
+
const prices = this.convertPrices(meal.prices);
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
identifier: meal?.title,
|
|
88
|
+
title: meal?.title,
|
|
89
|
+
prices: prices,
|
|
90
|
+
imageUrl: meal?.imgUrlBig,
|
|
91
|
+
category: meal?.category,
|
|
92
|
+
type: meal?.type,
|
|
93
|
+
selections: meal?.selections ?? [],
|
|
94
|
+
allergens: meal?.allergens ?? [],
|
|
95
|
+
additives: meal?.additives ?? [],
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static convertPrices(prices) {
|
|
100
|
+
return Object.fromEntries(
|
|
101
|
+
prices?.map?.(
|
|
102
|
+
price => {
|
|
103
|
+
const category = categories?.[price.title];
|
|
104
|
+
const amount = price.price;
|
|
105
|
+
|
|
106
|
+
return [category, amount];
|
|
107
|
+
}
|
|
108
|
+
) ?? []
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Static constructor that can be used to easily create a provider instance. English and German are set as request languages by default.
|
|
114
|
+
* The main languages are used to set the priority.
|
|
115
|
+
* If the main language is not German or English, this is also set as the request language.
|
|
116
|
+
* @param {string} baseUrl - URL of the ASiST server that is extended for API requests.
|
|
117
|
+
* @param {string} university - Short code of the university to be queried by the ASiST server.
|
|
118
|
+
* @param {string} mainLanguage - Main language used to create the list of languages. The main language is prioritised highest.
|
|
119
|
+
* @returns {AsistServerApiProvider} Provider instance
|
|
120
|
+
*/
|
|
121
|
+
static from(baseUrl, university, mainLanguage = 'de') {
|
|
122
|
+
const acceptingLanguages = AsistServerApiProvider.languagesFromMainLanguages(mainLanguage);
|
|
123
|
+
|
|
124
|
+
return new AsistServerApiProvider(baseUrl, university, acceptingLanguages);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import HttpApiProvider from '../../libraries/base-api-provider';
|
|
2
|
+
|
|
3
|
+
export class NotModifiedResponse {
|
|
4
|
+
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* API-Client for Kollektor
|
|
9
|
+
*/
|
|
10
|
+
export default class CollektorVersion2ApiProvider extends HttpApiProvider {
|
|
11
|
+
/**
|
|
12
|
+
* ETag cache.
|
|
13
|
+
* The key is a string that identifies the URL, whereby the associated value stores the ETag of the URL.
|
|
14
|
+
* @type {Object.<string, string>}
|
|
15
|
+
*/
|
|
16
|
+
#menusETags = {}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {string} baseUrl - URL which is used as the basis for the query URLs.
|
|
20
|
+
* @param {string[]} acceptingLanguages - List of languages that are queried by the ASiST server. The priority is based on the order of the languages in the array.
|
|
21
|
+
*/
|
|
22
|
+
constructor(baseUrl, acceptingLanguages) {
|
|
23
|
+
// ContentTypes wird auf JSON festgesetzt, da der ASiST-Server nur JSON spricht.
|
|
24
|
+
super(baseUrl, acceptingLanguages, ['application/json']);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Returns the request URL to get all canteens from the collektor.
|
|
29
|
+
* @returns {URL}
|
|
30
|
+
*/
|
|
31
|
+
getCanteensUrl() {
|
|
32
|
+
return this.extendBaseUrl(['canteens']);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns a list of all canteens.
|
|
37
|
+
* @returns {Array} Array of all courses of the timetable.
|
|
38
|
+
*/
|
|
39
|
+
getCanteens() {
|
|
40
|
+
const getCanteensUrl = this.getCanteensUrl();
|
|
41
|
+
|
|
42
|
+
return this.get(getCanteensUrl)
|
|
43
|
+
.then(response => response.json());
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Returns the request URL to get the menu of a day from the collector.
|
|
48
|
+
* @param {String} canteenId Canteen.
|
|
49
|
+
* @param {String} date ISO-8601 date of day to get.
|
|
50
|
+
* @returns {URL} URL of the menu from the given day.
|
|
51
|
+
*/
|
|
52
|
+
getMenuUrl(canteenId, date) {
|
|
53
|
+
return this.extendBaseUrl(['canteens', canteenId, 'menus', date]);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns a list of all meals from the queried day.
|
|
58
|
+
* @param {String} canteenId Canteen.
|
|
59
|
+
* @param {String} date ISO-8601 date of day to get.
|
|
60
|
+
* @returns {Array} Array of all meals of the day.
|
|
61
|
+
*/
|
|
62
|
+
getMenu(canteenId, date) {
|
|
63
|
+
const getMenuUrl = this.getMenuUrl(canteenId, date);
|
|
64
|
+
|
|
65
|
+
const menuETag = this.#menusETags?.[`${canteenId}-${date}`];
|
|
66
|
+
|
|
67
|
+
const ifNoneMatchHeader = menuETag
|
|
68
|
+
? { 'If-None-Match': menuETag }
|
|
69
|
+
: null;
|
|
70
|
+
|
|
71
|
+
const headers = {
|
|
72
|
+
...ifNoneMatchHeader,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return this.get(getMenuUrl, headers)
|
|
76
|
+
.then(
|
|
77
|
+
response => {
|
|
78
|
+
if (response.status === 304) {
|
|
79
|
+
throw new NotModifiedResponse();
|
|
80
|
+
} else {
|
|
81
|
+
const responseETag = response?.headers.get('ETag');
|
|
82
|
+
this.#menusETags[`${canteenId}-${date}`] = responseETag
|
|
83
|
+
return response.json();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Creates a CollektorVersion2ApiProvider instance initialised to a list of standard languages, where the mainLanguage parameter specifies the mainLanguage.
|
|
91
|
+
* @param {string} baseUrl - URL which is used as the basis for the query URLs.
|
|
92
|
+
* @param {string} mainLanguage - Main language which is prioritised.
|
|
93
|
+
* @returns {CollektorVersion2ApiProvider} Created CollectorVersion2ApiProvider instance.
|
|
94
|
+
*/
|
|
95
|
+
static from(baseUrl, mainLanguage = 'de') {
|
|
96
|
+
const acceptingLanguages = CollektorVersion2ApiProvider.languagesFromMainLanguages(mainLanguage);
|
|
97
|
+
|
|
98
|
+
return new CollektorVersion2ApiProvider(baseUrl, acceptingLanguages);
|
|
99
|
+
}
|
|
100
|
+
}
|