Skip to content

Commit

Permalink
fix(storage): improve error handling and support ArrayBuffer in setItem
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert27 committed Jan 6, 2025
1 parent 5279427 commit 26e2560
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 53 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 274
versionName "0.11.1"
versionName "0.11.2"
}
signingConfigs {
debug {
Expand Down
2 changes: 1 addition & 1 deletion app.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"slug": "neuland-app-native",
"scheme": "neuland",
"owner": "neuland-ingolstadt",
"version": "0.11.1",
"version": "0.11.2",
"githubUrl": "https://github.com/neuland-ingolstadt/neuland.app-native/",
"userInterfaceStyle": "automatic",
"newArchEnabled": false,
Expand Down
Binary file modified bun.lockb
Binary file not shown.
10 changes: 8 additions & 2 deletions ios/NeulandNext.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,10 @@
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\"";
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(inherited) ";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
Expand Down Expand Up @@ -603,7 +606,10 @@
);
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\"";
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "$(inherited) ";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down
2 changes: 1 addition & 1 deletion ios/NeulandNext/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>0.11.1</string>
<string>0.11.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleIcons</key>
Expand Down
42 changes: 21 additions & 21 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PODS:
- DGSwiftUtilities (~> 0.11)
- ContextMenuAuxiliaryPreview (0.5.2):
- DGSwiftUtilities (~> 0.29)
- DGSwiftUtilities (0.44.0)
- DGSwiftUtilities (0.46.3)
- DoubleConversion (1.1.6)
- EXApplication (6.0.1):
- ExpoModulesCore
Expand All @@ -21,7 +21,7 @@ PODS:
- ExpoModulesCore
- Expo (52.0.23):
- ExpoModulesCore
- expo-dev-client (5.0.7):
- expo-dev-client (5.0.8):
- EXManifests
- expo-dev-launcher
- expo-dev-menu
Expand Down Expand Up @@ -113,10 +113,10 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- expo-dev-menu (6.0.14):
- expo-dev-menu (6.0.15):
- DoubleConversion
- expo-dev-menu/Main (= 6.0.14)
- expo-dev-menu/ReactNativeCompatibles (= 6.0.14)
- expo-dev-menu/Main (= 6.0.15)
- expo-dev-menu/ReactNativeCompatibles (= 6.0.15)
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
Expand All @@ -137,7 +137,7 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- expo-dev-menu-interface (1.9.2)
- expo-dev-menu/Main (6.0.14):
- expo-dev-menu/Main (6.0.15):
- DoubleConversion
- EXManifests
- expo-dev-menu-interface
Expand All @@ -164,7 +164,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- expo-dev-menu/ReactNativeCompatibles (6.0.14):
- expo-dev-menu/ReactNativeCompatibles (6.0.15):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -185,7 +185,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- expo-dev-menu/SafeAreaView (6.0.14):
- expo-dev-menu/SafeAreaView (6.0.15):
- DoubleConversion
- ExpoModulesCore
- glog
Expand All @@ -207,7 +207,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- expo-dev-menu/Vendored (6.0.14):
- expo-dev-menu/Vendored (6.0.15):
- DoubleConversion
- expo-dev-menu/SafeAreaView
- glog
Expand All @@ -229,7 +229,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- ExpoAlternateAppIcons (1.2.0):
- ExpoAlternateAppIcons (1.3.0):
- ExpoModulesCore
- ExpoAsset (11.0.1):
- ExpoModulesCore
Expand Down Expand Up @@ -318,11 +318,11 @@ PODS:
- hermes-engine (0.76.5):
- hermes-engine/Pre-built (= 0.76.5)
- hermes-engine/Pre-built (0.76.5)
- maplibre-react-native (10.0.0-beta.15):
- maplibre-react-native/DynamicLibrary (= 10.0.0-beta.15)
- maplibre-react-native (10.0.0-beta.17):
- maplibre-react-native/DynamicLibrary (= 10.0.0-beta.17)
- React
- React-Core
- maplibre-react-native/DynamicLibrary (10.0.0-beta.15):
- maplibre-react-native/DynamicLibrary (10.0.0-beta.17):
- React
- React-Core
- MMKV (2.0.2):
Expand Down Expand Up @@ -1975,9 +1975,9 @@ PODS:
- DGSwiftUtilities
- ExpoModulesCore
- ReactNativeIosUtilities
- ReactNativeIosUtilities (4.5.1):
- ReactNativeIosUtilities (4.5.3):
- ComputableLayout (~> 0.7)
- DGSwiftUtilities (~> 0.27)
- DGSwiftUtilities (~> 0.46.3)
- ExpoModulesCore
- rn-quick-actions (0.0.3):
- React
Expand Down Expand Up @@ -2537,18 +2537,18 @@ SPEC CHECKSUMS:
Burnt: dde5dd245f124a4594098e3938ba71aae4ec83c3
ComputableLayout: c50faffac4ed9f8f05b0ce5e6f3a60df1f6042c8
ContextMenuAuxiliaryPreview: 20be0be795b783b68f8792732eed4bed9f202c1c
DGSwiftUtilities: e100e66cb66a1a238ea69025073a4b809229b573
DGSwiftUtilities: 2f0d35d5ff3d57bd70ccc42f15971460db202c41
DoubleConversion: f16ae600a246532c4020132d54af21d0ddb2a385
EXApplication: e1ad9c950c98b2b134578092c948b10b403f3ea7
EXConstants: dd2fe64c6cdb1383b694c309a63028a8e9f2be6d
EXJSONUtils: 01fc7492b66c234e395dcffdd5f53439c5c29c93
EXManifests: f30a0c5d3d6cad8db9c01bab579e0aa0df5d3cb2
Expo: 37cea4167605a3a1b88fa0caf8349ae76c0d389c
expo-dev-client: 4cc2c40efd66b42fc6f3d14a52435c2de431e9bd
expo-dev-client: ec22c0535228bbf784a4fa7c40f90d3944d7724e
expo-dev-launcher: 47c6da6d00c48be318e77134335b4619a810fb40
expo-dev-menu: 297e955ed2220736e01d70c14cf5fdff8fac6e63
expo-dev-menu: 9e2c8a4c01ed3d51859bd6375a14683f15e2ec30
expo-dev-menu-interface: 4baf2f8b3b79ce37cf4b900e4b3ba6df3384f0a1
ExpoAlternateAppIcons: 9b0c7b9de66b48b9764c8a08aaaf0434adebcc1c
ExpoAlternateAppIcons: 671807310405004cc3e70238c465df88cc4c2f53
ExpoAsset: 8138f2a9ec55ae1ad7c3871448379f7d97692d15
ExpoBlur: 562b3da84d3cd79016c411671eaf71a404266415
ExpoBrightness: ce777f6a365592f745428cb0acc9066b400182e8
Expand All @@ -2573,7 +2573,7 @@ SPEC CHECKSUMS:
fmt: 10c6e61f4be25dc963c36bd73fc7b1705fe975be
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
hermes-engine: 06a9c6900587420b90accc394199527c64259db4
maplibre-react-native: f389778b3797b0d3460557c369c75c89157cd1c9
maplibre-react-native: c0a3e12dc3b53d50713c0f0729fe4ad0ade00174
MMKV: 3eacda84cd1c4fc95cf848d3ecb69d85ed56006c
MMKVCore: 508b4d3a8ce031f1b5c8bd235f0517fb3f4c73a9
RCT-Folly: bf5c0376ffe4dd2cf438dcf86db385df9fdce648
Expand Down Expand Up @@ -2644,7 +2644,7 @@ SPEC CHECKSUMS:
ReactCodegen: 8d7f9f05befdeb108948bbaa18d149b25a964f72
ReactCommon: 858d61cce81635d57be89348568b603e838b3cac
ReactNativeIosContextMenu: 4601cc5113ca45bc7295707bf5c76987caac8bd7
ReactNativeIosUtilities: 4980803356bff7906929d5d034da58bfc9bb824a
ReactNativeIosUtilities: 44fa1cb515396b7a73c22f56695aae19bdb76f09
rn-quick-actions: dbd80c5223df43389c11920e035d09f4b7694176
RNDateTimePicker: 40ffda97d071a98a10fdca4fa97e3977102ccd14
RNDeviceInfo: 3f2e5fcca3637f75c6d30ba287293c2f97206781
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@
"@gorhom/bottom-sheet": "^5.0.6",
"@howljs/calendar-kit": "^2.2.1",
"@kichiyaki/react-native-barcode-generator": "^0.6.7",
"@maplibre/maplibre-react-native": "^10.0.0-beta.15",
"@maplibre/maplibre-react-native": "^10.0.0-beta.17",
"@react-native-community/datetimepicker": "8.2.0",
"@react-native-community/netinfo": "11.4.1",
"@react-native-menu/menu": "^1.2.0",
"@react-navigation/native": "^7.0.14",
"@react-navigation/stack": "^7.1.1",
"@shopify/flash-list": "1.7.2",
"@tanstack/query-sync-storage-persister": "^5.62.9",
"@tanstack/react-query": "^5.62.11",
"@tanstack/react-query-persist-client": "^5.62.11",
"@tanstack/query-sync-storage-persister": "^5.62.16",
"@tanstack/react-query": "^5.62.16",
"@tanstack/react-query-persist-client": "^5.62.16",
"@th3rdwave/react-navigation-bottom-sheet": "0.3.2",
"burnt": "^0.12.2",
"color": "^4.2.3",
"expo": "~52.0.23",
"expo-alternate-app-icons": "^1.2.0",
"expo-alternate-app-icons": "^1.3.0",
"expo-application": "~6.0.1",
"expo-blur": "~14.0.1",
"expo-brightness": "~13.0.2",
Expand All @@ -67,26 +67,26 @@
"expo-system-ui": "~4.0.6",
"fuse.js": "^7.0.0",
"graphql": "^16.10.0",
"i18next": "^24.2.0",
"i18next": "^24.2.1",
"lucide-react-native": "^0.469.0",
"metro": "^0.81.0",
"moment": "^2.30.1",
"moment-timezone": "^0.5.46",
"react": "18.3.1",
"react-content-loader": "^7.0.2",
"react-dom": "18.3.1",
"react-i18next": "^15.3.0",
"react-i18next": "^15.4.0",
"react-native": "0.76.5",
"react-native-bottom-tabs": "0.7.6",
"react-native-collapsible": "1.6.1",
"react-native-context-menu-view": "^1.16.0",
"react-native-device-info": "^14.0.2",
"react-native-drag-drop-ios": "^0.1.1",
"react-native-drag-sort": "^2.4.4",
"react-native-edge-to-edge": "^1.1.3",
"react-native-edge-to-edge": "^1.2.0",
"react-native-gesture-handler": "~2.20.2",
"react-native-ios-context-menu": "^2.5.3",
"react-native-ios-utilities": "^4.5.1",
"react-native-ios-utilities": "^4.5.3",
"react-native-mmkv": "^2.12.2",
"react-native-pager-view": "6.6.1",
"react-native-reanimated": "~3.16.6",
Expand Down Expand Up @@ -125,14 +125,14 @@
"@types/bun": "latest",
"@types/color": "^3.0.6",
"@types/geojson": "^7946.0.15",
"@types/node": "^22.10.2",
"@types/node": "^22.10.5",
"@types/prop-types": "^15.7.14",
"@types/react": "~18.3.18",
"@types/sanitize-html": "^2.13.0",
"@typescript-eslint/eslint-plugin": "^8.18.2",
"@typescript-eslint/parser": "^8.18.2",
"@typescript-eslint/eslint-plugin": "^8.19.1",
"@typescript-eslint/parser": "^8.19.1",
"ajv": "^8.17.1",
"babel-plugin-formatjs": "^10.5.29",
"babel-plugin-formatjs": "^10.5.30",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -146,7 +146,7 @@
"eslint-plugin-react-native": "^4.1.0",
"eslint-plugin-react-native-unistyles": "^0.2.9",
"expo-atlas": "^0.4.0",
"expo-dev-client": "~5.0.7",
"expo-dev-client": "~5.0.8",
"graphql-codegen-typescript-operation-types": "^2.0.1",
"husky": "^9.1.7",
"lint-staged": "^15.3.0",
Expand Down
18 changes: 9 additions & 9 deletions src/data/licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"licenseUrl": "https://github.com/Kichiyaki/react-native-barcode-generator/raw/master/LICENSE",
"parents": "neuland"
},
"@maplibre/[email protected].15": {
"@maplibre/[email protected].17": {
"licenses": "MIT",
"repository": "https://github.com/maplibre/maplibre-react-native",
"licenseUrl": "https://github.com/maplibre/maplibre-react-native/raw/master/LICENSE.md",
Expand Down Expand Up @@ -89,19 +89,19 @@
"licenseUrl": "https://github.com/Shopify/flash-list/raw/master/LICENSE.md",
"parents": "neuland"
},
"@tanstack/[email protected].9": {
"@tanstack/[email protected].16": {
"licenses": "MIT",
"repository": "https://github.com/TanStack/query",
"licenseUrl": "https://github.com/TanStack/query/raw/master/LICENSE",
"parents": "neuland"
},
"@tanstack/[email protected].11": {
"@tanstack/[email protected].16": {
"licenses": "MIT",
"repository": "https://github.com/TanStack/query",
"licenseUrl": "https://github.com/TanStack/query/raw/master/LICENSE",
"parents": "neuland"
},
"@tanstack/[email protected].11": {
"@tanstack/[email protected].16": {
"licenses": "MIT",
"repository": "https://github.com/TanStack/query",
"licenseUrl": "https://github.com/TanStack/query/raw/master/LICENSE",
Expand All @@ -125,7 +125,7 @@
"licenseUrl": "https://github.com/Qix-/color/raw/master/LICENSE",
"parents": "neuland"
},
"expo-alternate-app-icons@1.2.0": {
"expo-alternate-app-icons@1.3.0": {
"licenses": "MIT",
"repository": "https://github.com/pchalupa/expo-alternate-app-icons",
"licenseUrl": "https://github.com/pchalupa/expo-alternate-app-icons/raw/master/LICENSE",
Expand Down Expand Up @@ -251,7 +251,7 @@
"licenseUrl": "https://github.com/graphql/graphql-js/raw/master/LICENSE",
"parents": "neuland"
},
"[email protected].0": {
"[email protected].1": {
"licenses": "MIT",
"repository": "https://github.com/i18next/i18next",
"licenseUrl": "https://github.com/i18next/i18next/raw/master/LICENSE",
Expand Down Expand Up @@ -293,7 +293,7 @@
"licenseUrl": "https://github.com/facebook/react/raw/master/LICENSE",
"parents": "neuland"
},
"react-i18next@15.3.0": {
"react-i18next@15.4.0": {
"licenses": "MIT",
"repository": "https://github.com/i18next/react-i18next",
"licenseUrl": "https://github.com/i18next/react-i18next/raw/master/LICENSE",
Expand Down Expand Up @@ -335,7 +335,7 @@
"licenseUrl": "https://github.com/mochixuan/react-native-drag-sort",
"parents": "neuland"
},
"react-native-edge-to-edge@1.1.3": {
"react-native-edge-to-edge@1.2.0": {
"licenses": "MIT",
"repository": "https://github.com/zoontek/react-native-edge-to-edge",
"licenseUrl": "https://github.com/zoontek/react-native-edge-to-edge/raw/master/LICENSE",
Expand All @@ -353,7 +353,7 @@
"licenseUrl": "https://github.com/dominicstop/react-native-ios-context-menu/raw/master/LICENSE",
"parents": "neuland"
},
"[email protected].1": {
"[email protected].3": {
"licenses": "MIT",
"repository": "https://github.com/dominicstop/react-native-ios-utilities",
"licenseUrl": "https://github.com/dominicstop/react-native-ios-utilities/raw/master/LICENSE",
Expand Down
17 changes: 13 additions & 4 deletions src/utils/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ export async function saveSecure(
}

export function loadSecure(key: string): string | null {
if (Platform.OS === 'web') {
return secureWebStorage.getString(key) ?? null
try {
if (Platform.OS === 'web') {
return secureWebStorage.getString(key) ?? null
}
return SecureStore.getItem(key)
} catch (error) {
console.error(`Failed to load secure item with key ${key}:`, error)
return null
}
return SecureStore.getItem(key)
}

export async function deleteSecure(key: string): Promise<void> {
Expand All @@ -47,7 +52,11 @@ export async function deleteSecure(key: string): Promise<void> {

const clientStorage = {
setItem: (key: string, value: string | number | boolean | ArrayBuffer) => {
storage.set(key, value)
if (value instanceof ArrayBuffer) {
storage.set(key, new Uint8Array(value))
} else {
storage.set(key, value)
}
},
getItem: (key: string) => {
const value = storage.getString(key)
Expand Down

0 comments on commit 26e2560

Please sign in to comment.