@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,155 @@
|
|
|
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 { useState, useReducer, useEffect, useCallback } from 'react';
|
|
16
|
+
|
|
17
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
18
|
+
import * as SecureStore from 'expo-secure-store';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Erstellt einen State, der über async-storage persistiert wird und eine Update- bzw. Reset-Funktion.
|
|
22
|
+
* Dieser Hook kann wie der useState-Hook von React benutzt werden.
|
|
23
|
+
* Der Inhalt wird nicht verschlüsselt abgelegt.
|
|
24
|
+
* Falls eine Verschlüsselung gewünscht wird, ist {@link useSecureStoredState} zu nutzen.
|
|
25
|
+
* @param {string} key Schlüssel, unter welcher der Wert des States persistiert wird.
|
|
26
|
+
* @param {any | (() => any)} initialState Initialer Wert des States
|
|
27
|
+
* @return {[]} Array, welches den Wert des States, eine Update-Funktion und eine Reset-Funktion beinhaltet
|
|
28
|
+
*/
|
|
29
|
+
export function asyncStoredState(key, initialState) {
|
|
30
|
+
const [value, setValue] = useState(initialState);
|
|
31
|
+
|
|
32
|
+
const clearValue = useCallback(
|
|
33
|
+
() => {
|
|
34
|
+
AsyncStorage.removeItem(key)
|
|
35
|
+
.then(() => setValue(initialState))
|
|
36
|
+
|
|
37
|
+
},
|
|
38
|
+
[setValue, AsyncStorage.removeItem]
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
useEffect(
|
|
42
|
+
() => {
|
|
43
|
+
AsyncStorage.getItem(key)
|
|
44
|
+
.then(JSON.parse)
|
|
45
|
+
.then(setValue);
|
|
46
|
+
},
|
|
47
|
+
[]
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
useEffect(
|
|
51
|
+
() => {
|
|
52
|
+
AsyncStorage.setItem(key, JSON.stringify(value));
|
|
53
|
+
},
|
|
54
|
+
[value]
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
return [value, setValue, clearValue];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Dieser Hook stellt einen State zur Verfügung, welcher automatisch in dem lokalen Speicher persistiert wird.
|
|
62
|
+
* Der State kann als sinsitiv makiert werden, wodurch der enthaltende Wert nicht in Logausgeben geschrieben wird.
|
|
63
|
+
* Standartmäßig sind die SecureStoredStates nicht sensitiv markiert.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} key Schlüssel unter welchem der Wert des State geladen und gespeichert wird.
|
|
66
|
+
* @param {*} initialState Initialer Wert des States.
|
|
67
|
+
* @param {boolean} [sensitiv=true] Ist der gespeicherte Wert nicht in den Logs auszugeben?
|
|
68
|
+
* @returns {[state, (newState) => void], () => void}
|
|
69
|
+
*/
|
|
70
|
+
export function useSecureStoredState(key, initialState = null, sensitiv = false) {
|
|
71
|
+
const hookName = useSecureStoredState.name;
|
|
72
|
+
|
|
73
|
+
const [state, setState] = useState(
|
|
74
|
+
() => {
|
|
75
|
+
const stringValue = SecureStore.getItem(key);
|
|
76
|
+
if (stringValue) {
|
|
77
|
+
return JSON.parse(stringValue);
|
|
78
|
+
} else {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const setSecureStoredState = useCallback(
|
|
85
|
+
value => {
|
|
86
|
+
SecureStore
|
|
87
|
+
.setItemAsync(key, JSON.stringify(value))
|
|
88
|
+
.then(() => setState(value))
|
|
89
|
+
.catch(reason => console.error(hookName, ': can`t store secure state: ', reason, 'key:', key, 'value:', sensitiv ? '***sensitiv value***' : value));
|
|
90
|
+
},
|
|
91
|
+
[key, setState, SecureStore]
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
function deleteSecureStoredState() {
|
|
95
|
+
SecureStore
|
|
96
|
+
.deleteItemAsync(key)
|
|
97
|
+
.then(() => setState(undefined))
|
|
98
|
+
.then(() => console.debug(hookName, ':', 'remove secure state', key))
|
|
99
|
+
.catch((reason) => console.debug(hookName, ':', 'can`t remove secure state', key, ':', reason));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return [
|
|
103
|
+
state !== undefined
|
|
104
|
+
? state
|
|
105
|
+
: initialState,
|
|
106
|
+
setSecureStoredState,
|
|
107
|
+
deleteSecureStoredState,
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Dieser Hook stellt einen State zur Verfügung, welcher automatisch in dem lokalen Speicher persistiert wird.
|
|
113
|
+
* Der State kann als sinsitiv makiert werden, wodurch der enthaltende Wert nicht in Logausgeben geschrieben wird.
|
|
114
|
+
* Standartmäßig sind die SecureStoredStates nicht sensitiv markiert.
|
|
115
|
+
*
|
|
116
|
+
* @param {string} key Schlüssel unter welchem der Wert des State geladen und gespeichert wird.
|
|
117
|
+
* @param {(prevState: any) => any} reducer The reducer function that specifies how the state gets updated. It must be pure, should take the state and action as arguments, and should return the next state. State and action can be of any types.
|
|
118
|
+
* @param {*} initialState Initialer Wert des States.
|
|
119
|
+
* @param {boolean} [sensitiv=true] Ist der gespeicherte Wert nicht in den Logs auszugeben?
|
|
120
|
+
* @returns {[state, (newState) => void]}
|
|
121
|
+
*/
|
|
122
|
+
export function useSecureStoredReducer(key, reducer, initialState = null, sensitiv = false) {
|
|
123
|
+
const hookName = useSecureStoredReducer.name;
|
|
124
|
+
|
|
125
|
+
const [state, dispatch] = useReducer(
|
|
126
|
+
reducer,
|
|
127
|
+
undefined,
|
|
128
|
+
() => {
|
|
129
|
+
const stringValue = SecureStore.getItem(key);
|
|
130
|
+
if (stringValue) {
|
|
131
|
+
return JSON.parse(stringValue);
|
|
132
|
+
} else {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
useEffect(
|
|
139
|
+
() => {
|
|
140
|
+
if (state !== undefined) {
|
|
141
|
+
SecureStore
|
|
142
|
+
.setItemAsync(key, JSON.stringify(state))
|
|
143
|
+
.catch(reason => console.error(hookName, ': can`t store secure state: ', reason, 'key:', key, 'value:', sensitiv ? '***sensitiv value***' : state));
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
[state]
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
return [
|
|
150
|
+
state !== undefined
|
|
151
|
+
? state
|
|
152
|
+
: initialState,
|
|
153
|
+
dispatch,
|
|
154
|
+
];
|
|
155
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@olea-bps/base",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "OLEA base library",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/tuc-urz/olea.git",
|
|
9
|
+
"directory": "packages/"
|
|
10
|
+
},
|
|
11
|
+
"contributors": [
|
|
12
|
+
{
|
|
13
|
+
"name": "Universitätsrechenzentrum TU Chemnitz",
|
|
14
|
+
"email": "support@hrz.tu-chemnitz.de",
|
|
15
|
+
"url": "https://www.tu-chemnitz.de/urz/"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "codeculture",
|
|
19
|
+
"email": "info@codeculture.de",
|
|
20
|
+
"url": "https://codeculture.de/"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "BPS Bildungsportal Sachsen GmbH",
|
|
24
|
+
"email": "info@bps-system.de",
|
|
25
|
+
"url": "https://www.bps-system.de/"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"redux": "^4.0.5",
|
|
31
|
+
"redux-persist": "^6.0.0",
|
|
32
|
+
"react-redux": "^9.2.0",
|
|
33
|
+
"react-native-webview": "13.16.0",
|
|
34
|
+
"react-native-vector-icons": "^10.2.0",
|
|
35
|
+
"react-native-uuid": "^2.0.3",
|
|
36
|
+
"react-native-tab-view": "^4.1.3",
|
|
37
|
+
"react-native-swipe-gestures": "^1.0.5",
|
|
38
|
+
"react-native-svg": "15.15.4",
|
|
39
|
+
"react-native-paper": "^5.14.5",
|
|
40
|
+
"react-native-modalbox": "^2.0.2",
|
|
41
|
+
"react-native-elements": "^3.4.3",
|
|
42
|
+
"moment": "^2.29.4",
|
|
43
|
+
"jwt-decode": "4.0.0",
|
|
44
|
+
"expo-web-browser": "~14.2.0",
|
|
45
|
+
"expo-linear-gradient": "~15.0.7",
|
|
46
|
+
"expo-crypto": "~14.1.4",
|
|
47
|
+
"expo-auth-session": "~6.2.1",
|
|
48
|
+
"expo-application": "^6.1.5",
|
|
49
|
+
"@react-navigation/native": "^7.1.9",
|
|
50
|
+
"@react-navigation/drawer": "^7.3.12",
|
|
51
|
+
"@react-native-firebase/messaging": "^22.2.0",
|
|
52
|
+
"@react-native-firebase/app": "^22.2.0",
|
|
53
|
+
"@react-native-community/netinfo": "^11.4.1",
|
|
54
|
+
"@react-native-async-storage/async-storage": "~2.2.0",
|
|
55
|
+
"@novu/client": "^2.6.6",
|
|
56
|
+
"@notifee/react-native": "^9.1.8"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"redux": "^4.0.5",
|
|
60
|
+
"react": "^19.0.0",
|
|
61
|
+
"react-redux": "^9.2.0",
|
|
62
|
+
"react-native": "^0.81.0",
|
|
63
|
+
"react-native-paper": "^5.0.0"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@expo/vector-icons": "^14.1.0"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
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 { useState, useMemo } from 'react';
|
|
16
|
+
import {
|
|
17
|
+
SafeAreaView,
|
|
18
|
+
StyleSheet,
|
|
19
|
+
View,
|
|
20
|
+
Switch,
|
|
21
|
+
Alert,
|
|
22
|
+
RefreshControl,
|
|
23
|
+
} from 'react-native';
|
|
24
|
+
|
|
25
|
+
import { connect } from 'react-redux'
|
|
26
|
+
import { useTheme, Text, Button } from 'react-native-paper';
|
|
27
|
+
import { useTranslation } from 'react-i18next';
|
|
28
|
+
|
|
29
|
+
import { useParallelCalls } from '../../context/context-callmanager';
|
|
30
|
+
import { useUser } from '../../context/context-user';
|
|
31
|
+
import AppbarComponent from '../../components/AppBar';
|
|
32
|
+
|
|
33
|
+
import componentStyles from './styles';
|
|
34
|
+
|
|
35
|
+
export default function CallManagerView(props) {
|
|
36
|
+
const componentName = CallManagerView.name;
|
|
37
|
+
const theme = useTheme();
|
|
38
|
+
const themeStyles = theme?.themeStyles;
|
|
39
|
+
|
|
40
|
+
const { t } = useTranslation();
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const styles = useMemo(
|
|
44
|
+
() => StyleSheet.create(componentStyles(theme)),
|
|
45
|
+
[theme]
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
const [user, login, logout] = useUser();
|
|
49
|
+
const [parallelCalls, refreshParallelCalls, changeParallelCall] = useParallelCalls();
|
|
50
|
+
|
|
51
|
+
const [remoteDestinationProfilesRefreshing, setRemoteDestinationProfilesRefreshing] = useState(false);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<SafeAreaView style={themeStyles.appSafeAreaContainer}>
|
|
55
|
+
<AppbarComponent {...props}
|
|
56
|
+
title={t('menu:titles.callmanager')}
|
|
57
|
+
/>
|
|
58
|
+
<View style={themeStyles.container}>
|
|
59
|
+
{
|
|
60
|
+
// Wenn ein Nutzer in der App angemeldet ist, werden dessen Parralelrufe angezeigt. Ansonsten wird der Nutzer zum Loggin aufgefordert.
|
|
61
|
+
user
|
|
62
|
+
? <RefreshControl
|
|
63
|
+
refreshing={remoteDestinationProfilesRefreshing}
|
|
64
|
+
onRefresh={() => {
|
|
65
|
+
setRemoteDestinationProfilesRefreshing(true);
|
|
66
|
+
refreshParallelCalls()
|
|
67
|
+
.finally(() => setRemoteDestinationProfilesRefreshing(false));
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
<Text>
|
|
71
|
+
{t('callmanager:userInfo', { userName: user.name, userPhoneNumber: user.phone_number })}
|
|
72
|
+
</Text>
|
|
73
|
+
{
|
|
74
|
+
parallelCalls?.map?.(
|
|
75
|
+
parallelCall => {
|
|
76
|
+
const isActive = parallelCall?.enableMobileConnect;
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<View
|
|
80
|
+
key={parallelCall?.destination}
|
|
81
|
+
>
|
|
82
|
+
<Text>
|
|
83
|
+
{parallelCall?.destination ?? t('callmanager:numberNotDisplayable')}
|
|
84
|
+
</Text>
|
|
85
|
+
<Switch
|
|
86
|
+
value={isActive}
|
|
87
|
+
onValueChange={
|
|
88
|
+
value =>
|
|
89
|
+
changeParallelCall(parallelCall?.destination, { enableMobileConnect: value })
|
|
90
|
+
.then(() => refreshParallelCalls())
|
|
91
|
+
}
|
|
92
|
+
/>
|
|
93
|
+
</View >
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
<Button
|
|
99
|
+
onPress={() => Alert.alert(
|
|
100
|
+
t('callmanager:logout'),
|
|
101
|
+
t('callmanager:logoutConfirmation'),
|
|
102
|
+
[
|
|
103
|
+
{
|
|
104
|
+
text: t('callmanager:logoutOkButton'),
|
|
105
|
+
onPress: () => logout?.(),
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
text: t('callmanager:logoutNoButton'),
|
|
109
|
+
isPreferred: true,
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
)}
|
|
113
|
+
>
|
|
114
|
+
{t('callmanager:logout')}
|
|
115
|
+
</Button>
|
|
116
|
+
</RefreshControl>
|
|
117
|
+
: <>
|
|
118
|
+
<Text>
|
|
119
|
+
{t('callmanager:notLoggedIn')}
|
|
120
|
+
</Text>
|
|
121
|
+
<Button
|
|
122
|
+
onPress={
|
|
123
|
+
() =>
|
|
124
|
+
login
|
|
125
|
+
? login()
|
|
126
|
+
.catch(
|
|
127
|
+
reason => {
|
|
128
|
+
Alert.alert(
|
|
129
|
+
t('callmanager:loginFailed'),
|
|
130
|
+
t('callmanager:tryLoginAgain'),
|
|
131
|
+
);
|
|
132
|
+
console.debug(componentName, ':', 'login failed', ':', reason);
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
: Alert.alert(
|
|
136
|
+
t('callmanager:connectionError'),
|
|
137
|
+
t('callmanager:connectionErrorTryLoginAgain'),
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
>
|
|
141
|
+
{t('callmanager:logginButton')}
|
|
142
|
+
</Button>
|
|
143
|
+
</>
|
|
144
|
+
}
|
|
145
|
+
</View>
|
|
146
|
+
</SafeAreaView >
|
|
147
|
+
)
|
|
148
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export default function(theme) {
|
|
2
|
+
return {
|
|
3
|
+
activity: {
|
|
4
|
+
padding: 20
|
|
5
|
+
},
|
|
6
|
+
arrowIcon: {
|
|
7
|
+
marginStart: 'auto',
|
|
8
|
+
marginEnd: 10,
|
|
9
|
+
},
|
|
10
|
+
companyCity:{
|
|
11
|
+
fontSize: theme.fontSizes.s,
|
|
12
|
+
paddingTop: theme.paddings.xsmall,
|
|
13
|
+
color: theme.colors.secondaryText
|
|
14
|
+
},
|
|
15
|
+
container: {
|
|
16
|
+
flex: 1,
|
|
17
|
+
backgroundColor: theme.colors.background,
|
|
18
|
+
},
|
|
19
|
+
containerErrorMsg: {
|
|
20
|
+
flex: 1,
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
alignContent: 'center',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
margin: theme.paddings.default,
|
|
25
|
+
},
|
|
26
|
+
content: {
|
|
27
|
+
backgroundColor: theme.colors.background,
|
|
28
|
+
flex: 1
|
|
29
|
+
},
|
|
30
|
+
date:{
|
|
31
|
+
fontSize: theme.fontSizes.s,
|
|
32
|
+
paddingTop: theme.paddings.xsmall
|
|
33
|
+
},
|
|
34
|
+
header: {
|
|
35
|
+
backgroundColor: theme.colors.background,
|
|
36
|
+
padding: 10,
|
|
37
|
+
flexDirection: "row",
|
|
38
|
+
justifyContent: 'flex-start',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
},
|
|
41
|
+
headerText: {
|
|
42
|
+
fontSize: theme.fontSizes.l,
|
|
43
|
+
...theme.fonts.light,
|
|
44
|
+
marginTop: 10,
|
|
45
|
+
marginBottom: 10
|
|
46
|
+
},
|
|
47
|
+
innerContainer: {
|
|
48
|
+
padding: 40,
|
|
49
|
+
marginTop: 200
|
|
50
|
+
},
|
|
51
|
+
title:{
|
|
52
|
+
fontSize: theme.fontSizes.xxl,
|
|
53
|
+
color: theme.colors.jobsTitleColor
|
|
54
|
+
},
|
|
55
|
+
titleNoJobs:{
|
|
56
|
+
fontSize: theme.fontSizes.xxl,
|
|
57
|
+
color: theme.colors.jobsTitleColor,
|
|
58
|
+
textAlign: 'center',
|
|
59
|
+
marginBottom: theme.paddings.default
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
};
|