@olea-bps/base 1.1.7 → 1.1.9

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.
@@ -31,33 +31,33 @@
31
31
  "src/**/*"
32
32
  ],
33
33
  "dependencies": {
34
- "@babel/runtime": "^7.27.1",
34
+ "@babel/runtime": "^7.29.7",
35
35
  "redux-persist": "^6.0.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@babel/cli": "^7.27.2",
39
- "@babel/core": "^7.27.1",
38
+ "@babel/cli": "^7.29.7",
39
+ "@babel/core": "^7.29.7",
40
40
  "@babel/plugin-proposal-class-properties": "^7.18.6",
41
41
  "@babel/plugin-syntax-object-rest-spread": "^7.8.3",
42
- "@babel/plugin-transform-flow-strip-types": "^7.27.1",
43
- "@babel/plugin-transform-runtime": "^7.27.1",
44
- "@babel/preset-env": "^7.27.2",
42
+ "@babel/plugin-transform-flow-strip-types": "^7.29.7",
43
+ "@babel/plugin-transform-runtime": "^7.29.7",
44
+ "@babel/preset-env": "^7.29.7",
45
45
  "babel-core": "^7.0.0-bridge.0",
46
46
  "babel-eslint": "^10.1.0",
47
47
  "babel-jest": "^29.7.0",
48
- "eslint": "^8.2.0",
48
+ "eslint": "^8.57.1",
49
49
  "eslint-config-airbnb-base": "^15.0.0",
50
- "eslint-config-prettier": "^10.1.5",
50
+ "eslint-config-prettier": "^10.1.8",
51
51
  "eslint-plugin-babel": "^5.3.1",
52
52
  "eslint-plugin-flowtype": "^8.0.3",
53
- "eslint-plugin-import": "^2.31.0",
54
- "eslint-plugin-prettier": "^5.4.0",
55
- "flow-bin": "^0.272.1",
53
+ "eslint-plugin-import": "^2.32.0",
54
+ "eslint-plugin-prettier": "^5.5.6",
55
+ "flow-bin": "^0.334.0",
56
56
  "husky": "^9.1.7",
57
57
  "jest": "^29.7.0",
58
- "lint-staged": "^16.0.0",
59
- "prettier": "^3.5.3",
60
- "redux": "^4.0.5",
58
+ "lint-staged": "^16.4.0",
59
+ "prettier": "^3.9.9",
60
+ "redux": "^4.2.1",
61
61
  "redux-devtools-instrument": "^1.10.0",
62
62
  "redux-logger": "^3.0.6",
63
63
  "redux-persist-node-storage": "^2.0.0",
@@ -12,10 +12,22 @@
12
12
  * limitations under the License.
13
13
  */
14
14
 
15
- import { useState, useReducer, useEffect, useCallback } from 'react';
15
+ import { useState, useReducer, useEffect, useCallback } from 'react'
16
16
 
17
- import AsyncStorage from '@react-native-async-storage/async-storage';
18
- import * as SecureStore from 'expo-secure-store';
17
+ import AsyncStorage from '@react-native-async-storage/async-storage'
18
+ import * as SecureStore from 'expo-secure-store'
19
+
20
+ export const secureStoreOptions = { keychainAccessible: SecureStore.AFTER_FIRST_UNLOCK }
21
+
22
+ // Keychain ist bei gesperrtem Gerät nicht lesbar (Start im Hintergrund per Push).
23
+ export function getSecureItem (key) {
24
+ try {
25
+ return SecureStore.getItem(key)
26
+ } catch (error) {
27
+ console.warn('getSecureItem: can`t read secure state', key, ':', error)
28
+ return null
29
+ }
30
+ }
19
31
 
20
32
  /**
21
33
  * Erstellt einen State, der über async-storage persistiert wird und eine Update- bzw. Reset-Funktion.
@@ -26,35 +38,34 @@ import * as SecureStore from 'expo-secure-store';
26
38
  * @param {any | (() => any)} initialState Initialer Wert des States
27
39
  * @return {[]} Array, welches den Wert des States, eine Update-Funktion und eine Reset-Funktion beinhaltet
28
40
  */
29
- export function asyncStoredState(key, initialState) {
30
- const [value, setValue] = useState(initialState);
31
-
32
- const clearValue = useCallback(
33
- () => {
34
- AsyncStorage.removeItem(key)
35
- .then(() => setValue(initialState))
36
-
37
- },
38
- [setValue, AsyncStorage.removeItem]
39
- )
40
-
41
- useEffect(
42
- () => {
43
- AsyncStorage.getItem(key)
44
- .then(JSON.parse)
45
- .then(setValue);
46
- },
47
- []
48
- )
49
-
50
- useEffect(
51
- () => {
52
- AsyncStorage.setItem(key, JSON.stringify(value));
53
- },
54
- [value]
55
- )
56
-
57
- return [value, setValue, clearValue];
41
+ export function asyncStoredState (key, initialState) {
42
+ const [value, setValue] = useState(initialState)
43
+
44
+ const clearValue = useCallback(
45
+ () => {
46
+ AsyncStorage.removeItem(key)
47
+ .then(() => setValue(initialState))
48
+ },
49
+ [setValue, AsyncStorage.removeItem]
50
+ )
51
+
52
+ useEffect(
53
+ () => {
54
+ AsyncStorage.getItem(key)
55
+ .then(JSON.parse)
56
+ .then(setValue)
57
+ },
58
+ []
59
+ )
60
+
61
+ useEffect(
62
+ () => {
63
+ AsyncStorage.setItem(key, JSON.stringify(value))
64
+ },
65
+ [value]
66
+ )
67
+
68
+ return [value, setValue, clearValue]
58
69
  }
59
70
 
60
71
  /**
@@ -67,45 +78,45 @@ export function asyncStoredState(key, initialState) {
67
78
  * @param {boolean} [sensitiv=true] Ist der gespeicherte Wert nicht in den Logs auszugeben?
68
79
  * @returns {[state, (newState) => void], () => void}
69
80
  */
70
- export function useSecureStoredState(key, initialState = null, sensitiv = false) {
71
- const hookName = useSecureStoredState.name;
72
-
73
- const [state, setState] = useState(
74
- () => {
75
- const stringValue = SecureStore.getItem(key);
76
- if (stringValue) {
77
- return JSON.parse(stringValue);
78
- } else {
79
- return undefined;
80
- }
81
- }
82
- );
83
-
84
- const setSecureStoredState = useCallback(
85
- value => {
86
- SecureStore
87
- .setItemAsync(key, JSON.stringify(value))
88
- .then(() => setState(value))
89
- .catch(reason => console.error(hookName, ': can`t store secure state: ', reason, 'key:', key, 'value:', sensitiv ? '***sensitiv value***' : value));
90
- },
91
- [key, setState, SecureStore]
92
- )
93
-
94
- function deleteSecureStoredState() {
95
- SecureStore
96
- .deleteItemAsync(key)
97
- .then(() => setState(undefined))
98
- .then(() => console.debug(hookName, ':', 'remove secure state', key))
99
- .catch((reason) => console.debug(hookName, ':', 'can`t remove secure state', key, ':', reason));
81
+ export function useSecureStoredState (key, initialState = null, sensitiv = false) {
82
+ const hookName = useSecureStoredState.name
83
+
84
+ const [state, setState] = useState(
85
+ () => {
86
+ const stringValue = getSecureItem(key)
87
+ if (stringValue) {
88
+ return JSON.parse(stringValue)
89
+ } else {
90
+ return undefined
91
+ }
100
92
  }
101
-
102
- return [
103
- state !== undefined
104
- ? state
105
- : initialState,
106
- setSecureStoredState,
107
- deleteSecureStoredState,
108
- ];
93
+ )
94
+
95
+ const setSecureStoredState = useCallback(
96
+ value => {
97
+ SecureStore
98
+ .setItemAsync(key, JSON.stringify(value), secureStoreOptions)
99
+ .then(() => setState(value))
100
+ .catch(reason => console.error(hookName, ': can`t store secure state: ', reason, 'key:', key, 'value:', sensitiv ? '***sensitiv value***' : value))
101
+ },
102
+ [key, setState, SecureStore]
103
+ )
104
+
105
+ function deleteSecureStoredState () {
106
+ SecureStore
107
+ .deleteItemAsync(key)
108
+ .then(() => setState(undefined))
109
+ .then(() => console.debug(hookName, ':', 'remove secure state', key))
110
+ .catch((reason) => console.debug(hookName, ':', 'can`t remove secure state', key, ':', reason))
111
+ }
112
+
113
+ return [
114
+ state !== undefined
115
+ ? state
116
+ : initialState,
117
+ setSecureStoredState,
118
+ deleteSecureStoredState
119
+ ]
109
120
  }
110
121
 
111
122
  /**
@@ -119,37 +130,37 @@ export function useSecureStoredState(key, initialState = null, sensitiv = false)
119
130
  * @param {boolean} [sensitiv=true] Ist der gespeicherte Wert nicht in den Logs auszugeben?
120
131
  * @returns {[state, (newState) => void]}
121
132
  */
122
- export function useSecureStoredReducer(key, reducer, initialState = null, sensitiv = false) {
123
- const hookName = useSecureStoredReducer.name;
124
-
125
- const [state, dispatch] = useReducer(
126
- reducer,
127
- undefined,
128
- () => {
129
- const stringValue = SecureStore.getItem(key);
130
- if (stringValue) {
131
- return JSON.parse(stringValue);
132
- } else {
133
- return undefined;
134
- }
135
- },
136
- );
137
-
138
- useEffect(
139
- () => {
140
- if (state !== undefined) {
141
- SecureStore
142
- .setItemAsync(key, JSON.stringify(state))
143
- .catch(reason => console.error(hookName, ': can`t store secure state: ', reason, 'key:', key, 'value:', sensitiv ? '***sensitiv value***' : state));
144
- }
145
- },
146
- [state]
147
- )
148
-
149
- return [
150
- state !== undefined
151
- ? state
152
- : initialState,
153
- dispatch,
154
- ];
133
+ export function useSecureStoredReducer (key, reducer, initialState = null, sensitiv = false) {
134
+ const hookName = useSecureStoredReducer.name
135
+
136
+ const [state, dispatch] = useReducer(
137
+ reducer,
138
+ undefined,
139
+ () => {
140
+ const stringValue = getSecureItem(key)
141
+ if (stringValue) {
142
+ return JSON.parse(stringValue)
143
+ } else {
144
+ return undefined
145
+ }
146
+ }
147
+ )
148
+
149
+ useEffect(
150
+ () => {
151
+ if (state !== undefined) {
152
+ SecureStore
153
+ .setItemAsync(key, JSON.stringify(state), secureStoreOptions)
154
+ .catch(reason => console.error(hookName, ': can`t store secure state: ', reason, 'key:', key, 'value:', sensitiv ? '***sensitiv value***' : state))
155
+ }
156
+ },
157
+ [state]
158
+ )
159
+
160
+ return [
161
+ state !== undefined
162
+ ? state
163
+ : initialState,
164
+ dispatch
165
+ ]
155
166
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olea-bps/base",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "OLEA base library",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -31,29 +31,29 @@
31
31
  "@novu/client": "^2.6.6",
32
32
  "@react-native-async-storage/async-storage": "~2.2.0",
33
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
- "@react-navigation/drawer": "^7.3.12",
37
- "@react-navigation/native": "^7.1.9",
34
+ "@react-native-firebase/app": "^24.1.1",
35
+ "@react-native-firebase/messaging": "^24.1.1",
36
+ "@react-navigation/drawer": "^7.14.3",
37
+ "@react-navigation/native": "^7.5.0",
38
38
  "expo-application": "~56.0.3",
39
- "expo-auth-session": "~56.0.12",
40
- "expo-crypto": "~56.0.4",
39
+ "expo-auth-session": "~56.0.19",
40
+ "expo-crypto": "~56.0.5",
41
41
  "expo-linear-gradient": "~56.0.4",
42
- "expo-web-browser": "~56.0.5",
42
+ "expo-web-browser": "~56.0.6",
43
43
  "jwt-decode": "4.0.0",
44
- "moment": "^2.29.4",
44
+ "moment": "^2.31.0",
45
45
  "react-native-elements": "^3.4.3",
46
- "react-native-enriched-markdown": "^0.6.0",
46
+ "react-native-enriched-markdown": "^0.7.4",
47
47
  "react-native-modalbox": "^2.0.2",
48
- "react-native-paper": "^5.15.2",
48
+ "react-native-paper": "^5.15.3",
49
49
  "react-native-svg": "15.15.4",
50
50
  "react-native-swipe-gestures": "^1.0.5",
51
- "react-native-tab-view": "^4.1.3",
52
- "react-native-uuid": "^2.0.3",
53
- "react-native-vector-icons": "^10.2.0",
51
+ "react-native-tab-view": "^4.3.3",
52
+ "react-native-uuid": "^2.0.4",
53
+ "react-native-vector-icons": "^10.3.0",
54
54
  "react-native-webview": "13.16.1",
55
- "react-redux": "^9.2.0",
56
- "redux": "^4.0.5",
55
+ "react-redux": "^9.3.0",
56
+ "redux": "^4.2.1",
57
57
  "redux-persist": "^6.0.0"
58
58
  },
59
59
  "peerDependencies": {
@@ -64,6 +64,6 @@
64
64
  "redux": "^4.0.5"
65
65
  },
66
66
  "devDependencies": {
67
- "@expo/vector-icons": "^15.0.3"
67
+ "@expo/vector-icons": "^15.1.1"
68
68
  }
69
69
  }
@@ -123,9 +123,7 @@ function SearchView(props) {
123
123
  onSubmitEditing={() => _onPressButton()}
124
124
  onIconPress={() => _onPressButton()}
125
125
  onChangeText={setSearchString}
126
- icon={(props) =>
127
- <IconsOpenasist icon={"search"} size={32} color={colors.icon} />
128
- }
126
+ icon={props => <IconsOpenasist {...props} icon={'search'} color={colors.icon} />}
129
127
  style={styles.searchBar}
130
128
  inputStyle={styles.searchBarInput}
131
129
  value={searchString}