@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.
Files changed (268) hide show
  1. package/components/AppBar/index.js +84 -0
  2. package/components/AppBar/styles.js +27 -0
  3. package/components/BookDetail/index.js +268 -0
  4. package/components/BookDetail/styles.js +124 -0
  5. package/components/ComponentJobsFilter/index.js +188 -0
  6. package/components/ComponentJobsFilter/styles.js +12 -0
  7. package/components/ConnectivityWarning/index.js +65 -0
  8. package/components/ConnectivityWarning/styles.js +19 -0
  9. package/components/ContactDetail/index.js +232 -0
  10. package/components/ContactDetail/styles.js +32 -0
  11. package/components/CourseDetail/index.js +357 -0
  12. package/components/CourseDetail/styles.js +59 -0
  13. package/components/CourseDetailDialog/index.js +169 -0
  14. package/components/CourseDetailDialog/styles.js +116 -0
  15. package/components/CourseInfo/index.js +219 -0
  16. package/components/CourseInfo/styles.js +40 -0
  17. package/components/DevelopmentDialog/index.js +214 -0
  18. package/components/DevelopmentDialog/styles.js +10 -0
  19. package/components/EventCodeInput/index.js +149 -0
  20. package/components/EventCodeInput/styles.js +108 -0
  21. package/components/FlexMenuEntry/index.js +84 -0
  22. package/components/FlexMenuEntry/styles.js +27 -0
  23. package/components/MainMenuEntry/index.js +88 -0
  24. package/components/MainMenuEntry/styles.js +28 -0
  25. package/components/MealItem/index.js +87 -0
  26. package/components/MealItem/styles.js +84 -0
  27. package/components/MensaMenu/index.js +305 -0
  28. package/components/MensaMenu/styles.js +94 -0
  29. package/components/MensaSlider/index.js +188 -0
  30. package/components/MensaSlider/styles.js +53 -0
  31. package/components/Modal/index.js +106 -0
  32. package/components/Modal/styles.js +8 -0
  33. package/components/NewsDetail/index.js +377 -0
  34. package/components/NewsDetail/styles.js +77 -0
  35. package/components/NewsList/index.js +120 -0
  36. package/components/NewsList/styles.js +19 -0
  37. package/components/NewsListItem/index.js +89 -0
  38. package/components/NewsListItem/styles.js +32 -0
  39. package/components/OtherCourses/index.js +152 -0
  40. package/components/OtherCourses/styles.js +10 -0
  41. package/components/PtsDeparture/index.js +140 -0
  42. package/components/PtsDeparture/styles.js +7 -0
  43. package/components/PtsStation/index.js +186 -0
  44. package/components/PtsStation/styles.js +47 -0
  45. package/components/QuickLinks/index.js +127 -0
  46. package/components/QuickLinks/styles.js +45 -0
  47. package/components/RoomDetail/index.js +281 -0
  48. package/components/RoomDetail/styles.js +56 -0
  49. package/components/ScaledImage/index.js +92 -0
  50. package/components/SearchResults/index.js +362 -0
  51. package/components/SearchResults/styles.js +59 -0
  52. package/components/SettingSection/index.js +54 -0
  53. package/components/SettingSection/styles.js +15 -0
  54. package/components/SettingsDialog/index.js +52 -0
  55. package/components/SettingsDialog/styles.js +12 -0
  56. package/components/SettingsDialogRadio/index.js +66 -0
  57. package/components/SettingsDialogRadio/styles.js +7 -0
  58. package/components/SettingsDialogSelect/index.js +73 -0
  59. package/components/SettingsDialogSelect/styles.js +7 -0
  60. package/components/TimetableCodeInput/index.js +205 -0
  61. package/components/TimetableCodeInput/styles.js +28 -0
  62. package/components/TimetableDay/index.js +252 -0
  63. package/components/TimetableDay/styles.js +103 -0
  64. package/components/TimetableEvent/index.js +163 -0
  65. package/components/TimetableEvent/styles.js +108 -0
  66. package/components/TimetableList/index.js +180 -0
  67. package/components/TimetableList/styles.js +106 -0
  68. package/components/TimetableMonth/index.js +156 -0
  69. package/components/TimetableMonth/styles.js +29 -0
  70. package/components/TimetableWeek/index.js +230 -0
  71. package/components/TimetableWeek/styles.js +58 -0
  72. package/components/TopNews/index.js +282 -0
  73. package/components/TopNews/styles.js +125 -0
  74. package/components/TopNewsHtwk/index.js +279 -0
  75. package/components/TopNewsHtwk/styles.js +142 -0
  76. package/components/WebView/index.js +108 -0
  77. package/components/WebView/styles.js +11 -0
  78. package/context/context-callmanager/TucCallManager.js +74 -0
  79. package/context/context-callmanager/index.js +128 -0
  80. package/context/context-canteen/AsistServerApiProvider.js +126 -0
  81. package/context/context-canteen/CollektorVersion2ApiProvider.js +100 -0
  82. package/context/context-canteen/index.js +692 -0
  83. package/context/context-connectivity/index.js +85 -0
  84. package/context/context-event/AsistServerClient.js +82 -0
  85. package/context/context-event/index.js +205 -0
  86. package/context/context-flex-menu/AsistServerApiProvider.js +0 -0
  87. package/context/context-flex-menu/CollectorVersion2ApiProvider.js +32 -0
  88. package/context/context-flex-menu/index.js +160 -0
  89. package/context/context-info-dialog/CollektorVersion2ApiProvider.js +53 -0
  90. package/context/context-info-dialog/ProviderErrors.js +22 -0
  91. package/context/context-info-dialog/index.js +190 -0
  92. package/context/context-mails/MailService.js +147 -0
  93. package/context/context-mails/TucUnseenApiProvider.js +65 -0
  94. package/context/context-mails/index.js +131 -0
  95. package/context/context-news/CollektorVersion2ApiProvider.js +68 -0
  96. package/context/context-news/index.js +155 -0
  97. package/context/context-public-transport-ticket/CollektorVersion2ApiProvider.js +45 -0
  98. package/context/context-public-transport-ticket/ProviderErrors.js +11 -0
  99. package/context/context-public-transport-ticket/index.js +175 -0
  100. package/context/context-timetable/CollectorVersion2ApiProvider.js +102 -0
  101. package/context/context-timetable/ProviderErrors.js +22 -0
  102. package/context/context-timetable/TimetableService.js +357 -0
  103. package/context/context-timetable/index.js +215 -0
  104. package/context/context-user/index.js +586 -0
  105. package/index.js +178 -0
  106. package/libraries/base-api-provider/hooks.js +24 -0
  107. package/libraries/base-api-provider/http-api-provider.js +168 -0
  108. package/libraries/base-api-provider/index.js +20 -0
  109. package/libraries/core/api/canteens.js +88 -0
  110. package/libraries/core/api/corona.js +45 -0
  111. package/libraries/core/api/courses.js +54 -0
  112. package/libraries/core/api/device.js +98 -0
  113. package/libraries/core/api/feed.js +144 -0
  114. package/libraries/core/api/feedback.js +123 -0
  115. package/libraries/core/api/jobs.js +48 -0
  116. package/libraries/core/api/library.js +67 -0
  117. package/libraries/core/api/lostfound.js +77 -0
  118. package/libraries/core/api/occupancy.js +44 -0
  119. package/libraries/core/api/officehours.js +25 -0
  120. package/libraries/core/api/poi.js +25 -0
  121. package/libraries/core/api/pts.js +68 -0
  122. package/libraries/core/api/rooms.js +31 -0
  123. package/libraries/core/api/survey.js +121 -0
  124. package/libraries/core/api/telephone.js +32 -0
  125. package/libraries/core/api/tucrooms.js +31 -0
  126. package/libraries/core/constants/actions.js +75 -0
  127. package/libraries/core/constants/api.js +146 -0
  128. package/libraries/core/constants/enums.js +5 -0
  129. package/libraries/core/helper/date.js +9 -0
  130. package/libraries/core/helper/format.helper.js +2 -0
  131. package/libraries/core/index.js +60 -0
  132. package/libraries/core/redux/actions/notifications.js +6 -0
  133. package/libraries/core/redux/actions/setting.js +75 -0
  134. package/libraries/core/redux/actions/state.js +74 -0
  135. package/libraries/core/redux/asyncDispatch.js +27 -0
  136. package/libraries/core/redux/reducers/api.js +190 -0
  137. package/libraries/core/redux/reducers/index.js +32 -0
  138. package/libraries/core/redux/reducers/notifications.js +16 -0
  139. package/libraries/core/redux/reducers/setting.js +99 -0
  140. package/libraries/core/redux/reducers/state.js +122 -0
  141. package/libraries/core/redux/selectors.js +123 -0
  142. package/libraries/core/redux/store.js +40 -0
  143. package/libraries/core/services/data.js +96 -0
  144. package/libraries/core/services/root-navigation.js +36 -0
  145. package/libraries/core/services/search.js +175 -0
  146. package/libraries/core-plugins/enums/replaceTypes.js +53 -0
  147. package/libraries/core-plugins/index.js +21 -0
  148. package/libraries/core-plugins/redux/actions/plugin.js +13 -0
  149. package/libraries/core-plugins/redux/reducers/plugin.js +210 -0
  150. package/libraries/icons-openasist/index.js +143 -0
  151. package/libraries/notifications/index.js +268 -0
  152. package/libraries/notifications/services/subscriber.service.js +123 -0
  153. package/libraries/react-native-webview-autoheight/README.md +47 -0
  154. package/libraries/react-native-webview-autoheight/index.js +140 -0
  155. package/libraries/react-native-webview-autoheight/package.json +37 -0
  156. package/libraries/react-native-webview-autoheight/utils.js +268 -0
  157. package/libraries/redux-offline/.eslintignore +1 -0
  158. package/libraries/redux-offline/.github/ISSUE_TEMPLATE/redux-offline-core-issues-template.md +25 -0
  159. package/libraries/redux-offline/.prettierrc +6 -0
  160. package/libraries/redux-offline/LICENSE +21 -0
  161. package/libraries/redux-offline/README.md +133 -0
  162. package/libraries/redux-offline/flow-typed/npm/redux-logger_vx.x.x.js +109 -0
  163. package/libraries/redux-offline/flow-typed/npm/redux_v4.x.x.js +100 -0
  164. package/libraries/redux-offline/lib/actions.js +46 -0
  165. package/libraries/redux-offline/lib/config.js +15 -0
  166. package/libraries/redux-offline/lib/constants.js +17 -0
  167. package/libraries/redux-offline/lib/defaults/defaultCommit.js +11 -0
  168. package/libraries/redux-offline/lib/defaults/defaultRollback.js +11 -0
  169. package/libraries/redux-offline/lib/defaults/detectNetwork.js +33 -0
  170. package/libraries/redux-offline/lib/defaults/detectNetwork.native.js +211 -0
  171. package/libraries/redux-offline/lib/defaults/discard.js +18 -0
  172. package/libraries/redux-offline/lib/defaults/effect.js +87 -0
  173. package/libraries/redux-offline/lib/defaults/index.js +32 -0
  174. package/libraries/redux-offline/lib/defaults/offlineStateLens.js +24 -0
  175. package/libraries/redux-offline/lib/defaults/persist.js +9 -0
  176. package/libraries/redux-offline/lib/defaults/persist.native.js +17 -0
  177. package/libraries/redux-offline/lib/defaults/persistAutoRehydrate.js +8 -0
  178. package/libraries/redux-offline/lib/defaults/queue.js +27 -0
  179. package/libraries/redux-offline/lib/defaults/retry.js +29 -0
  180. package/libraries/redux-offline/lib/index.js +115 -0
  181. package/libraries/redux-offline/lib/middleware.js +56 -0
  182. package/libraries/redux-offline/lib/offlineActionTracker.js +43 -0
  183. package/libraries/redux-offline/lib/send.js +112 -0
  184. package/libraries/redux-offline/lib/types.js +3 -0
  185. package/libraries/redux-offline/lib/updater.js +111 -0
  186. package/libraries/redux-offline/package.json +69 -0
  187. package/libraries/redux-offline/src/__tests__/defaults/discard.js +22 -0
  188. package/libraries/redux-offline/src/__tests__/defaults/effect.js +118 -0
  189. package/libraries/redux-offline/src/__tests__/index.js +116 -0
  190. package/libraries/redux-offline/src/__tests__/middleware.js +185 -0
  191. package/libraries/redux-offline/src/__tests__/offlineActionTracker.js +54 -0
  192. package/libraries/redux-offline/src/__tests__/send.js +208 -0
  193. package/libraries/redux-offline/src/actions.js +36 -0
  194. package/libraries/redux-offline/src/config.js +9 -0
  195. package/libraries/redux-offline/src/constants.js +18 -0
  196. package/libraries/redux-offline/src/defaults/defaultCommit.js +7 -0
  197. package/libraries/redux-offline/src/defaults/defaultRollback.js +7 -0
  198. package/libraries/redux-offline/src/defaults/detectNetwork.js +16 -0
  199. package/libraries/redux-offline/src/defaults/detectNetwork.native.js +148 -0
  200. package/libraries/redux-offline/src/defaults/discard.js +19 -0
  201. package/libraries/redux-offline/src/defaults/effect.js +86 -0
  202. package/libraries/redux-offline/src/defaults/index.js +25 -0
  203. package/libraries/redux-offline/src/defaults/offlineStateLens.js +11 -0
  204. package/libraries/redux-offline/src/defaults/persist.js +4 -0
  205. package/libraries/redux-offline/src/defaults/persist.native.js +9 -0
  206. package/libraries/redux-offline/src/defaults/persistAutoRehydrate.js +4 -0
  207. package/libraries/redux-offline/src/defaults/queue.js +20 -0
  208. package/libraries/redux-offline/src/defaults/retry.js +18 -0
  209. package/libraries/redux-offline/src/index.js +138 -0
  210. package/libraries/redux-offline/src/middleware.js +52 -0
  211. package/libraries/redux-offline/src/offlineActionTracker.js +40 -0
  212. package/libraries/redux-offline/src/send.js +111 -0
  213. package/libraries/redux-offline/src/types.js +127 -0
  214. package/libraries/redux-offline/src/updater.js +141 -0
  215. package/libraries/redux-offline/typings.d.ts +150 -0
  216. package/libraries/redux-offline/yarn.lock +6460 -0
  217. package/libraries/stored-state/index.js +155 -0
  218. package/package.json +68 -0
  219. package/views/Callmanager/index.js +148 -0
  220. package/views/Callmanager/styles.js +62 -0
  221. package/views/Canteens/index.js +383 -0
  222. package/views/Canteens/styles.js +89 -0
  223. package/views/Dashboard/index.js +176 -0
  224. package/views/Dashboard/styles.js +16 -0
  225. package/views/DashboardHtwk/index.js +197 -0
  226. package/views/DashboardHtwk/styles.js +24 -0
  227. package/views/Event/index.js +373 -0
  228. package/views/Event/styles.js +63 -0
  229. package/views/FeedList/index.js +165 -0
  230. package/views/FeedList/styles.js +15 -0
  231. package/views/FeedNews/index.js +243 -0
  232. package/views/FeedNews/styles.js +32 -0
  233. package/views/Flexmenu/index.js +185 -0
  234. package/views/Flexmenu/styles.js +62 -0
  235. package/views/FlexmenuWebview/index.js +167 -0
  236. package/views/FlexmenuWebview/styles.js +16 -0
  237. package/views/Howhy/index.js +151 -0
  238. package/views/Howhy/styles.js +11 -0
  239. package/views/Jobs/index.js +217 -0
  240. package/views/Jobs/styles.js +41 -0
  241. package/views/MainMenu/index.js +283 -0
  242. package/views/MainMenu/styles.js +36 -0
  243. package/views/NewsTabbar/index.js +164 -0
  244. package/views/NewsTabbar/styles.js +27 -0
  245. package/views/Opal/index.js +136 -0
  246. package/views/Opal/styles.js +11 -0
  247. package/views/PublicTransportTicket/index.js +173 -0
  248. package/views/PublicTransportTicket/styles.js +17 -0
  249. package/views/Search/index.js +186 -0
  250. package/views/Search/styles.js +67 -0
  251. package/views/SettingsAccessibility/index.js +148 -0
  252. package/views/SettingsAccessibility/styles.js +13 -0
  253. package/views/SettingsAppInfo/index.js +86 -0
  254. package/views/SettingsAppInfo/styles.js +18 -0
  255. package/views/SettingsCanteens/index.js +249 -0
  256. package/views/SettingsCanteens/styles.js +33 -0
  257. package/views/SettingsGeneral/index.js +173 -0
  258. package/views/SettingsGeneral/styles.js +28 -0
  259. package/views/SettingsNotifications/index.js +204 -0
  260. package/views/SettingsNotifications/styles.js +38 -0
  261. package/views/SettingsUser/index.js +170 -0
  262. package/views/SettingsUser/styles.js +17 -0
  263. package/views/TimetableCalendar/index.js +387 -0
  264. package/views/TimetableCalendar/styles.js +121 -0
  265. package/views/TimetableList/index.js +402 -0
  266. package/views/TimetableList/styles.js +55 -0
  267. package/views/Webviews/index.js +158 -0
  268. package/views/Webviews/styles.js +11 -0
