From 952e7ff9b8626c854d0c78a19651dcaaa03201de Mon Sep 17 00:00:00 2001 From: biancaisc Date: Fri, 31 Jan 2025 21:07:37 +0200 Subject: [PATCH 1/9] BarCodeScanner but is deprecated --- CollectifyFrontend/app/(tabs)/_layout.tsx | 24 ++ CollectifyFrontend/app/(tabs)/qrCode.tsx | 35 +++ CollectifyFrontend/app/(tabs)/scan.tsx | 90 ++++++ CollectifyFrontend/app/_layout.tsx | 14 + CollectifyFrontend/package-lock.json | 270 ++++++++++++++++++ CollectifyFrontend/package.json | 11 +- .../src/library/IQRCodePayload.ts | 4 + .../src/library/IStackScreenProps.ts | 5 + 8 files changed, 451 insertions(+), 2 deletions(-) create mode 100644 CollectifyFrontend/app/(tabs)/qrCode.tsx create mode 100644 CollectifyFrontend/app/(tabs)/scan.tsx create mode 100644 CollectifyFrontend/src/library/IQRCodePayload.ts create mode 100644 CollectifyFrontend/src/library/IStackScreenProps.ts diff --git a/CollectifyFrontend/app/(tabs)/_layout.tsx b/CollectifyFrontend/app/(tabs)/_layout.tsx index b199503..891f7d2 100644 --- a/CollectifyFrontend/app/(tabs)/_layout.tsx +++ b/CollectifyFrontend/app/(tabs)/_layout.tsx @@ -83,6 +83,30 @@ export default function TabLayout() { ), }} /> + ( + + ), + tabBarIcon: ({ color, focused }) => ( + + ), + }} + /> + ( + + ), + tabBarIcon: ({ color, focused }) => ( + + ), + }} + /> ); } diff --git a/CollectifyFrontend/app/(tabs)/qrCode.tsx b/CollectifyFrontend/app/(tabs)/qrCode.tsx new file mode 100644 index 0000000..62899c8 --- /dev/null +++ b/CollectifyFrontend/app/(tabs)/qrCode.tsx @@ -0,0 +1,35 @@ +import React from 'react'; +import { Button, StyleSheet, View } from 'react-native'; +import { Layout, Text, List, ListItem, ApplicationProvider } from '@ui-kitten/components'; + +import QRCode from 'react-native-qrcode-svg'; +import { IStackScreenProps } from '../../src/library/IStackScreenProps'; +import { IQRCodePayload } from '../../src/library/IQRCodePayload'; + +const QRCodeScreen: React.FunctionComponent = (props) => { + const { navigation } = props; + const payload: IQRCodePayload = { name: 'Cool Person', number: '1-234-567-8900' }; + + return ( + + + + */} + + ); + } + + if (permission) { + return ( + { + try { + console.log(type); + console.log(data); + let _data = JSON.parse(data); + setScanData(_data); + } catch (error) { + console.error('Unable to parse string: ', error); + } + }} + > + Scan the QR code. + + ); + } else { + return Permission rejected.; + } +}; + +export default ScanScreen; + +const styles = StyleSheet.create({ + container: { + flex: 1, + padding: 10, + alignItems: 'center', + justifyContent: 'center' + }, + text: { + marginTop: 15, + backgroundColor: 'white' + }, + textError: { + color: 'red' + } +}); \ No newline at end of file diff --git a/CollectifyFrontend/app/_layout.tsx b/CollectifyFrontend/app/_layout.tsx index 99d8aab..b418ce4 100644 --- a/CollectifyFrontend/app/_layout.tsx +++ b/CollectifyFrontend/app/_layout.tsx @@ -41,6 +41,20 @@ export default function RootLayout() { title: "Notes" }} /> + + + + ); } diff --git a/CollectifyFrontend/package-lock.json b/CollectifyFrontend/package-lock.json index 7ff3db2..dbbbfa6 100644 --- a/CollectifyFrontend/package-lock.json +++ b/CollectifyFrontend/package-lock.json @@ -12,10 +12,13 @@ "@expo/vector-icons": "^14.0.2", "@react-navigation/bottom-tabs": "^7.0.0", "@react-navigation/native": "^7.0.0", + "@react-navigation/stack": "^7.1.1", "@ui-kitten/components": "^5.3.1", "axios": "^1.7.9", "expo": "~52.0.15", + "expo-barcode-scanner": "^13.0.1", "expo-blur": "~14.0.1", + "expo-camera": "~16.0.14", "expo-constants": "~17.0.3", "expo-font": "~13.0.1", "expo-haptics": "~14.0.0", @@ -33,6 +36,7 @@ "react-dom": "18.3.1", "react-native": "0.76.3", "react-native-gesture-handler": "~2.20.2", + "react-native-qrcode-svg": "^6.3.14", "react-native-reanimated": "~3.16.1", "react-native-safe-area-context": "4.12.0", "react-native-screens": "~4.1.0", @@ -4032,6 +4036,23 @@ "nanoid": "3.3.8" } }, + "node_modules/@react-navigation/stack": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@react-navigation/stack/-/stack-7.1.1.tgz", + "integrity": "sha512-CBTKQlIkELp05zRiTAv5Pa7OMuCpKyBXcdB3PGMN2Mm55/5MkDsA1IaZorp/6TsVCdllITD6aTbGX/HA/88A6w==", + "dependencies": { + "@react-navigation/elements": "^2.2.5", + "color": "^4.2.3" + }, + "peerDependencies": { + "@react-navigation/native": "^7.0.14", + "react": ">= 18.2.0", + "react-native": "*", + "react-native-gesture-handler": ">= 2.0.0", + "react-native-safe-area-context": ">= 4.0.0", + "react-native-screens": ">= 4.0.0" + } + }, "node_modules/@remix-run/node": { "version": "2.15.2", "resolved": "https://registry.npmjs.org/@remix-run/node/-/node-2.15.2.tgz", @@ -6259,6 +6280,14 @@ } } }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/decimal.js": { "version": "10.4.3", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", @@ -6447,6 +6476,11 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/dijkstrajs": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz", + "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==" + }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -7051,6 +7085,25 @@ "react-native": "*" } }, + "node_modules/expo-barcode-scanner": { + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/expo-barcode-scanner/-/expo-barcode-scanner-13.0.1.tgz", + "integrity": "sha512-xBGLT1An2gpAMIQRTLU3oHydKohX8r8F9/ait1Fk9Vgd0GraFZbP4IiT7nHMlaw4H6E7Muucf7vXpGV6u7d4HQ==", + "dependencies": { + "expo-image-loader": "~4.7.0" + }, + "peerDependencies": { + "expo": "*" + } + }, + "node_modules/expo-barcode-scanner/node_modules/expo-image-loader": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/expo-image-loader/-/expo-image-loader-4.7.0.tgz", + "integrity": "sha512-cx+MxxsAMGl9AiWnQUzrkJMJH4eNOGlu7XkLGnAXSJrRoIiciGaKqzeaD326IyCTV+Z1fXvIliSgNW+DscvD8g==", + "peerDependencies": { + "expo": "*" + } + }, "node_modules/expo-blur": { "version": "14.0.1", "resolved": "https://registry.npmjs.org/expo-blur/-/expo-blur-14.0.1.tgz", @@ -7062,6 +7115,25 @@ "react-native": "*" } }, + "node_modules/expo-camera": { + "version": "16.0.14", + "resolved": "https://registry.npmjs.org/expo-camera/-/expo-camera-16.0.14.tgz", + "integrity": "sha512-nTQjb3Vtp0rA40fQdGLO+YCg7kHigBs9J4LkAXiL7Gsjl8lxYgFqHCCrFLOm/4D2TJSnqHSGQQflzwoWQDpZzw==", + "dependencies": { + "invariant": "^2.2.4" + }, + "peerDependencies": { + "expo": "*", + "react": "*", + "react-native": "*", + "react-native-web": "*" + }, + "peerDependenciesMeta": { + "react-native-web": { + "optional": true + } + } + }, "node_modules/expo-constants": { "version": "17.0.3", "resolved": "https://registry.npmjs.org/expo-constants/-/expo-constants-17.0.3.tgz", @@ -12029,6 +12101,22 @@ ], "license": "MIT" }, + "node_modules/qrcode": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz", + "integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==", + "dependencies": { + "dijkstrajs": "^1.0.1", + "pngjs": "^5.0.0", + "yargs": "^15.3.1" + }, + "bin": { + "qrcode": "bin/qrcode" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/qrcode-terminal": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.11.0.tgz", @@ -12037,6 +12125,152 @@ "qrcode-terminal": "bin/qrcode-terminal.js" } }, + "node_modules/qrcode/node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/qrcode/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/qrcode/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qrcode/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qrcode/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/qrcode/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qrcode/node_modules/pngjs": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz", + "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/qrcode/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qrcode/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qrcode/node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qrcode/node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" + }, + "node_modules/qrcode/node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qrcode/node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/query-string": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.3.tgz", @@ -12333,6 +12567,21 @@ "react-native": ">=0.73.0" } }, + "node_modules/react-native-qrcode-svg": { + "version": "6.3.14", + "resolved": "https://registry.npmjs.org/react-native-qrcode-svg/-/react-native-qrcode-svg-6.3.14.tgz", + "integrity": "sha512-YtMI/C3Vfhs/3Y/g3DEiEEG7ZOgLNsACiTjKMNYPr66Z1pgTG5Ci7KDoZFYuXwD5OSN19Lxi52QarZdybd0dWw==", + "dependencies": { + "prop-types": "^15.8.0", + "qrcode": "^1.5.4", + "text-encoding": "^0.7.0" + }, + "peerDependencies": { + "react": "*", + "react-native": ">=0.63.4", + "react-native-svg": ">=14.0.0" + } + }, "node_modules/react-native-reanimated": { "version": "3.16.3", "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.16.3.tgz", @@ -12708,6 +12957,11 @@ "node": ">=0.10.0" } }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, "node_modules/requireg": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/requireg/-/requireg-0.2.2.tgz", @@ -13164,6 +13418,11 @@ "integrity": "sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA==", "license": "MIT" }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" + }, "node_modules/set-cookie-parser": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz", @@ -14186,6 +14445,12 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/text-encoding": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.7.0.tgz", + "integrity": "sha512-oJQ3f1hrOnbRLOcwKz0Liq2IcrvDeZRHXhd9RgLrsT+DjWY/nty1Hi7v3dtkaEYbPYe0mUoOfzRrMwfXXwgPUA==", + "deprecated": "no longer maintained" + }, "node_modules/thenify": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", @@ -14921,6 +15186,11 @@ "node": ">= 8" } }, + "node_modules/which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==" + }, "node_modules/which-typed-array": { "version": "1.1.16", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.16.tgz", diff --git a/CollectifyFrontend/package.json b/CollectifyFrontend/package.json index ebee023..4e5a476 100644 --- a/CollectifyFrontend/package.json +++ b/CollectifyFrontend/package.json @@ -19,9 +19,11 @@ "@expo/vector-icons": "^14.0.2", "@react-navigation/bottom-tabs": "^7.0.0", "@react-navigation/native": "^7.0.0", + "@react-navigation/stack": "^7.1.1", "@ui-kitten/components": "^5.3.1", "axios": "^1.7.9", "expo": "~52.0.15", + "expo-barcode-scanner": "^13.0.1", "expo-blur": "~14.0.1", "expo-constants": "~17.0.3", "expo-font": "~13.0.1", @@ -40,11 +42,13 @@ "react-dom": "18.3.1", "react-native": "0.76.3", "react-native-gesture-handler": "~2.20.2", + "react-native-qrcode-svg": "^6.3.14", "react-native-reanimated": "~3.16.1", "react-native-safe-area-context": "4.12.0", "react-native-screens": "~4.1.0", "react-native-web": "~0.19.13", - "react-native-webview": "13.12.5" + "react-native-webview": "13.12.5", + "expo-camera": "~16.0.14" }, "devDependencies": { "@babel/core": "^7.25.2", @@ -56,5 +60,8 @@ "react-test-renderer": "18.3.1", "typescript": "^5.3.3" }, - "private": true + "private": true, + "resolutions": { + "@types/react": "17.0.24" + } } diff --git a/CollectifyFrontend/src/library/IQRCodePayload.ts b/CollectifyFrontend/src/library/IQRCodePayload.ts new file mode 100644 index 0000000..b6e6727 --- /dev/null +++ b/CollectifyFrontend/src/library/IQRCodePayload.ts @@ -0,0 +1,4 @@ +export interface IQRCodePayload { + name: string; + number: string; +} \ No newline at end of file diff --git a/CollectifyFrontend/src/library/IStackScreenProps.ts b/CollectifyFrontend/src/library/IStackScreenProps.ts new file mode 100644 index 0000000..1f0c037 --- /dev/null +++ b/CollectifyFrontend/src/library/IStackScreenProps.ts @@ -0,0 +1,5 @@ +import { StackNavigationProp } from '@react-navigation/stack'; + +export interface IStackScreenProps { + navigation: StackNavigationProp; +} \ No newline at end of file From 54ad9e22f82f0486c1df1c1473d13e8c83e6eaeb Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 1 Feb 2025 14:30:04 +0200 Subject: [PATCH 2/9] CUpdated BarCodeScanner model to BarcodeScanningResult --- CollectifyFrontend/app.json | 10 +- CollectifyFrontend/app/(tabs)/qrCode.tsx | 12 +- CollectifyFrontend/app/(tabs)/scan.tsx | 91 +-- CollectifyFrontend/app/_layout.tsx | 10 +- CollectifyFrontend/app/groups/[item].tsx | 26 +- CollectifyFrontend/package-lock.json | 716 ++++++++++++++++++- CollectifyFrontend/package.json | 7 +- CollectifyFrontend/services/axiosInstance.ts | 1 + 8 files changed, 796 insertions(+), 77 deletions(-) diff --git a/CollectifyFrontend/app.json b/CollectifyFrontend/app.json index f5fc1d9..c8450e0 100644 --- a/CollectifyFrontend/app.json +++ b/CollectifyFrontend/app.json @@ -33,7 +33,15 @@ "backgroundColor": "#ffffff" } ], - "expo-secure-store" + "expo-secure-store", + [ + "expo-camera", + { + "cameraPermission": "Allow $(PRODUCT_NAME) to access your camera", + "microphonePermission": "Allow $(PRODUCT_NAME) to access your microphone", + "recordAudioAndroid": true + } + ] ], "experiments": { "typedRoutes": true diff --git a/CollectifyFrontend/app/(tabs)/qrCode.tsx b/CollectifyFrontend/app/(tabs)/qrCode.tsx index 62899c8..027eb1d 100644 --- a/CollectifyFrontend/app/(tabs)/qrCode.tsx +++ b/CollectifyFrontend/app/(tabs)/qrCode.tsx @@ -1,20 +1,18 @@ import React from 'react'; import { Button, StyleSheet, View } from 'react-native'; -import { Layout, Text, List, ListItem, ApplicationProvider } from '@ui-kitten/components'; - +import { useRouter } from 'expo-router'; import QRCode from 'react-native-qrcode-svg'; -import { IStackScreenProps } from '../../src/library/IStackScreenProps'; import { IQRCodePayload } from '../../src/library/IQRCodePayload'; -const QRCodeScreen: React.FunctionComponent = (props) => { - const { navigation } = props; +const QRCodeScreen = () => { + const router = useRouter(); const payload: IQRCodePayload = { name: 'Cool Person', number: '1-234-567-8900' }; return ( - */} - - ); - } + const handleBarcodeScanned = ({ type, data }: BarcodeScanningResult) => { + try { + console.log(type, data); + let _data = JSON.parse(data); + setScanData(_data); + } catch (error) { + console.error('Unable to parse QR code: ', error); + } + alert(`Scanned QR Code: ${data}`); + }; - if (permission) { - return ( - { - try { - console.log(type); - console.log(data); - let _data = JSON.parse(data); - setScanData(_data); - } catch (error) { - console.error('Unable to parse string: ', error); - } - }} - > - Scan the QR code. - - ); - } else { - return Permission rejected.; - } + return ( + + + {scanData && ( + + + + + {/* Notes List */} note.id.toString()} // Ensure note.id is a string style={styles.list} - /> + /> + + {/* Button Group */} + + {/* QR Code Button */} + + + {/* Members Button */} + - - - + {/* Notes List */} Date: Sat, 1 Feb 2025 22:46:22 +0200 Subject: [PATCH 5/9] See members page --- CollectifyFrontend/app/groups/[item].tsx | 7 +- .../app/groups/groupmembers.tsx | 120 +++++++++++++++++- CollectifyFrontend/services/groupService.ts | 25 ++++ 3 files changed, 148 insertions(+), 4 deletions(-) diff --git a/CollectifyFrontend/app/groups/[item].tsx b/CollectifyFrontend/app/groups/[item].tsx index 649a9a0..7f027e4 100644 --- a/CollectifyFrontend/app/groups/[item].tsx +++ b/CollectifyFrontend/app/groups/[item].tsx @@ -17,6 +17,8 @@ type Note = { export default function GroupNotesScreen() { const router = useRouter(); const { item: groupId } = useLocalSearchParams<{ item: string }>(); + //console.log("THIS IS THE GROUP ID from Ioana:", groupId); // Log to verify if groupId is valid + const [groupName, setGroupName] = useState(''); // State for group name const [notes, setNotes] = useState([]); // State for notes const [error, setError] = useState(null); // State for errors @@ -145,7 +147,10 @@ export default function GroupNotesScreen() { {/* Members Button */} + )} style={styles.listItem} /> )} diff --git a/CollectifyFrontend/services/groupService.ts b/CollectifyFrontend/services/groupService.ts index 9c88f5c..c89b113 100644 --- a/CollectifyFrontend/services/groupService.ts +++ b/CollectifyFrontend/services/groupService.ts @@ -176,4 +176,33 @@ export const getGroupMembers = async (groupId: string) => { console.error('Error fetching the group members:', error); throw error; } +}; + +export const deleteMemberFromGroup = async (groupId: string, memberId: string) => { + try { + const accessToken = await SecureStore.getItemAsync('accessToken'); + + if (!accessToken) { + throw new Error('Access token is missing. Please log in.'); + } + + const response = await api.delete('/api/groups/remove_member', { + data: { + groupId: groupId, + memberId: memberId, + }, + headers: { + Authorization: `Bearer ${accessToken}`, + }, + }); + + return response.data; + } catch (error) { + if (axios.isAxiosError(error)) { + console.error('Error deleting the member', error.response?.data || error.message); + } else { + console.error('An unknown error occurred:', error); + } + throw error; + } }; \ No newline at end of file