@olea-bps/base 1.0.1 → 1.0.3
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.
|
@@ -24,7 +24,7 @@ import CollektorVersion2ApiProvider from './CollektorVersion2ApiProvider';
|
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* @typedef Ticket
|
|
27
|
-
* @property {string} barcode
|
|
27
|
+
* @property {string} barcode URL oder Data-URI für den Ticketbarcode als Bild
|
|
28
28
|
* @property {string} owner
|
|
29
29
|
* @property {date} valid_from
|
|
30
30
|
* @property {date} valid_to
|
|
@@ -32,7 +32,7 @@ import CollektorVersion2ApiProvider from './CollektorVersion2ApiProvider';
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* @typedef PublicTransportTicketContext
|
|
35
|
-
* @property {string} ticketBarcode
|
|
35
|
+
* @property {string} ticketBarcode Barcode Data-URI/URL
|
|
36
36
|
* @property {string} ticketOwner
|
|
37
37
|
* @property {string} ticketValidFrom
|
|
38
38
|
* @property {string} ticketValidTo
|
|
@@ -21,7 +21,6 @@ import * as SecureStore from 'expo-secure-store';
|
|
|
21
21
|
import { useTranslation } from 'react-i18next';
|
|
22
22
|
import { useSelector } from 'react-redux';
|
|
23
23
|
import { useTheme } from 'react-native-paper';
|
|
24
|
-
import notifee, { TriggerType } from '@notifee/react-native';
|
|
25
24
|
import { DateTime } from 'luxon';
|
|
26
25
|
|
|
27
26
|
/**
|
|
@@ -318,59 +317,6 @@ function UserContextProvider({ children }) {
|
|
|
318
317
|
[refreshToken, refreshTokenAt, discovery]
|
|
319
318
|
);
|
|
320
319
|
|
|
321
|
-
useEffect(
|
|
322
|
-
() => {
|
|
323
|
-
if (refreshToken && refreshTokenAt && refreshTokenExpiresAt) {
|
|
324
|
-
notifee.requestPermission()
|
|
325
|
-
.then(
|
|
326
|
-
notificationSettings =>
|
|
327
|
-
notifee.createChannel({
|
|
328
|
-
id: RefreshTokenReqiredNotificationChannelId,
|
|
329
|
-
name: t('authentication:notificationChannelName'),
|
|
330
|
-
description: t('authentication:notificationChannelDescription'),
|
|
331
|
-
lights: true,
|
|
332
|
-
sound: 'default',
|
|
333
|
-
})
|
|
334
|
-
).then(
|
|
335
|
-
channelId => {
|
|
336
|
-
const refreshTokenExpiresAtMillisecond = refreshTokenAt * 1000;
|
|
337
|
-
const refreshTokenExpiresAtDateTime = DateTime.fromMillis(refreshTokenExpiresAtMillisecond, { locale: language });
|
|
338
|
-
const refreshTokenExpiresAtDateLocaleString = refreshTokenExpiresAtDateTime.toLocaleString(DateTime.DATE_SHORT);
|
|
339
|
-
const refreshTokenExpiresAtTimeLocaleString = refreshTokenExpiresAtDateTime.toLocaleString(DateTime.TIME_SIMPLE);
|
|
340
|
-
return notifee.createTriggerNotification(
|
|
341
|
-
{
|
|
342
|
-
id: RefreshTokenReqiredNotificationId,
|
|
343
|
-
title: t(
|
|
344
|
-
'authentication:tokenInvalidNotification',
|
|
345
|
-
{
|
|
346
|
-
refreshTokenExpiresAtDate: refreshTokenExpiresAtDateLocaleString,
|
|
347
|
-
refreshTokenExpiresAtTime: refreshTokenExpiresAtTimeLocaleString
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
),
|
|
351
|
-
android: {
|
|
352
|
-
channelId: channelId,
|
|
353
|
-
showChronometer: true,
|
|
354
|
-
chronometerDirection: 'down',
|
|
355
|
-
timestamp: refreshTokenExpiresAt * 1000,
|
|
356
|
-
smallIcon: RefreshTokenReqiredNotificationIcon,
|
|
357
|
-
},
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
type: TriggerType.TIMESTAMP,
|
|
361
|
-
timestamp: refreshTokenExpiresAtMillisecond,
|
|
362
|
-
}
|
|
363
|
-
);
|
|
364
|
-
}
|
|
365
|
-
)
|
|
366
|
-
} else {
|
|
367
|
-
notifee.cancelDisplayedNotification(RefreshTokenReqiredNotificationId);
|
|
368
|
-
notifee.cancelTriggerNotification(RefreshTokenReqiredNotificationId);
|
|
369
|
-
}
|
|
370
|
-
},
|
|
371
|
-
[refreshToken && refreshTokenAt, language, t]
|
|
372
|
-
)
|
|
373
|
-
|
|
374
320
|
function login() {
|
|
375
321
|
return promptAsync()
|
|
376
322
|
.then(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olea-bps/base",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "OLEA base library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"@react-native-firebase/messaging": "^22.2.0",
|
|
36
36
|
"@react-navigation/drawer": "^7.3.12",
|
|
37
37
|
"@react-navigation/native": "^7.1.9",
|
|
38
|
-
"expo-application": "~7.0.
|
|
39
|
-
"expo-auth-session": "~7.0.
|
|
40
|
-
"expo-crypto": "~15.0.
|
|
38
|
+
"expo-application": "~7.0.8",
|
|
39
|
+
"expo-auth-session": "~7.0.11",
|
|
40
|
+
"expo-crypto": "~15.0.9",
|
|
41
41
|
"expo-linear-gradient": "~15.0.7",
|
|
42
42
|
"expo-web-browser": "~15.0.10",
|
|
43
43
|
"jwt-decode": "4.0.0",
|
|
@@ -13,12 +13,21 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { useState, useEffect, useMemo, useCallback } from 'react';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
AppState,
|
|
18
|
+
SafeAreaView,
|
|
19
|
+
View,
|
|
20
|
+
ScrollView,
|
|
21
|
+
StyleSheet,
|
|
22
|
+
Alert,
|
|
23
|
+
useWindowDimensions,
|
|
24
|
+
RefreshControl,
|
|
25
|
+
Image,
|
|
26
|
+
} from 'react-native';
|
|
17
27
|
|
|
18
28
|
import { useTheme, Text, Button } from 'react-native-paper';
|
|
19
29
|
import { useFocusEffect } from '@react-navigation/native';
|
|
20
30
|
import { useTranslation } from 'react-i18next';
|
|
21
|
-
import QRCode from 'react-native-qrcode-svg';
|
|
22
31
|
|
|
23
32
|
import AppbarComponent from '../../components/AppBar';
|
|
24
33
|
import { useUser } from '../../context/context-user';
|
|
@@ -114,9 +123,8 @@ export default function PublicTransportTicketView() {
|
|
|
114
123
|
ticketBarcode
|
|
115
124
|
? <>
|
|
116
125
|
<View>
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
size={width * 0.8}
|
|
126
|
+
<Image
|
|
127
|
+
source={{ uri: ticketBarcode }}
|
|
120
128
|
/>
|
|
121
129
|
</View>
|
|
122
130
|
<Text>
|