@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,65 @@
|
|
|
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, { useMemo, useEffect, useRef } from "react";
|
|
16
|
+
import { useTranslation } from "react-i18next";
|
|
17
|
+
import { View, Text, StyleSheet, Animated } from "react-native";
|
|
18
|
+
import { useTheme } from "react-native-paper";
|
|
19
|
+
|
|
20
|
+
import { useConnectivityContext } from '../../context/context-connectivity';
|
|
21
|
+
|
|
22
|
+
import componentStyles from "./styles";
|
|
23
|
+
|
|
24
|
+
function ConnectivityWarning({ children, bottomNavbarHeight }) {
|
|
25
|
+
const { isConnected } = useConnectivityContext();
|
|
26
|
+
const { t } = useTranslation();
|
|
27
|
+
const theme = useTheme();
|
|
28
|
+
|
|
29
|
+
const opacity = useRef(new Animated.Value(0)).current;
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
opacity.setValue(0);
|
|
33
|
+
Animated.timing(opacity, {
|
|
34
|
+
toValue: 1,
|
|
35
|
+
duration: 1000,
|
|
36
|
+
useNativeDriver: true,
|
|
37
|
+
}).start();
|
|
38
|
+
}, [isConnected]);
|
|
39
|
+
|
|
40
|
+
const styles = useMemo(() => {
|
|
41
|
+
const baseStyles = componentStyles(theme);
|
|
42
|
+
return StyleSheet.create({
|
|
43
|
+
...baseStyles,
|
|
44
|
+
warningContainer: {
|
|
45
|
+
...baseStyles.warningContainer,
|
|
46
|
+
// -1 to avoid a small gap between the warning and the bottom navbar
|
|
47
|
+
marginBottom: bottomNavbarHeight - 1,
|
|
48
|
+
opacity: opacity,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
}, [theme, bottomNavbarHeight, opacity]);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<View style={styles.container}>
|
|
55
|
+
{children}
|
|
56
|
+
{!isConnected && (
|
|
57
|
+
<Animated.View style={[styles.warningContainer]}>
|
|
58
|
+
<Text style={styles.warningText}>{t("warning:noConnection")}</Text>
|
|
59
|
+
</Animated.View>
|
|
60
|
+
)}
|
|
61
|
+
</View>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default ConnectivityWarning;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default function (theme) {
|
|
2
|
+
return {
|
|
3
|
+
container: {
|
|
4
|
+
flex: 1,
|
|
5
|
+
},
|
|
6
|
+
warningContainer: {
|
|
7
|
+
position: "absolute",
|
|
8
|
+
bottom: 0,
|
|
9
|
+
width: "100%",
|
|
10
|
+
height: 30,
|
|
11
|
+
justifyContent: "center",
|
|
12
|
+
backgroundColor: theme.colors.error,
|
|
13
|
+
},
|
|
14
|
+
warningText: {
|
|
15
|
+
color: theme.colors.errorText,
|
|
16
|
+
textAlign: "center",
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
StyleSheet,
|
|
20
|
+
Text,
|
|
21
|
+
View,
|
|
22
|
+
SafeAreaView,
|
|
23
|
+
Share,
|
|
24
|
+
Linking,
|
|
25
|
+
TouchableOpacity,
|
|
26
|
+
Platform,
|
|
27
|
+
ScrollView
|
|
28
|
+
} from 'react-native';
|
|
29
|
+
import {Appbar, Headline, List, withTheme} from "react-native-paper";
|
|
30
|
+
|
|
31
|
+
import { connect } from 'react-redux'
|
|
32
|
+
import {withTranslation} from "react-i18next";
|
|
33
|
+
import merge from 'lodash/merge';
|
|
34
|
+
|
|
35
|
+
import componentStyles from "./styles"
|
|
36
|
+
import AppbarComponent from '../AppBar';
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Contact Detail Component
|
|
41
|
+
*
|
|
42
|
+
* Shows the detailed information of a contact with name and contact details.
|
|
43
|
+
* Provides a share functionality.
|
|
44
|
+
*
|
|
45
|
+
* Parameters:
|
|
46
|
+
* - contact: Contact object with all information about the contact
|
|
47
|
+
*
|
|
48
|
+
* Navigation-Parameters:
|
|
49
|
+
* - none
|
|
50
|
+
*/
|
|
51
|
+
class ContactDetailComponent extends React.Component {
|
|
52
|
+
static propTypes = {
|
|
53
|
+
contact: PropTypes.object.isRequired
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Styles of this component
|
|
57
|
+
styles;
|
|
58
|
+
|
|
59
|
+
contact = null;
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
constructor(props) {
|
|
63
|
+
super(props);
|
|
64
|
+
// ------------------------------------------------------------------------
|
|
65
|
+
// PLUGIN FUNCTIONALITY
|
|
66
|
+
// ------------------------------------------------------------------------
|
|
67
|
+
|
|
68
|
+
const { pluginStyles,theme } = this.props;
|
|
69
|
+
this.styles = componentStyles(theme);
|
|
70
|
+
|
|
71
|
+
if(pluginStyles) {
|
|
72
|
+
this.styles = merge(this.styles, pluginStyles);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
this.styles = StyleSheet.create(this.styles);
|
|
76
|
+
|
|
77
|
+
// ------------------------------------------------------------------------
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Share function for contact
|
|
82
|
+
*
|
|
83
|
+
* @returns {Promise<void>}
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
86
|
+
async _onShare() {
|
|
87
|
+
try {
|
|
88
|
+
const { t } = this.props;
|
|
89
|
+
|
|
90
|
+
let phone = "";
|
|
91
|
+
if(this.contact.telephone.length > 0) {
|
|
92
|
+
phone += "\n"+ t('contact:phone') +": ";
|
|
93
|
+
this.contact.telephone.forEach((phoneNumber) => {
|
|
94
|
+
phone += phoneNumber.number + '\n';
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let message = t('contact:title') + ' - ' + this.contact.firstName + ' ' + this.contact.lastName +
|
|
99
|
+
((this.contact.building) ? "\n" + t('contact:building') + ": " + this.contact.building : '') +
|
|
100
|
+
((this.contact.department) ? "\n" + t('contact:department') + ": " + this.contact.department : '') +
|
|
101
|
+
((this.contact.room && this.contact.room.title) ? "\n" + t('contact:room') + ": " + this.contact.room.title : '') +
|
|
102
|
+
((this.contact.email) ? "\n" + t('contact:email') + ": " + this.contact.email : '') +
|
|
103
|
+
phone;
|
|
104
|
+
|
|
105
|
+
const result = await Share.share({
|
|
106
|
+
message: message
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
if (result.action === Share.sharedAction) {
|
|
110
|
+
if (result.activityType) {
|
|
111
|
+
// shared with activity type of result.activityType
|
|
112
|
+
} else {
|
|
113
|
+
// shared
|
|
114
|
+
}
|
|
115
|
+
} else if (result.action === Share.dismissedAction) {
|
|
116
|
+
// dismissed
|
|
117
|
+
}
|
|
118
|
+
} catch (error) {
|
|
119
|
+
alert(error.message);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Render contact details content
|
|
125
|
+
*
|
|
126
|
+
* @returns {*}
|
|
127
|
+
* @private
|
|
128
|
+
*/
|
|
129
|
+
_renderContent = () => {
|
|
130
|
+
const { contact, t } = this.props;
|
|
131
|
+
const { themeStyles } = this.props.theme;
|
|
132
|
+
|
|
133
|
+
let output = [];
|
|
134
|
+
let index = 1;
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
if(contact.building)
|
|
140
|
+
output.push(<List.Item key="building" title={t('contact:building')} description={contact.building}
|
|
141
|
+
descriptionStyle={themeStyles.textLighter} titleStyle={themeStyles.searchDetailTitle}
|
|
142
|
+
descriptionNumberOfLines={200}/>);
|
|
143
|
+
|
|
144
|
+
if(contact.department)
|
|
145
|
+
output.push(<List.Item key="department" title={t('contact:department')} description={contact.department}
|
|
146
|
+
descriptionStyle={themeStyles.textLighter} titleStyle={themeStyles.searchDetailTitle}
|
|
147
|
+
descriptionNumberOfLines={200}/>);
|
|
148
|
+
|
|
149
|
+
if(contact.room && contact.room.title)
|
|
150
|
+
output.push(<List.Item key="room" title={t('contact:room')} description={contact.room.title}
|
|
151
|
+
descriptionStyle={themeStyles.textLighter} titleStyle={themeStyles.searchDetailTitle}
|
|
152
|
+
descriptionNumberOfLines={200}/>);
|
|
153
|
+
|
|
154
|
+
if(contact.email)
|
|
155
|
+
output.push(<TouchableOpacity key="email" onPress={() => Linking.openURL('mailto:' + contact.email)}>
|
|
156
|
+
<List.Item title={t('contact:email')} description={contact.email}
|
|
157
|
+
descriptionStyle={themeStyles.textLighter} titleStyle={themeStyles.searchDetailTitle}
|
|
158
|
+
right={props => <List.Icon {...props} icon="email"/>}/>
|
|
159
|
+
</TouchableOpacity>
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
if(contact.telephone.length > 0) {
|
|
163
|
+
contact.telephone.forEach((phoneNumber) => {
|
|
164
|
+
output.push(
|
|
165
|
+
<TouchableOpacity key={'phone_'+ index} onPress={() => {
|
|
166
|
+
const formattedPhoneNumber = phoneNumber.number.replace(/\s/g, '');
|
|
167
|
+
Linking.openURL('tel:' + formattedPhoneNumber).catch(error => console.error(`ContactDetailComponent - Fehler beim öffnen des Telefons ${Platform.OS}`, error));
|
|
168
|
+
}}>
|
|
169
|
+
<List.Item
|
|
170
|
+
title={t('contact:phone') + ' ' + index}
|
|
171
|
+
description={phoneNumber.number}
|
|
172
|
+
descriptionStyle={themeStyles.textLighter}
|
|
173
|
+
titleStyle={themeStyles.searchDetailTitle}
|
|
174
|
+
right={props =>
|
|
175
|
+
<List.Icon {...props}
|
|
176
|
+
icon="phone"/>}
|
|
177
|
+
/>
|
|
178
|
+
</TouchableOpacity>
|
|
179
|
+
);
|
|
180
|
+
index++;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<ScrollView style={this.styles.containerInner}>
|
|
187
|
+
<Headline style={this.styles.name}>{contact.firstName} {contact.lastName}</Headline>
|
|
188
|
+
{output}
|
|
189
|
+
<View style={this.styles.space}/>
|
|
190
|
+
</ScrollView>
|
|
191
|
+
);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
render() {
|
|
195
|
+
// ------------------------------------------------------------------------
|
|
196
|
+
// PLUGIN FUNCTIONALITY
|
|
197
|
+
// ------------------------------------------------------------------------
|
|
198
|
+
const PluginComponent = this.props.pluginComponent;
|
|
199
|
+
if (PluginComponent) {
|
|
200
|
+
return <PluginComponent />;
|
|
201
|
+
}
|
|
202
|
+
// ------------------------------------------------------------------------
|
|
203
|
+
|
|
204
|
+
const {themeStyles} = this.props.theme;
|
|
205
|
+
const { contact, t } = this.props;
|
|
206
|
+
|
|
207
|
+
if(!contact){
|
|
208
|
+
return (<Text>{t('contact:couldNotLoad')}</Text>);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
this.contact = contact;
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<SafeAreaView style={[this.styles.container, themeStyles.safeAreaContainer]}>
|
|
215
|
+
<AppbarComponent {...this.props}
|
|
216
|
+
title={t('contact:contactInformation')}
|
|
217
|
+
rightAction={<Appbar.Action icon="share-variant" onPress={this._onShare.bind(this)}/>}/>
|
|
218
|
+
{this._renderContent()}
|
|
219
|
+
</SafeAreaView>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
const mapStateToProps = state => {
|
|
226
|
+
return {
|
|
227
|
+
pluginComponent: state.pluginReducer.contactDetail.component,
|
|
228
|
+
pluginStyles: state.pluginReducer.contactDetail.styles
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export default connect(mapStateToProps, null)(withTranslation()(withTheme(ContactDetailComponent)))
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export default function(theme) {
|
|
2
|
+
return {
|
|
3
|
+
container: {
|
|
4
|
+
flex: 1,
|
|
5
|
+
},
|
|
6
|
+
containerInner: {
|
|
7
|
+
flex: 1,
|
|
8
|
+
paddingHorizontal: theme.paddings.default,
|
|
9
|
+
paddingVertical: theme.paddings.default
|
|
10
|
+
},
|
|
11
|
+
activity: {
|
|
12
|
+
marginTop: theme.paddings.default
|
|
13
|
+
},
|
|
14
|
+
badges: {
|
|
15
|
+
flexDirection: 'row',
|
|
16
|
+
flexWrap: 'wrap',
|
|
17
|
+
paddingHorizontal: theme.paddings.small
|
|
18
|
+
},
|
|
19
|
+
badge: {
|
|
20
|
+
marginRight: theme.paddings.xsmall,
|
|
21
|
+
marginBottom: theme.paddings.xsmall
|
|
22
|
+
},
|
|
23
|
+
name: {
|
|
24
|
+
paddingLeft: theme.paddings.xsmall + theme.paddings.small,
|
|
25
|
+
fontSize: theme.fontSizes.title,
|
|
26
|
+
lineHeight: theme.lineHeights.contactName
|
|
27
|
+
},
|
|
28
|
+
space: {
|
|
29
|
+
height: theme.paddings.large
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|