@olea-bps/base 1.0.5 → 1.1.1

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,15 +1,4 @@
1
- // Helper function to add alpha to a color
2
- const addAlpha = (hexColor, alpha) => {
3
- // Remove # if present
4
- const hex = hexColor.replace('#', '');
5
-
6
- // Parse RGB values
7
- const r = parseInt(hex.substring(0, 2), 16);
8
- const g = parseInt(hex.substring(2, 4), 16);
9
- const b = parseInt(hex.substring(4, 6), 16);
10
-
11
- return `rgba(${r}, ${g}, ${b}, ${alpha})`;
12
- };
1
+ import { addAlpha } from '../../libraries/core/helper/color';
13
2
 
14
3
  export default function(theme) {
15
4
  return {
@@ -20,7 +20,7 @@ import {
20
20
  Image
21
21
  } from 'react-native';
22
22
  import { connect } from 'react-redux'
23
- import { Button, Dialog, Portal, useTheme } from 'react-native-paper';
23
+ import { Button, Dialog, IconButton, Portal, useTheme } from 'react-native-paper';
24
24
  import { useTranslation } from 'react-i18next';
25
25
 
26
26
  import { useFilteredMenu } from '../../context/context-canteen';
@@ -29,6 +29,7 @@ import { onUpdateRefreshing } from '../../libraries/core';
29
29
  import IconsOpenasist from '../../libraries/icons-openasist';
30
30
 
31
31
  import componentStyles from './styles';
32
+ import { addAlpha } from '../../libraries/core/helper/color';
32
33
 
33
34
  /**
34
35
  * Mensa Menu Component
@@ -199,19 +200,21 @@ function Meal({ settings, meal, priceGroupCode, priceGroupName }) {
199
200
  {
200
201
  meal?.additives || meal?.allergens
201
202
  ? <>
202
- <Button
203
+ <IconButton
203
204
  style={styles.btnAddionals}
204
- color={colors.buttonText}
205
- labelStyle={styles.buttonLabel}
205
+ iconColor={colors.secondaryText}
206
+ rippleColor={addAlpha(colors.primary, 0.12)}
207
+ size={15}
206
208
  accessibilityLabel={t('canteen:allergeneTitle')}
207
209
  onPress={() => setAdditionalDialogVisible(true)}
208
- >
209
- <IconsOpenasist
210
- icon={"info"}
211
- color={colors.secondaryText}
212
- size={15}
213
- />
214
- </Button>
210
+ icon={({ size, color }) => (
211
+ <IconsOpenasist
212
+ icon={"info"}
213
+ color={color}
214
+ size={size}
215
+ />
216
+ )}
217
+ />
215
218
  <AdditionalDialog
216
219
  allergens={meal?.allergens}
217
220
  additives={meal?.additives}
@@ -46,7 +46,7 @@ function CallManagerContextProvider({ children }) {
46
46
  switch (callManagerApiProvider?.toLowerCase()) {
47
47
  case TucCallManagerProviderName:
48
48
  console.debug(componentName, ':', 'use tu chemnitz call manager');
49
- return new TucCallManager.from(callManagerApiBaseUrl, 'de', accessToken);
49
+ return TucCallManager.from(callManagerApiBaseUrl, 'de', accessToken);
50
50
  default:
51
51
  console.log(`${componentName}: Can't build api provider: ${callManagerApiProvider}`)
52
52
  return null;
@@ -386,10 +386,10 @@ function CanteenContextProvider({ children, settings, rootUrl, rootStgUrl, useSt
386
386
  switch (canteenApiProvider?.toLowerCase()) {
387
387
  case AsistServerProviderName:
388
388
  console.debug(componentName, ': use asist server api');
389
- return new AsistServerApiProvider.from(canteenApiBaseUrl, canteenApiUniversity, language);
389
+ return AsistServerApiProvider.from(canteenApiBaseUrl, canteenApiUniversity, language);
390
390
  case CollectorVersion2ProviderName:
391
391
  console.debug(componentName, ': use collector v2 api');
392
- return new CollektorVersion2ApiProvider.from(canteenApiBaseUrl, language);
392
+ return CollektorVersion2ApiProvider.from(canteenApiBaseUrl, language);
393
393
  default:
394
394
  console.log(`${componentName}: Can't build api provider: ${canteenApiProvider}`)
395
395
  return null;
@@ -61,7 +61,7 @@ function FlexMenuContextProvider({ children }) {
61
61
  // return new AsistServerApiProvider.from(timetableApiBaseUrl, timetableApiUniversity, 'de');
62
62
  // break;
63
63
  case CollectorVersion2ProviderName:
64
- return new CollectorVersion2ApiProvider.from(flexMenuApiBaseUrl);
64
+ return CollectorVersion2ApiProvider.from(flexMenuApiBaseUrl);
65
65
  break;
66
66
  default:
67
67
  console.log(`${componentName}: Can't build api provider: ${flexMenuApiProvider}`)
@@ -72,7 +72,7 @@ function NewsContextProvider({ children }) {
72
72
  switch (newsApiProvider?.toLowerCase()) {
73
73
  case CollectorVersion2ProviderName:
74
74
  console.debug(componentName, ': use collector v2 api');
75
- return new CollektorVersion2ApiProvider.from(newsApiBaseUrl, language);
75
+ return CollektorVersion2ApiProvider.from(newsApiBaseUrl, language);
76
76
  default:
77
77
  console.log(`${componentName}: Can't build api provider: ${newsApiProvider}`)
78
78
  return null;
@@ -8,7 +8,7 @@ export const GETOptions = {
8
8
  "Accept-Language" : "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7",
9
9
  "Cache-Control" : "no-cache",
10
10
  'Pragma': 'no-cache',
11
- 'Expires': 0,
11
+ 'Expires': '0',
12
12
  }
13
13
  };
14
14
  export const GETOptionsByLanguage = (languageCode = null) => {
@@ -28,7 +28,7 @@ export const GETOptionsByLanguage = (languageCode = null) => {
28
28
  "Accept-Language": acceptLanguage,
29
29
  "Cache-Control": "no-cache",
30
30
  'Pragma': 'no-cache',
31
- 'Expires': 0,
31
+ 'Expires': '0',
32
32
  }
33
33
  }
34
34
  };
@@ -0,0 +1,8 @@
1
+ // Add an alpha channel to a hex color, returning an rgba() string.
2
+ export const addAlpha = (hexColor, alpha) => {
3
+ const hex = hexColor.replace('#', '');
4
+ const r = parseInt(hex.substring(0, 2), 16);
5
+ const g = parseInt(hex.substring(2, 4), 16);
6
+ const b = parseInt(hex.substring(4, 6), 16);
7
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
8
+ };
@@ -13,7 +13,13 @@
13
13
  */
14
14
 
15
15
  import React from 'react';
16
- import messaging from '@react-native-firebase/messaging';
16
+ import {
17
+ getMessaging,
18
+ setBackgroundMessageHandler,
19
+ onMessage,
20
+ unregisterDeviceForRemoteMessages,
21
+ AuthorizationStatus,
22
+ } from '@react-native-firebase/messaging';
17
23
 
18
24
  import notifee, { AndroidStyle, EventType } from '@notifee/react-native';
19
25
  import { feedApi, RootNavigation, store, updateFeeds } from '../core';
@@ -44,7 +50,7 @@ export default class OpenASiSTNotifications {
44
50
  * Important: This function must be called as soon as possible! (Before app initialization)
45
51
  */
46
52
  initBackgroundHandler() {
47
- messaging().setBackgroundMessageHandler(async remoteMessage => {
53
+ setBackgroundMessageHandler(getMessaging(), async remoteMessage => {
48
54
  await this.createNotification(remoteMessage);
49
55
  });
50
56
 
@@ -61,7 +67,7 @@ export default class OpenASiSTNotifications {
61
67
  await this.subscriberService.initializeSubscriber();
62
68
 
63
69
  // Listen for new Messages while the app is in foreground
64
- messaging().onMessage(async remoteMessage => {
70
+ onMessage(getMessaging(), async remoteMessage => {
65
71
  await this.createNotification(remoteMessage);
66
72
  });
67
73
 
@@ -73,7 +79,7 @@ export default class OpenASiSTNotifications {
73
79
 
74
80
  unregister() {
75
81
  // Unregister the user device from firebase
76
- messaging().unregisterDeviceForRemoteMessages().then(() => {/* Unregistered */});
82
+ unregisterDeviceForRemoteMessages(getMessaging()).then(() => {/* Unregistered */});
77
83
  notifee.cancelAllNotifications().then(() => {/* Cancelled all notifications */});
78
84
  }
79
85
 
@@ -128,8 +134,8 @@ export default class OpenASiSTNotifications {
128
134
  });
129
135
 
130
136
  const enabled =
131
- authStatus === messaging.AuthorizationStatus.AUTHORIZED ||
132
- authStatus === messaging.AuthorizationStatus.PROVISIONAL;
137
+ authStatus === AuthorizationStatus.AUTHORIZED ||
138
+ authStatus === AuthorizationStatus.PROVISIONAL;
133
139
 
134
140
  await notifee.requestPermission({
135
141
  criticalAlert: true
@@ -1,5 +1,11 @@
1
1
  import uuid from 'react-native-uuid';
2
- import messaging from '@react-native-firebase/messaging';
2
+ import {
3
+ getMessaging,
4
+ isDeviceRegisteredForRemoteMessages,
5
+ registerDeviceForRemoteMessages,
6
+ getToken,
7
+ onTokenRefresh,
8
+ } from '@react-native-firebase/messaging';
3
9
  import debounce from 'lodash/debounce';
4
10
 
5
11
  import { store } from '../../core';
@@ -32,8 +38,9 @@ export default class SubscriberService {
32
38
  */
33
39
  async initializeSubscriber() {
34
40
  this.subscriberId = this.getSubscriberId();
35
- if(!messaging().isDeviceRegisteredForRemoteMessages) {
36
- await messaging().registerDeviceForRemoteMessages();
41
+ const messaging = getMessaging();
42
+ if(!isDeviceRegisteredForRemoteMessages(messaging)) {
43
+ await registerDeviceForRemoteMessages(messaging);
37
44
  }
38
45
  const token = await this.getFCMToken();
39
46
 
@@ -66,7 +73,7 @@ export default class SubscriberService {
66
73
  * @returns {Promise<void>}
67
74
  */
68
75
  async getFCMToken() {
69
- return await messaging().getToken();
76
+ return await getToken(getMessaging());
70
77
  }
71
78
 
72
79
 
@@ -92,7 +99,7 @@ export default class SubscriberService {
92
99
 
93
100
  // Listen for Token updates
94
101
  if(!skipRefresh) {
95
- messaging().onTokenRefresh(newToken => {
102
+ onTokenRefresh(getMessaging(), newToken => {
96
103
  this.upsertSubscriber(newToken, true);
97
104
  });
98
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olea-bps/base",
3
- "version": "1.0.5",
3
+ "version": "1.1.1",
4
4
  "description": "OLEA base library",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -30,34 +30,34 @@
30
30
  "@notifee/react-native": "^9.1.8",
31
31
  "@novu/client": "^2.6.6",
32
32
  "@react-native-async-storage/async-storage": "~2.2.0",
33
- "@react-native-community/netinfo": "^11.4.1",
34
- "@react-native-firebase/app": "^22.2.0",
35
- "@react-native-firebase/messaging": "^22.2.0",
33
+ "@react-native-community/netinfo": "12.0.1",
34
+ "@react-native-firebase/app": "^24.0.0",
35
+ "@react-native-firebase/messaging": "^24.0.0",
36
36
  "@react-navigation/drawer": "^7.3.12",
37
37
  "@react-navigation/native": "^7.1.9",
38
- "expo-application": "~7.0.8",
39
- "expo-auth-session": "~7.0.11",
40
- "expo-crypto": "~15.0.9",
41
- "expo-linear-gradient": "~15.0.7",
42
- "expo-web-browser": "~15.0.10",
38
+ "expo-application": "~56.0.3",
39
+ "expo-auth-session": "~56.0.12",
40
+ "expo-crypto": "~56.0.4",
41
+ "expo-linear-gradient": "~56.0.4",
42
+ "expo-web-browser": "~56.0.5",
43
43
  "jwt-decode": "4.0.0",
44
44
  "moment": "^2.29.4",
45
45
  "react-native-elements": "^3.4.3",
46
46
  "react-native-modalbox": "^2.0.2",
47
- "react-native-paper": "^5.14.5",
47
+ "react-native-paper": "^5.15.2",
48
48
  "react-native-svg": "15.15.4",
49
49
  "react-native-swipe-gestures": "^1.0.5",
50
50
  "react-native-tab-view": "^4.1.3",
51
51
  "react-native-uuid": "^2.0.3",
52
52
  "react-native-vector-icons": "^10.2.0",
53
- "react-native-webview": "13.16.0",
53
+ "react-native-webview": "13.16.1",
54
54
  "react-redux": "^9.2.0",
55
55
  "redux": "^4.0.5",
56
56
  "redux-persist": "^6.0.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "react": "^19.0.0",
60
- "react-native": "^0.81.0",
60
+ "react-native": "^0.85.0",
61
61
  "react-native-paper": "^5.0.0",
62
62
  "react-redux": "^9.2.0",
63
63
  "redux": "^4.0.5"