@@ -0,0 +1,96 @@
1
+ /**
2
+ * This service requests the data from the server to
3
+ * fill the redux store with new informations to use it offline.
4
+ *
5
+ */
6
+ import AsyncStorage from '@react-native-async-storage/async-storage';
7
+ import { RESET_STATE } from '../../redux-offline/src/constants';
8
+
9
+ import {store} from '../redux/store';
10
+ import {updateFeeds, updateTopNews} from '../api/feed';
11
+ import {updateAllMeals} from '../api/canteens';
12
+ import {updateCourses} from '../api/courses';
13
+ import {updateCoronaMenu} from "../api/corona";
14
+
15
+
16
+ export class DataService {
17
+
18
+
19
+ constructor(){
20
+ // ToDo - Functions
21
+ // - Interval Request for Updates
22
+ // - Force Request for Updates
23
+
24
+ // ToDo - Functionality Description
25
+ // - Use api to receive new informatons
26
+ // - Fill redux store with new informations
27
+ // - Remove old data from redux store
28
+
29
+ }
30
+
31
+ /**
32
+ * Triggers a refresh of the server data
33
+ */
34
+ refresh() {
35
+ store.dispatch({type: RESET_STATE});
36
+ store.dispatch( updateFeeds() );
37
+ store.dispatch( updateTopNews() );
38
+ store.dispatch( updateAllMeals() );
39
+ store.dispatch( updateCoronaMenu() );
40
+ this.checkCourses(false, true);
41
+ }
42
+
43
+
44
+ /**
45
+ * Check for course update by the stored course timetableCode
46
+ *
47
+ * @param resetState
48
+ *
49
+ * @returns {Promise<void>}
50
+ */
51
+ checkCourses = async (resetState, hideErrors = false) => {
52
+ try {
53
+ const timetableCode = await AsyncStorage.getItem('OpenASiST:courses_timetableCode');
54
+ if (timetableCode !== null) {
55
+ store.dispatch( updateCourses(timetableCode, hideErrors) );
56
+ if (resetState) {
57
+ store.dispatch({type: RESET_STATE});
58
+ }
59
+ }
60
+ } catch (error) {
61
+ // Error retrieving data
62
+ }
63
+ };
64
+
65
+ /**
66
+ * Updates the date in the set interval
67
+ */
68
+ pollUpdate() {
69
+ // setInterval(() => {
70
+ //store.dispatch( updateWeather());
71
+ // }, 15000);
72
+
73
+ //store.dispatch( updateWeather());
74
+ }
75
+ /*
76
+ _updateFeeds = () => {
77
+ feedApi.getFeeds((feeds) => {
78
+ if(feeds != null) {
79
+ // Update redux store
80
+ store.dispatch(onUpdateFeeds(feeds));
81
+
82
+ // Request feed items
83
+ let feedItems = [];
84
+ feeds.forEach((feed, index) => {
85
+ feedApi.getFeedById(feed.feedid, (feedItems) => {
86
+ if (feedItems != null) {
87
+ store.dispatch(onUpdateFeedItems({'id': feed.feedid, 'items': feedItems}));
88
+ }
89
+ });
90
+ });
91
+ }
92
+ });
93
+
94
+ }*/
95
+
96
+ }
@@ -0,0 +1,36 @@
1
+
2
+ import { createNavigationContainerRef } from '@react-navigation/native';
3
+
4
+ /**
5
+ * Root Navigation Service for modules which are not inside the navigation context.
6
+ *
7
+ * Use with the navigation settings (see Settings.js) of each app.
8
+ */
9
+
10
+
11
+ let _isNavigationReady = false;
12
+ const _navigationReadyCallbacks = [];
13
+ export const navigationRef = createNavigationContainerRef()
14
+
15
+ export function navigate(name, params) {
16
+ if (navigationRef.isReady()) {
17
+ navigationRef.navigate(name, params);
18
+ }
19
+ }
20
+
21
+ export function isNavigationReady() {
22
+ return _isNavigationReady;
23
+ }
24
+
25
+ export function onNavigationReady(callback) {
26
+ if (_isNavigationReady) {
27
+ callback();
28
+ } else {
29
+ _navigationReadyCallbacks.push(callback);
30
+ }
31
+ }
32
+
33
+ export function triggerNavigationReady() {
34
+ _isNavigationReady = true;
35
+ _navigationReadyCallbacks.forEach(callback => callback());
36
+ }
@@ -0,0 +1,175 @@
1
+ import { store } from '../redux/store';
2
+ import { libraryApi } from '../api/library';
3
+ import { roomsApi } from '../api/rooms';
4
+ import { telephoneApi } from '../api/telephone';
5
+ import { feedApi } from '../api/feed';
6
+
7
+ import {
8
+ onUpdateSearchTopic,
9
+ onUpdateSearchResultsBooks,
10
+ onUpdateSearchResultsContacts,
11
+ onUpdateSearchResultsRooms,
12
+ onUpdateSearchResultsNews
13
+ } from '../redux/actions/state';
14
+
15
+ export class SearchService {
16
+ static categories = [
17
+ 'books',
18
+ 'contacts',
19
+ 'rooms',
20
+ ];
21
+
22
+ constructor(){
23
+
24
+ }
25
+
26
+ /**
27
+ * Search through all available search api routes
28
+ *
29
+ * @param searchString
30
+ * @param finishedCallback
31
+ * @param includedModules
32
+ * @returns {Promise<void>}
33
+ */
34
+ searchAll(searchString, finishedCallback, includedModules=SearchService.categories) {
35
+ this._clearSearchResults();
36
+
37
+ const searchQueries = [];
38
+
39
+ if(includedModules.includes('books')) {
40
+ searchQueries.push(new Promise((resolve) => {
41
+ this._searchForBooks(searchString, resolve);
42
+ }));
43
+ }
44
+
45
+ if(includedModules.includes('contacts')) {
46
+ searchQueries.push(new Promise((resolve) => {
47
+ this._searchForContacts(searchString, resolve);
48
+ }));
49
+ }
50
+
51
+ if(includedModules.includes('rooms')) {
52
+ searchQueries.push(new Promise((resolve) => {
53
+ this._searchForRooms(searchString, resolve);
54
+ }));
55
+ }
56
+
57
+ /* TODO Not required at the moment
58
+ const searchNews = new Promise((resolve) => {
59
+ this._searchForNews(searchString, resolve);
60
+ });
61
+ */
62
+
63
+ Promise.all(searchQueries).then(finishedCallback);
64
+ }
65
+
66
+ /**
67
+ * Search by a specific type. Ignore the rest.
68
+ *
69
+ * @param type
70
+ * @param searchString
71
+ * @param finishedCallback
72
+ */
73
+ searchByType(type, searchString, finishedCallback) {
74
+ this._clearSearchResults();
75
+
76
+ const searchPromise = new Promise((resolve) => {
77
+ switch(type){
78
+ case 'books':
79
+ this._searchForBooks(searchString, resolve);
80
+ break;
81
+ case 'contacts':
82
+ this._searchForContacts(searchString, resolve);
83
+ break;
84
+ case 'rooms':
85
+ this._searchForRooms(searchString, resolve);
86
+ break;
87
+ default:
88
+ finishedCallback();
89
+ }
90
+ });
91
+ searchPromise.then(finishedCallback);
92
+ }
93
+
94
+ /**
95
+ * Remove all results in the store
96
+ * @private
97
+ */
98
+ _clearSearchResults() {
99
+ store.dispatch(onUpdateSearchResultsBooks(null));
100
+ store.dispatch(onUpdateSearchResultsContacts(null));
101
+ store.dispatch(onUpdateSearchResultsRooms(null));
102
+ store.dispatch(onUpdateSearchResultsNews(null));
103
+ }
104
+
105
+ /**
106
+ * Search for books by the provided search string and save the result in the redux store
107
+ *
108
+ * @param search
109
+ * @param finishedCallback
110
+ * @private
111
+ */
112
+ _searchForBooks(search, finishedCallback) {
113
+ let urlEncodedSearch = encodeURIComponent(search);
114
+ libraryApi.getSearchForBooks(urlEncodedSearch, (results) => {
115
+ store.dispatch(onUpdateSearchResultsBooks(results));
116
+ finishedCallback();
117
+ });
118
+ }
119
+
120
+ /**
121
+ * Search for contacts by the provided search string and save the result in the redux store
122
+ *
123
+ * @param search
124
+ * @param finishedCallback
125
+ * @private
126
+ */
127
+ _searchForContacts(search, finishedCallback) {
128
+
129
+ let urlEncodedSearch = encodeURIComponent(search);
130
+
131
+ telephoneApi.getSearchForName(urlEncodedSearch, (results) => {
132
+ store.dispatch(onUpdateSearchResultsContacts(results));
133
+ finishedCallback();
134
+ });
135
+ }
136
+
137
+ /**
138
+ * Search for rooms by the provided search string and save the result in the redux store
139
+ *
140
+ * @param search
141
+ * @param finishedCallback
142
+ * @private
143
+ */
144
+ _searchForRooms(search, finishedCallback) {
145
+
146
+ let urlEncodedSearch = encodeURIComponent(search);
147
+
148
+ roomsApi.getSearchForRooms(urlEncodedSearch, (results) => {
149
+ store.dispatch(onUpdateSearchResultsRooms(results));
150
+ finishedCallback();
151
+ });
152
+ }
153
+ /**
154
+ * Search for news by the provided search string and save the result in the redux store
155
+ *
156
+ * @param search
157
+ * @param finishedCallback
158
+ * @private
159
+ */
160
+ _searchForNews(search, finishedCallback) {
161
+
162
+ let urlEncodedSearch = encodeURIComponent(search);
163
+ // TODO Replace with code below
164
+ feedApi.getFeedById(3, res => {
165
+ store.dispatch(onUpdateSearchResultsNews(res));
166
+ finishedCallback();
167
+ });
168
+ /*
169
+ feedApi.getSearchForNews(urlEncodedSearch, (results) => {
170
+ store.dispatch(onUpdateSearchResultsNews(results));
171
+ finishedCallback();
172
+ });
173
+ */
174
+ }
175
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Types of replacing components and styles
3
+ */
4
+ export default Object.freeze({
5
+ 'dashboardComponent' : 'REPLACE_DASHBOARD_COMPONENT',
6
+ 'dashboardStyles' : 'REPLACE_DASHBOARD_STYLES',
7
+ 'mainMenuComponent' : 'REPLACE_MAIN_MENU_COMPONENT',
8
+ 'mainMenuStyles' : 'REPLACE_MAIN_MENU_STYLES',
9
+ 'feedListComponent' : 'REPLACE_FEED_LIST_COMPONENT',
10
+ 'feedListStyles' : 'REPLACE_FEED_LIST_STYLES',
11
+ 'NewsList' : 'REPLACE_FEED_NEWS_COMPONENT',
12
+ 'feedNewsStyles' : 'REPLACE_FEED_NEWS_STYLES',
13
+ 'appBarComponent' : 'REPLACE_APP_BAR_COMPONENT',
14
+ 'appBarStyles' : 'REPLACE_APP_BAR_STYLES',
15
+ 'topNewsComponent' : 'REPLACE_TOP_NEWS_COMPONENT',
16
+ 'topNewsStyles' : 'REPLACE_TOP_NEWS_STYLES',
17
+ 'newsDetailComponent' : 'REPLACE_NEWS_DETAIL_COMPONENT',
18
+ 'newsDetailStyles' : 'REPLACE_NEWS_DETAIL_STYLES',
19
+ 'mensaSliderComponent' : 'REPLACE_MENSA_SLIDER_COMPONENT',
20
+ 'mensaSliderStyles' : 'REPLACE_MENSA_SLIDER_STYLES',
21
+ 'mensaComponent' : 'REPLACE_MENSA_COMPONENT',
22
+ 'mensaStyles' : 'REPLACE_MENSA_STYLES',
23
+ 'mealItemComponent' : 'REPLACE_MEAL_ITEM_COMPONENT',
24
+ 'mealItemStyles' : 'REPLACE_MEAL_ITEM_STYLES',
25
+ 'bookDetailComponent' : 'REPLACE_BOOK_DETAIL_COMPONENT',
26
+ 'bookDetailStyles' : 'REPLACE_BOOK_DETAIL_STYLES',
27
+ 'contactDetailComponent' : 'REPLACE_CONTACT_DETAIL_COMPONENT',
28
+ 'contactDetailStyles' : 'REPLACE_CONTACT_DETAIL_STYLES',
29
+ 'courseInfoComponent' : 'REPLACE_COURSE_INFO_COMPONENT',
30
+ 'courseInfoStyles' : 'REPLACE_COURSE_INFO_STYLES',
31
+ 'ptsDepartureComponent' : 'REPLACE_PTS_DEPARTURE_COMPONENT',
32
+ 'ptsDepartureStyles' : 'REPLACE_PTS_DEPARTURE_STYLES',
33
+ 'ptsStationComponent' : 'REPLACE_PTS_STATION_COMPONENT',
34
+ 'ptsStationStyles' : 'REPLACE_PTS_STATION_STYLES',
35
+ 'searchComponent' : 'REPLACE_SEARCH_COMPONENT',
36
+ 'searchStyles' : 'REPLACE_SEARCH_STYLES',
37
+ 'searchResultsComponent' : 'REPLACE_SEARCH_RESULTS_COMPONENT',
38
+ 'searchResultsStyles' : 'REPLACE_SEARCH_RESULTS_STYLES',
39
+ 'opalComponent' : 'REPLACE_OPAL_COMPONENT',
40
+ 'opalStyles' : 'REPLACE_OPAL_STYLES',
41
+ 'poiComponent' : 'REPLACE_POI_COMPONENT',
42
+ 'poiStyles' : 'REPLACE_POI_STYLES',
43
+ 'ptsComponent' : 'REPLACE_PTS_COMPONENT',
44
+ 'ptsStyles' : 'REPLACE_PTS_STYLES',
45
+ 'roomDirectoryComponent' : 'REPLACE_ROOM_DIRECTORY_COMPONENT',
46
+ 'roomDirectoryStyles' : 'REPLACE_ROOM_DIRECTORY_STYLES',
47
+ 'timetableComponent' : 'REPLACE_TIMETABLE_COMPONENT',
48
+ 'timetableStyles' : 'REPLACE_TIMETABLE_STYLES',
49
+ 'modalComponent' : 'REPLACE_MODAL_COMPONENT',
50
+ 'modalStyles' : 'REPLACE_MODAL_STYLES',
51
+ 'webViewsComponent' : 'REPLACE_WEB_VIEWS_COMPONENT',
52
+ 'webViewsStyles' : 'REPLACE_WEB_VIEWS_STYLES'
53
+ });
@@ -0,0 +1,21 @@
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
+
16
+ // ----------------------------------------
17
+ // Redux
18
+ // ----------------------------------------
19
+ export pluginReducer from './redux/reducers/plugin';
20
+ export * from './redux/actions/plugin';
21
+ export replaceTypes from './enums/replaceTypes';
@@ -0,0 +1,13 @@
1
+ export const onComponentReplace = (componentToReplace, component) => {
2
+ return {
3
+ type: componentToReplace,
4
+ component
5
+ }
6
+ };
7
+
8
+ export const onStylesReplace = (stylesToReplace, styles) => {
9
+ return {
10
+ type: stylesToReplace,
11
+ styles
12
+ }
13
+ };
@@ -0,0 +1,210 @@
1
+ const initialState = {
2
+ appBar: {
3
+ component: null,
4
+ styles: null
5
+ },
6
+ dashboard: {
7
+ component: null,
8
+ styles: null
9
+ },
10
+ mainMenu: {
11
+ component: null,
12
+ styles: null
13
+ },
14
+ feedList: {
15
+ component: null,
16
+ styles: null
17
+ },
18
+ feedNews: {
19
+ component: null,
20
+ styles: null
21
+ },
22
+ topNews: {
23
+ component: null,
24
+ styles: null
25
+ },
26
+ newsDetail: {
27
+ component: null,
28
+ styles: null
29
+ },
30
+ mensaSlider: {
31
+ component: null,
32
+ styles: null
33
+ },
34
+ canteens: {
35
+ component: null,
36
+ styles: null
37
+ },
38
+ mealItem: {
39
+ component: null,
40
+ styles: null
41
+ },
42
+ bookDetail: {
43
+ component: null,
44
+ styles: null
45
+ },
46
+ contactDetail: {
47
+ component: null,
48
+ styles: null
49
+ },
50
+ courseInfo: {
51
+ component: null,
52
+ styles: null
53
+ },
54
+ ptsDeparture: {
55
+ component: null,
56
+ styles: null
57
+ },
58
+ ptsStation: {
59
+ component: null,
60
+ styles: null
61
+ },
62
+ search: {
63
+ component: null,
64
+ styles: null
65
+ },
66
+ searchResults: {
67
+ component: null,
68
+ styles: null
69
+ },
70
+ opal: {
71
+ component: null,
72
+ styles: null
73
+ },
74
+ poi: {
75
+ component: null,
76
+ styles: null
77
+ },
78
+ pts: {
79
+ component: null,
80
+ styles: null
81
+ },
82
+ roomDirectory: {
83
+ component: null,
84
+ styles: null
85
+ },
86
+ timetable: {
87
+ component: null,
88
+ styles: null
89
+ },
90
+ modal: {
91
+ component: null,
92
+ styles: null
93
+ },
94
+ webViews: {
95
+ component: null,
96
+ styles: null
97
+ },
98
+ settingsGeneral: {
99
+ component: null,
100
+ styles: null
101
+ },
102
+ settingsCanteens: {
103
+ component: null,
104
+ styles: null
105
+ },
106
+ settingsAccessibility: {
107
+ component: null,
108
+ styles: null
109
+ },
110
+ settingsNotifications: {
111
+ component: null,
112
+ styles: null
113
+ },
114
+ settingsWeather: {
115
+ component: null,
116
+ styles: null
117
+ },
118
+ jobPortal: {
119
+ component: null,
120
+ styles: null
121
+ },
122
+ jobFilter: {
123
+ component: null,
124
+ styles: null
125
+ }
126
+ };
127
+
128
+ export default (state = initialState, action) => {
129
+ let key = '';
130
+ const type = action.type.replace('_COMPONENT', '').replace('_STYLES', '');
131
+ const replaceKey = action.type.indexOf('_COMPONENT') > 0 ? 'component' : action.type.indexOf('_STYLES') > 0 ? 'styles' : '';
132
+
133
+ switch(type) {
134
+ case 'RESET_STATE':
135
+ return initialState;
136
+ // ---------------------------------------------------------------------------------------------------------------------------------------
137
+ case 'REPLACE_DASHBOARD': key = 'dashboard'; break;
138
+ // ---------------------------------------------------------------------------------------------------------------------------------------
139
+ case 'REPLACE_MAIN_MENU': key = 'mainMenu'; break;
140
+ // ---------------------------------------------------------------------------------------------------------------------------------------
141
+ case 'REPLACE_FEED_LIST': key = 'feedList'; break;
142
+ // ---------------------------------------------------------------------------------------------------------------------------------------
143
+ case 'REPLACE_FEED_NEWS': key = 'feedNews'; break;
144
+ // ---------------------------------------------------------------------------------------------------------------------------------------
145
+ case 'REPLACE_APP_BAR': key = 'appBar'; break;
146
+ // ---------------------------------------------------------------------------------------------------------------------------------------
147
+ case 'REPLACE_TOP_NEWS': key = 'topNews'; break;
148
+ // ---------------------------------------------------------------------------------------------------------------------------------------
149
+ case 'REPLACE_NEWS_DETAIL': key = 'newsDetail'; break;
150
+ // ---------------------------------------------------------------------------------------------------------------------------------------
151
+ case 'REPLACE_MENSA_SLIDER': key = 'mensaSlider'; break;
152
+ // ---------------------------------------------------------------------------------------------------------------------------------------
153
+ case 'REPLACE_CANTEENS': key = 'canteens'; break;
154
+ // ---------------------------------------------------------------------------------------------------------------------------------------
155
+ case 'REPLACE_MEAL_ITEM': key = 'mealItem'; break;
156
+ // ---------------------------------------------------------------------------------------------------------------------------------------
157
+ case 'REPLACE_BOOK_DETAIL': key = 'bookDetail'; break;
158
+ // ---------------------------------------------------------------------------------------------------------------------------------------
159
+ case 'REPLACE_CONTACT_DETAIL': key = 'contactDetail'; break;
160
+ // ---------------------------------------------------------------------------------------------------------------------------------------
161
+ case 'REPLACE_COURSE_INFO': key = 'courseInfo'; break;
162
+ // ---------------------------------------------------------------------------------------------------------------------------------------
163
+ case 'REPLACE_PTS': key = 'pts'; break;
164
+ // ---------------------------------------------------------------------------------------------------------------------------------------
165
+ case 'REPLACE_PTS_DEPARTURE': key = 'ptsDeparture'; break;
166
+ // ---------------------------------------------------------------------------------------------------------------------------------------
167
+ case 'REPLACE_PTS_STATION': key = 'ptsStation'; break;
168
+ // ---------------------------------------------------------------------------------------------------------------------------------------
169
+ case 'REPLACE_SEARCH': key = 'search'; break;
170
+ // ---------------------------------------------------------------------------------------------------------------------------------------
171
+ case 'REPLACE_SEARCH_RESULTS': key = 'searchResults'; break;
172
+ // ---------------------------------------------------------------------------------------------------------------------------------------
173
+ case 'REPLACE_OPAL': key = 'opal'; break;
174
+ // ---------------------------------------------------------------------------------------------------------------------------------------
175
+ case 'REPLACE_POI': key = 'poi'; break;
176
+ // ---------------------------------------------------------------------------------------------------------------------------------------
177
+ case 'REPLACE_ROOM_DIRECTORY': key = 'roomDirectory'; break;
178
+ // ---------------------------------------------------------------------------------------------------------------------------------------
179
+ case 'REPLACE_TIMETABLE': key = 'timetable'; break;
180
+ // ---------------------------------------------------------------------------------------------------------------------------------------
181
+ case 'REPLACE_MODAL': key = 'modal'; break;
182
+ // ---------------------------------------------------------------------------------------------------------------------------------------
183
+ case 'REPLACE_WEB_VIEWS': key = 'webViews'; break;
184
+ // ---------------------------------------------------------------------------------------------------------------------------------------
185
+ case 'REPLACE_SETTINGS_GENERAL': key = 'settingsGeneral'; break;
186
+ // ---------------------------------------------------------------------------------------------------------------------------------------
187
+ case 'REPLACE_SETTINGS_CANTEENS': key = 'settingsCanteens'; break;
188
+ // ---------------------------------------------------------------------------------------------------------------------------------------
189
+ case 'REPLACE_SETTINGS_ACCESSIBILITY': key = 'settingsAccessibility'; break;
190
+ // ---------------------------------------------------------------------------------------------------------------------------------------
191
+ case 'REPLACE_SETTINGS_NOTIFICATIONS': key = 'settingsNotifications'; break;
192
+ // ---------------------------------------------------------------------------------------------------------------------------------------
193
+ case 'REPLACE_JOB_PORTAL': key = 'jobPortal'; break;
194
+ // ---------------------------------------------------------------------------------------------------------------------------------------
195
+ case 'REPLACE_JOB_FILTER': key = 'jobFilter'; break;
196
+ // ---------------------------------------------------------------------------------------------------------------------------------------
197
+ default:
198
+ return state;
199
+ }
200
+
201
+ if(key !== '' && replaceKey !== '') {
202
+ return {
203
+ ...state,
204
+ [key]: {
205
+ [replaceKey]: action[replaceKey]
206
+ }
207
+ };
208
+ }
209
+ return state;
210
+ };