@olea-bps/base 1.1.1 → 1.1.2
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.
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
|
|
1
3
|
import HttpApiProvider, { JsonContentType } from '../../libraries/base-api-provider';
|
|
2
4
|
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
/**
|
|
4
8
|
* Infos-API-Client für Kollektor
|
|
5
9
|
*/
|
|
@@ -25,7 +29,24 @@ export default class CollektorVersion2ApiProvider extends HttpApiProvider {
|
|
|
25
29
|
const getTicketUrl = this.getTicketUrl();
|
|
26
30
|
|
|
27
31
|
return this.get(getTicketUrl)
|
|
28
|
-
.then(response => response.json())
|
|
32
|
+
.then(response => response.json())
|
|
33
|
+
.then(
|
|
34
|
+
jsonTicket => {
|
|
35
|
+
const ticketValidFromDateTime = jsonTicket?.validFrom
|
|
36
|
+
? DateTime.fromISO(jsonTicket.validFrom)
|
|
37
|
+
: null;
|
|
38
|
+
|
|
39
|
+
const ticketValidToDateTime = jsonTicket?.validTo
|
|
40
|
+
? DateTime.fromISO(jsonTicket?.validTo)
|
|
41
|
+
: null;
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
...jsonTicket,
|
|
45
|
+
validFrom: ticketValidFromDateTime,
|
|
46
|
+
validTo: ticketValidToDateTime,
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
);
|
|
29
50
|
}
|
|
30
51
|
|
|
31
52
|
/**
|
|
@@ -16,6 +16,8 @@ import { createContext, useEffect, useContext, useMemo, useCallback } from 'reac
|
|
|
16
16
|
|
|
17
17
|
import { useTheme } from 'react-native-paper';
|
|
18
18
|
|
|
19
|
+
import { DateTime } from 'luxon';
|
|
20
|
+
|
|
19
21
|
import { useSecureStoredState } from '../../libraries/stored-state';
|
|
20
22
|
import { useLanguage, useStagingServer } from '../../libraries/core';
|
|
21
23
|
import { useAccessToken } from '../context-user';
|
|
@@ -34,8 +36,8 @@ import CollektorVersion2ApiProvider from './CollektorVersion2ApiProvider';
|
|
|
34
36
|
* @typedef PublicTransportTicketContext
|
|
35
37
|
* @property {string} ticketBarcode Barcode Data-URI/URL
|
|
36
38
|
* @property {string} ticketOwner
|
|
37
|
-
* @property {
|
|
38
|
-
* @property {
|
|
39
|
+
* @property {DateTime|null} ticketValidFrom
|
|
40
|
+
* @property {DateTime|null} ticketValidTo
|
|
39
41
|
* @property {() => Promise<void>} refreshTicket
|
|
40
42
|
*/
|
|
41
43
|
|
|
@@ -137,7 +139,13 @@ function usePublicTransportTicketContext() {
|
|
|
137
139
|
* Liefert alle noch austehenden Infos zurück.
|
|
138
140
|
* Austehende Infos sind noch nicht als angezeigt markiert.
|
|
139
141
|
*
|
|
140
|
-
* @returns {[
|
|
142
|
+
* @returns {[
|
|
143
|
+
* barcode: string|undefined,
|
|
144
|
+
* owner: string|undefined,
|
|
145
|
+
* validForm: DateTime|null,
|
|
146
|
+
* validTo: DateTime|null,
|
|
147
|
+
* refreshTicket: () => Promise<void>|undefined,
|
|
148
|
+
* ]}
|
|
141
149
|
* @example
|
|
142
150
|
* const [
|
|
143
151
|
* ticketBarcode,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olea-bps/base",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "OLEA base library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"jwt-decode": "4.0.0",
|
|
44
44
|
"moment": "^2.29.4",
|
|
45
45
|
"react-native-elements": "^3.4.3",
|
|
46
|
+
"react-native-enriched-markdown": "^0.6.0",
|
|
46
47
|
"react-native-modalbox": "^2.0.2",
|
|
47
48
|
"react-native-paper": "^5.15.2",
|
|
48
49
|
"react-native-svg": "15.15.4",
|
package/views/Dashboard/index.js
CHANGED
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
* limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
useMemo,
|
|
17
|
+
useCallback,
|
|
18
|
+
} from 'react';
|
|
16
19
|
import {
|
|
17
20
|
Animated,
|
|
18
21
|
StyleSheet,
|
|
@@ -20,13 +23,15 @@ import {
|
|
|
20
23
|
RefreshControl,
|
|
21
24
|
SafeAreaView,
|
|
22
25
|
useAnimatedValue,
|
|
26
|
+
Linking,
|
|
27
|
+
Alert,
|
|
23
28
|
} from 'react-native';
|
|
24
29
|
|
|
25
30
|
import { connect } from 'react-redux';
|
|
26
31
|
import { Appbar, Button, Dialog, Portal, useTheme } from 'react-native-paper';
|
|
27
32
|
import { useTranslation } from 'react-i18next';
|
|
28
33
|
import { useFocusEffect } from '@react-navigation/native';
|
|
29
|
-
import
|
|
34
|
+
import { EnrichedMarkdownText } from 'react-native-enriched-markdown';
|
|
30
35
|
|
|
31
36
|
import { onUpdateRefreshing, DataService } from '../../libraries/core';
|
|
32
37
|
import TopNewsComponent from '../../components/TopNews';
|
|
@@ -140,9 +145,35 @@ function DashboardView(props) {
|
|
|
140
145
|
<Dialog.Content>
|
|
141
146
|
{
|
|
142
147
|
pendingInfo
|
|
143
|
-
? <
|
|
144
|
-
{pendingInfo?.message}
|
|
145
|
-
|
|
148
|
+
? <EnrichedMarkdownText
|
|
149
|
+
markdown={pendingInfo?.message}
|
|
150
|
+
selectable={false}
|
|
151
|
+
md4cFlags={{
|
|
152
|
+
// Texte können mit _text_ unterstrichen werden
|
|
153
|
+
underline: true,
|
|
154
|
+
// Texte können mit ==text== hervorgehoben werden
|
|
155
|
+
highlight: true,
|
|
156
|
+
}}
|
|
157
|
+
onLinkPress={
|
|
158
|
+
event =>
|
|
159
|
+
Linking
|
|
160
|
+
.openURL(event.url)
|
|
161
|
+
.catch(
|
|
162
|
+
reason => {
|
|
163
|
+
console.debug(componentName, ':', 'can´t open url', event.url);
|
|
164
|
+
|
|
165
|
+
// Zeige dem Nutzer an, das der Link nicht geöffent werden konnte
|
|
166
|
+
Alert.alert(
|
|
167
|
+
t('infodialog:unopenableUrlAlert:title'),
|
|
168
|
+
t('infodialog:unopenableUrlAlert:message', { link: event.url }),
|
|
169
|
+
[
|
|
170
|
+
{ text: t('infodialog:unopenableUrlAlert:okButton'), style: 'default', isPreferred: true }
|
|
171
|
+
],
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
/>
|
|
146
177
|
: null
|
|
147
178
|
}
|
|
148
179
|
</Dialog.Content>
|