From f20b0ad4e84ddd3aae6c6d0c743ee84b59c815ff Mon Sep 17 00:00:00 2001 From: heyethereum Date: Fri, 26 Jul 2024 22:51:11 +0800 Subject: [PATCH] stopped at access token --- amplify/.config/project-config.json | 2 +- amplify/backend/auth/safeqr/parameters.json | 24 ++++ .../cli-inputs.json | 67 ---------- amplify/backend/backend-config.json | 123 ++++++++++++++---- .../amplify-dependent-resources-ref.d.ts | 16 +-- amplify/cli.json | 120 ++++++++--------- amplify/team-provider-info.json | 31 +++-- package-lock.json | 99 +++++++------- package.json | 3 +- reducers/qrCodesReducer.ts | 5 - screens/QRScannerScreen.tsx | 18 +-- screens/SettingsScreen.tsx | 92 ++++++++++++- 12 files changed, 358 insertions(+), 242 deletions(-) create mode 100644 amplify/backend/auth/safeqr/parameters.json delete mode 100644 amplify/backend/auth/safeqrfrontendmobile2d879dc9/cli-inputs.json diff --git a/amplify/.config/project-config.json b/amplify/.config/project-config.json index 76ccd73..830540a 100644 --- a/amplify/.config/project-config.json +++ b/amplify/.config/project-config.json @@ -1,5 +1,5 @@ { - "projectName": "SafeQRFrontEndMobile", + "projectName": "safeqr", "version": "3.1", "frontend": "javascript", "javascript": { diff --git a/amplify/backend/auth/safeqr/parameters.json b/amplify/backend/auth/safeqr/parameters.json new file mode 100644 index 0000000..445a6d1 --- /dev/null +++ b/amplify/backend/auth/safeqr/parameters.json @@ -0,0 +1,24 @@ +{ + "authSelections": "identityPoolAndUserPool", + "resourceName": "safeqr", + "serviceType": "imported", + "region": "ap-southeast-1", + "usernameAttributes": [ + "email" + ], + "authProvidersUserPool": [ + "Google" + ], + "requiredAttributes": [ + "email" + ], + "passwordPolicyMinLength": 6, + "passwordPolicyCharacters": [], + "mfaConfiguration": "OPTIONAL", + "autoVerifiedAttributes": [ + "email" + ], + "mfaTypes": [ + "TOTP" + ] +} \ No newline at end of file diff --git a/amplify/backend/auth/safeqrfrontendmobile2d879dc9/cli-inputs.json b/amplify/backend/auth/safeqrfrontendmobile2d879dc9/cli-inputs.json deleted file mode 100644 index 32d32bc..0000000 --- a/amplify/backend/auth/safeqrfrontendmobile2d879dc9/cli-inputs.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "version": "1", - "cognitoConfig": { - "identityPoolName": "safeqrfrontendmobile2d879dc9_identitypool_2d879dc9", - "allowUnauthenticatedIdentities": false, - "resourceNameTruncated": "safeqr2d879dc9", - "userPoolName": "safeqrfrontendmobile2d879dc9_userpool_2d879dc9", - "autoVerifiedAttributes": [ - "email" - ], - "mfaConfiguration": "OFF", - "mfaTypes": [ - "SMS Text Message" - ], - "smsAuthenticationMessage": "Your authentication code is {####}", - "smsVerificationMessage": "Your verification code is {####}", - "emailVerificationSubject": "Your verification code", - "emailVerificationMessage": "Your verification code is {####}", - "defaultPasswordPolicy": false, - "passwordPolicyMinLength": 8, - "passwordPolicyCharacters": [], - "requiredAttributes": [ - "email" - ], - "aliasAttributes": [], - "userpoolClientGenerateSecret": false, - "userpoolClientRefreshTokenValidity": 30, - "userpoolClientWriteAttributes": [ - "email" - ], - "userpoolClientReadAttributes": [ - "email" - ], - "userpoolClientLambdaRole": "safeqr2d879dc9_userpoolclient_lambda_role", - "userpoolClientSetAttributes": false, - "sharedId": "2d879dc9", - "resourceName": "safeqrfrontendmobile2d879dc9", - "authSelections": "identityPoolAndUserPool", - "useDefault": "defaultSocial", - "hostedUI": true, - "usernameAttributes": [ - "email" - ], - "hostedUIDomainName": "safeqrfrontendmobile2d879dc9-2d879dc9", - "authProvidersUserPool": [], - "hostedUIProviderMeta": "[]", - "userPoolGroupList": [], - "serviceName": "Cognito", - "usernameCaseSensitive": false, - "useEnabledMfas": true, - "authRoleArn": { - "Fn::GetAtt": [ - "AuthRole", - "Arn" - ] - }, - "unauthRoleArn": { - "Fn::GetAtt": [ - "UnauthRole", - "Arn" - ] - }, - "breakCircularDependency": true, - "dependsOn": [], - "oAuthMetadata": "{\"AllowedOAuthFlows\":[\"code\"],\"AllowedOAuthScopes\":[\"phone\",\"email\",\"openid\",\"profile\",\"aws.cognito.signin.user.admin\"],\"CallbackURLs\":[\"com.safeqr.safeqr://\"],\"LogoutURLs\":[\"com.safeqr.safeqr://\"]}" - } -} \ No newline at end of file diff --git a/amplify/backend/backend-config.json b/amplify/backend/backend-config.json index 02bcdb5..2dc2774 100644 --- a/amplify/backend/backend-config.json +++ b/amplify/backend/backend-config.json @@ -1,30 +1,109 @@ { "auth": { - "safeqrfrontendmobile2d879dc9": { + "safeqr": { "customAuth": false, "dependsOn": [], - "frontendAuthConfig": { - "mfaConfiguration": "OFF", - "mfaTypes": [ - "SMS" - ], - "passwordProtectionSettings": { - "passwordPolicyCharacters": [], - "passwordPolicyMinLength": 8 - }, - "signupAttributes": [ - "EMAIL" - ], - "socialProviders": [], - "usernameAttributes": [ - "EMAIL" - ], - "verificationMechanisms": [ - "EMAIL" - ] - }, "providerPlugin": "awscloudformation", - "service": "Cognito" + "service": "Cognito", + "serviceType": "imported" + } + }, + "parameters": { + "AMPLIFY_auth_safeqr_allowUnauthenticatedIdentities": { + "usedBy": [ + { + "category": "auth", + "resourceName": "safeqr" + } + ] + }, + "AMPLIFY_auth_safeqr_authRoleArn": { + "usedBy": [ + { + "category": "auth", + "resourceName": "safeqr" + } + ] + }, + "AMPLIFY_auth_safeqr_authRoleName": { + "usedBy": [ + { + "category": "auth", + "resourceName": "safeqr" + } + ] + }, + "AMPLIFY_auth_safeqr_googleClientId": { + "usedBy": [ + { + "category": "auth", + "resourceName": "safeqr" + } + ] + }, + "AMPLIFY_auth_safeqr_identityPoolId": { + "usedBy": [ + { + "category": "auth", + "resourceName": "safeqr" + } + ] + }, + "AMPLIFY_auth_safeqr_identityPoolName": { + "usedBy": [ + { + "category": "auth", + "resourceName": "safeqr" + } + ] + }, + "AMPLIFY_auth_safeqr_nativeClientId": { + "usedBy": [ + { + "category": "auth", + "resourceName": "safeqr" + } + ] + }, + "AMPLIFY_auth_safeqr_unauthRoleArn": { + "usedBy": [ + { + "category": "auth", + "resourceName": "safeqr" + } + ] + }, + "AMPLIFY_auth_safeqr_unauthRoleName": { + "usedBy": [ + { + "category": "auth", + "resourceName": "safeqr" + } + ] + }, + "AMPLIFY_auth_safeqr_userPoolId": { + "usedBy": [ + { + "category": "auth", + "resourceName": "safeqr" + } + ] + }, + "AMPLIFY_auth_safeqr_userPoolName": { + "usedBy": [ + { + "category": "auth", + "resourceName": "safeqr" + } + ] + }, + "AMPLIFY_auth_safeqr_webClientId": { + "usedBy": [ + { + "category": "auth", + "resourceName": "safeqr" + } + ] } } } \ No newline at end of file diff --git a/amplify/backend/types/amplify-dependent-resources-ref.d.ts b/amplify/backend/types/amplify-dependent-resources-ref.d.ts index 9df31cb..074b15b 100644 --- a/amplify/backend/types/amplify-dependent-resources-ref.d.ts +++ b/amplify/backend/types/amplify-dependent-resources-ref.d.ts @@ -1,15 +1 @@ -export type AmplifyDependentResourcesAttributes = { - "auth": { - "safeqrfrontendmobile2d879dc9": { - "AppClientID": "string", - "AppClientIDWeb": "string", - "HostedUIDomain": "string", - "IdentityPoolId": "string", - "IdentityPoolName": "string", - "OAuthMetadata": "string", - "UserPoolArn": "string", - "UserPoolId": "string", - "UserPoolName": "string" - } - } -} \ No newline at end of file +export type AmplifyDependentResourcesAttributes = {} \ No newline at end of file diff --git a/amplify/cli.json b/amplify/cli.json index 0aa68b9..ccacbe8 100644 --- a/amplify/cli.json +++ b/amplify/cli.json @@ -1,64 +1,64 @@ { - "features": { - "graphqltransformer": { - "addmissingownerfields": true, - "improvepluralization": false, - "validatetypenamereservedwords": true, - "useexperimentalpipelinedtransformer": true, - "enableiterativegsiupdates": true, - "secondarykeyasgsi": true, - "skipoverridemutationinputtypes": true, - "transformerversion": 2, - "suppressschemamigrationprompt": true, - "securityenhancementnotification": false, - "showfieldauthnotification": false, - "usesubusernamefordefaultidentityclaim": true, - "usefieldnameforprimarykeyconnectionfield": false, - "enableautoindexquerynames": true, - "respectprimarykeyattributesonconnectionfield": true, - "shoulddeepmergedirectiveconfigdefaults": false, - "populateownerfieldforstaticgroupauth": true, - "subscriptionsinheritprimaryauth": false + "features": { + "graphqltransformer": { + "addmissingownerfields": true, + "improvepluralization": false, + "validatetypenamereservedwords": true, + "useexperimentalpipelinedtransformer": true, + "enableiterativegsiupdates": true, + "secondarykeyasgsi": true, + "skipoverridemutationinputtypes": true, + "transformerversion": 2, + "suppressschemamigrationprompt": true, + "securityenhancementnotification": false, + "showfieldauthnotification": false, + "usesubusernamefordefaultidentityclaim": true, + "usefieldnameforprimarykeyconnectionfield": false, + "enableautoindexquerynames": true, + "respectprimarykeyattributesonconnectionfield": true, + "shoulddeepmergedirectiveconfigdefaults": false, + "populateownerfieldforstaticgroupauth": true, + "subscriptionsinheritprimaryauth": false + }, + "frontend-ios": { + "enablexcodeintegration": true + }, + "auth": { + "enablecaseinsensitivity": true, + "useinclusiveterminology": true, + "breakcirculardependency": true, + "forcealiasattributes": false, + "useenabledmfas": true + }, + "codegen": { + "useappsyncmodelgenplugin": true, + "usedocsgeneratorplugin": true, + "usetypesgeneratorplugin": true, + "cleangeneratedmodelsdirectory": true, + "retaincasestyle": true, + "addtimestampfields": true, + "handlelistnullabilitytransparently": true, + "emitauthprovider": true, + "generateindexrules": true, + "enabledartnullsafety": true, + "generatemodelsforlazyloadandcustomselectionset": false + }, + "appsync": { + "generategraphqlpermissions": true + }, + "latestregionsupport": { + "pinpoint": 1, + "translate": 1, + "transcribe": 1, + "rekognition": 1, + "textract": 1, + "comprehend": 1 + }, + "project": { + "overrides": true + } }, - "frontend-ios": { - "enablexcodeintegration": true - }, - "auth": { - "enablecaseinsensitivity": true, - "useinclusiveterminology": true, - "breakcirculardependency": true, - "forcealiasattributes": false, - "useenabledmfas": true - }, - "codegen": { - "useappsyncmodelgenplugin": true, - "usedocsgeneratorplugin": true, - "usetypesgeneratorplugin": true, - "cleangeneratedmodelsdirectory": true, - "retaincasestyle": true, - "addtimestampfields": true, - "handlelistnullabilitytransparently": true, - "emitauthprovider": true, - "generateindexrules": true, - "enabledartnullsafety": true, - "generatemodelsforlazyloadandcustomselectionset": false - }, - "appsync": { - "generategraphqlpermissions": true - }, - "latestregionsupport": { - "pinpoint": 1, - "translate": 1, - "transcribe": 1, - "rekognition": 1, - "textract": 1, - "comprehend": 1 - }, - "project": { - "overrides": true + "debug": { + "shareProjectConfig": false } - }, - "debug": { - "shareProjectConfig": false - } } \ No newline at end of file diff --git a/amplify/team-provider-info.json b/amplify/team-provider-info.json index 9d68413..331e7ce 100644 --- a/amplify/team-provider-info.json +++ b/amplify/team-provider-info.json @@ -1,19 +1,32 @@ { "dev": { "awscloudformation": { - "AuthRoleName": "amplify-safeqrfrontendmobile-dev-d47dd-authRole", - "UnauthRoleArn": "arn:aws:iam::058264269465:role/amplify-safeqrfrontendmobile-dev-d47dd-unauthRole", - "AuthRoleArn": "arn:aws:iam::058264269465:role/amplify-safeqrfrontendmobile-dev-d47dd-authRole", + "AuthRoleName": "amplify-safeqr-dev-45853-authRole", + "UnauthRoleArn": "arn:aws:iam::058264269465:role/amplify-safeqr-dev-45853-unauthRole", + "AuthRoleArn": "arn:aws:iam::058264269465:role/amplify-safeqr-dev-45853-authRole", "Region": "ap-southeast-1", - "DeploymentBucketName": "amplify-safeqrfrontendmobile-dev-d47dd-deployment", - "UnauthRoleName": "amplify-safeqrfrontendmobile-dev-d47dd-unauthRole", - "StackName": "amplify-safeqrfrontendmobile-dev-d47dd", - "StackId": "arn:aws:cloudformation:ap-southeast-1:058264269465:stack/amplify-safeqrfrontendmobile-dev-d47dd/6b855b50-3c40-11ef-b0cb-0aac1b92eadd", - "AmplifyAppId": "d2d2iszqi4kpe5" + "DeploymentBucketName": "amplify-safeqr-dev-45853-deployment", + "UnauthRoleName": "amplify-safeqr-dev-45853-unauthRole", + "StackName": "amplify-safeqr-dev-45853", + "StackId": "arn:aws:cloudformation:ap-southeast-1:058264269465:stack/amplify-safeqr-dev-45853/df03aa80-48b3-11ef-8210-0285266ba73b", + "AmplifyAppId": "d3c5p62zte3j" }, "categories": { "auth": { - "safeqrfrontendmobile2d879dc9": {} + "safeqr": { + "userPoolId": "ap-southeast-1_zkxA0NZYN", + "userPoolName": "safeqr", + "webClientId": "6jfhnjr067t2cgamvst1uquj73", + "nativeClientId": "6jfhnjr067t2cgamvst1uquj73", + "identityPoolId": "ap-southeast-1:10ca3025-9e28-4f14-a07e-93f4f69e4473", + "identityPoolName": "safeqr-identity-pool", + "allowUnauthenticatedIdentities": true, + "authRoleArn": "arn:aws:iam::058264269465:role/service-role/amplify-iam-role", + "authRoleName": "amplify-iam-role", + "unauthRoleArn": "arn:aws:iam::058264269465:role/service-role/amplify-iam-guest", + "unauthRoleName": "amplify-iam-guest", + "googleClientId": "937053967427-1gcm0u1pp1mabrueeka475kt2st7o932.apps.googleusercontent.com" + } } } } diff --git a/package-lock.json b/package-lock.json index 10db63f..b5de7b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "safeqr", "version": "1.0.0", "dependencies": { + "@aws-amplify/auth": "^6.3.10", "@aws-amplify/react-native": "^1.1.1", "@aws-amplify/rtn-web-browser": "^1.0.30", "@aws-amplify/ui-react-native": "^2.2.2", @@ -17,7 +18,7 @@ "@react-navigation/bottom-tabs": "^6.5.20", "@react-navigation/native": "^6.1.17", "@reduxjs/toolkit": "^2.2.6", - "aws-amplify": "^6.3.8", + "aws-amplify": "^6.4.2", "axios": "^1.7.2", "dotenv": "^16.4.5", "expo": "~51.0.17", @@ -60,9 +61,9 @@ } }, "node_modules/@aws-amplify/analytics": { - "version": "7.0.36", - "resolved": "https://registry.npmjs.org/@aws-amplify/analytics/-/analytics-7.0.36.tgz", - "integrity": "sha512-fmEOlpLy74drPWIIiVVRgIXhE/7k2bMbtgq648gUEVFyt4nxxXCJh2K/v9NEnIICHyotYoRfwASr0ade7Chaow==", + "version": "7.0.39", + "resolved": "https://registry.npmjs.org/@aws-amplify/analytics/-/analytics-7.0.39.tgz", + "integrity": "sha512-Xvf1tT8JovSUVhlxfwbyUCJi8AWLEXHSqWYH0+131BrLZCYppcYmyPDUccJtFGwVXMStHn5yqlmYHTq6oabxsA==", "license": "Apache-2.0", "dependencies": { "@aws-sdk/client-firehose": "3.398.0", @@ -76,24 +77,24 @@ } }, "node_modules/@aws-amplify/api": { - "version": "6.0.38", - "resolved": "https://registry.npmjs.org/@aws-amplify/api/-/api-6.0.38.tgz", - "integrity": "sha512-XlWFNzQaYBUTZXbhMvfNJPyvWTW0GT5r8JJd8S0PsW/mf2MLmIno9MMCwzNz8L2okMBVR4wXa2KoK6Vh+gNeyg==", + "version": "6.0.41", + "resolved": "https://registry.npmjs.org/@aws-amplify/api/-/api-6.0.41.tgz", + "integrity": "sha512-EDzlw9C6By2yyE4sRUxeBp1RZtvuonrYvXTCVpGxeWohCfYAIemFIuj4nCN6SRa2aVlueHX3IEM6AHDKqgZOpA==", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/api-graphql": "4.1.7", - "@aws-amplify/api-rest": "4.0.36", + "@aws-amplify/api-graphql": "4.1.10", + "@aws-amplify/api-rest": "4.0.39", "tslib": "^2.5.0" } }, "node_modules/@aws-amplify/api-graphql": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/@aws-amplify/api-graphql/-/api-graphql-4.1.7.tgz", - "integrity": "sha512-5ip5xxhrw68G5nd35rtkmnWJZ8bwn47coWlk+S6HmKIkGhsmi57GfEy5qJkWJquKMoenomAlHA+Z4KUshOPJqg==", + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@aws-amplify/api-graphql/-/api-graphql-4.1.10.tgz", + "integrity": "sha512-ClFJbHaPjwCn2Ri35VB5tCBgcKuwTEhTQVNxmkZmaQrbd5yhbEKPt9bWMPlLHe37IA5RYNyFVFJyzdGPBfh8Xg==", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/api-rest": "4.0.36", - "@aws-amplify/core": "6.3.3", + "@aws-amplify/api-rest": "4.0.39", + "@aws-amplify/core": "6.3.6", "@aws-amplify/data-schema": "^1.0.0", "@aws-sdk/types": "3.387.0", "graphql": "15.8.0", @@ -116,9 +117,9 @@ } }, "node_modules/@aws-amplify/api-rest": { - "version": "4.0.36", - "resolved": "https://registry.npmjs.org/@aws-amplify/api-rest/-/api-rest-4.0.36.tgz", - "integrity": "sha512-D8vIMFl5pHxs6BLrtSOudLtgbUBZbBhb6ctnNWcyZvHDfZJZs0PYwJLbOzsZSmnhYRtpqOWXbZctHW/0ngYosg==", + "version": "4.0.39", + "resolved": "https://registry.npmjs.org/@aws-amplify/api-rest/-/api-rest-4.0.39.tgz", + "integrity": "sha512-S3jrHb9hGQDyJxTVCQoKky5MLZDdqQxOH3p8vYOsOU8OtJ4dusrf2gLFqN2FAgyuK9yuc3aFvm4Hw6Zh7JfSgA==", "license": "Apache-2.0", "dependencies": { "tslib": "^2.5.0" @@ -128,9 +129,9 @@ } }, "node_modules/@aws-amplify/auth": { - "version": "6.3.7", - "resolved": "https://registry.npmjs.org/@aws-amplify/auth/-/auth-6.3.7.tgz", - "integrity": "sha512-C+9IIyOKtb89l4ptPLu/9wPfVeEnEgZ/oAOytnLAedu/uheDeDX7QEwpL35nW6y9i4+G05DIlGwph9SK1gEHEw==", + "version": "6.3.10", + "resolved": "https://registry.npmjs.org/@aws-amplify/auth/-/auth-6.3.10.tgz", + "integrity": "sha512-vpYXytfd8V2ndAXxYpy/4ZgNnTmT75Wp/TLftwrLWJh1E0iBU+8gph4Zfj3OCK82oCXilw0kTVvoHI26ajkQgw==", "license": "Apache-2.0", "dependencies": { "tslib": "^2.5.0" @@ -140,9 +141,9 @@ } }, "node_modules/@aws-amplify/core": { - "version": "6.3.3", - "resolved": "https://registry.npmjs.org/@aws-amplify/core/-/core-6.3.3.tgz", - "integrity": "sha512-4GM3Q8x9YgXxQULCqgH3VPlX//K4TOrM1JbQ1eE5PsdVu+JrWpS1n86TvdULVnbspws16n3z73ALDKmnBZsx0g==", + "version": "6.3.6", + "resolved": "https://registry.npmjs.org/@aws-amplify/core/-/core-6.3.6.tgz", + "integrity": "sha512-xIARNd6u8GeBUPYlcAE4NzdKepOPOCCmPCNtfz3EVzxmjfcSk5p2Zu1r+ZRbCwQDLv0AKM+NPH4Qj8+6s0rY4g==", "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha256-js": "5.2.0", @@ -182,9 +183,9 @@ } }, "node_modules/@aws-amplify/data-schema": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/@aws-amplify/data-schema/-/data-schema-1.3.4.tgz", - "integrity": "sha512-hzfn9ER8UbdhoE4RGttDxJrnH6EAc7WBGRNa8NyKMVCMSlLUIvf8+XyX5e1zmEPLl48TtwuQvOd+CkhWrBraHg==", + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@aws-amplify/data-schema/-/data-schema-1.3.9.tgz", + "integrity": "sha512-3KMKcte/SosRksOVgE8Gj/EG94UEqhse1t8NRImQD4iEqAMkakGJNoIqS4/QTSD7vYCmuREU/hhWwT1ITE6f4w==", "license": "Apache-2.0", "dependencies": { "@aws-amplify/data-schema-types": "*", @@ -203,12 +204,12 @@ } }, "node_modules/@aws-amplify/datastore": { - "version": "5.0.38", - "resolved": "https://registry.npmjs.org/@aws-amplify/datastore/-/datastore-5.0.38.tgz", - "integrity": "sha512-DgIjFMjzTGXift6rVhMcrzzUvpYvrszaEbTe3OsS3SzYXnSTSPSRICFYR6MqVyLN8v3lPc1m5AY1rLsRj3O8YA==", + "version": "5.0.41", + "resolved": "https://registry.npmjs.org/@aws-amplify/datastore/-/datastore-5.0.41.tgz", + "integrity": "sha512-IMXfExS3/yYYwqtWsFeLSZd1H9Yz/xXian+8DHgmHjSjTVFUOyRm9HQ4hXZzoP1KyzGEAvpJqeV9wLT+Drg41Q==", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/api": "6.0.38", + "@aws-amplify/api": "6.0.41", "buffer": "4.9.2", "idb": "5.0.6", "immer": "9.0.6", @@ -241,9 +242,9 @@ } }, "node_modules/@aws-amplify/notifications": { - "version": "2.0.36", - "resolved": "https://registry.npmjs.org/@aws-amplify/notifications/-/notifications-2.0.36.tgz", - "integrity": "sha512-o2vf013m1fvyDPOl7qF399ph8GyQIw8a+tB+pEmWA29RFV4qJ7t/2k/4mpujdDrKtACrnHXjj/MK1taqVqPfLg==", + "version": "2.0.39", + "resolved": "https://registry.npmjs.org/@aws-amplify/notifications/-/notifications-2.0.39.tgz", + "integrity": "sha512-bR/LEDTzbYSgb7L2vqEPpeZLODTSycu/r7K2IuzDduvCcTB62UnNcgXg7yBuHwRFPCfkRtZFx0uevtciTGJfPA==", "license": "Apache-2.0", "dependencies": { "lodash": "^4.17.21", @@ -299,9 +300,9 @@ "license": "Apache-2.0" }, "node_modules/@aws-amplify/storage": { - "version": "6.4.7", - "resolved": "https://registry.npmjs.org/@aws-amplify/storage/-/storage-6.4.7.tgz", - "integrity": "sha512-5SXgtNwc3qjPCla/Qck2u5Fbr7NlBTaatMs/fL9VuosAfSiMG9/ZApZOUQlQSil7KKRSr19a/vIx0tv2jLg8IQ==", + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/@aws-amplify/storage/-/storage-6.5.2.tgz", + "integrity": "sha512-6wxBE81qMw7vwdGvIhwTLXM/ZQ4nlgFb8p2QjhXqC4cm5mS0kUxGXhJJ7NdNjFMrax9qxULSi3LJePhzbConLw==", "license": "Apache-2.0", "dependencies": { "@aws-sdk/types": "3.398.0", @@ -8714,9 +8715,9 @@ } }, "node_modules/@types/aws-lambda": { - "version": "8.10.140", - "resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.140.tgz", - "integrity": "sha512-4Dh3dk2TUcbdfHrX0Al90mNGJDvA9NBiTQPzbrjGi/dLxzKCGOYgT8YQ47jUKNFALkAJAadifq0pzyjIUlhVhg==", + "version": "8.10.141", + "resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.141.tgz", + "integrity": "sha512-SMWlRBukG9KV8ZNjwemp2AzDibp/czIAeKKTw09nCPbWxVskIxactCJCGOp4y6I1hCMY7T7UGfySvBLXNeUbEw==", "license": "MIT" }, "node_modules/@types/istanbul-lib-coverage": { @@ -9159,18 +9160,18 @@ } }, "node_modules/aws-amplify": { - "version": "6.3.8", - "resolved": "https://registry.npmjs.org/aws-amplify/-/aws-amplify-6.3.8.tgz", - "integrity": "sha512-eplilc+XBr9lcJk9L4eNYEgTj5osBOIgeAuVMi+HEOUa8lh0ngf9NIbNjnJSo8F74OgVXnKCoiQPmV3z4B6Fgw==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/aws-amplify/-/aws-amplify-6.4.2.tgz", + "integrity": "sha512-56VQJdLBTMZEjmYQ1h21tv5P6iCdUQjGlzmkLvUpa30LtsfvnQ+Aync750OB6VG5g0rL1A/H5sscnngCEodKtg==", "license": "Apache-2.0", "dependencies": { - "@aws-amplify/analytics": "7.0.36", - "@aws-amplify/api": "6.0.38", - "@aws-amplify/auth": "6.3.7", - "@aws-amplify/core": "6.3.3", - "@aws-amplify/datastore": "5.0.38", - "@aws-amplify/notifications": "2.0.36", - "@aws-amplify/storage": "6.4.7", + "@aws-amplify/analytics": "7.0.39", + "@aws-amplify/api": "6.0.41", + "@aws-amplify/auth": "6.3.10", + "@aws-amplify/core": "6.3.6", + "@aws-amplify/datastore": "5.0.41", + "@aws-amplify/notifications": "2.0.39", + "@aws-amplify/storage": "6.5.2", "tslib": "^2.5.0" } }, diff --git a/package.json b/package.json index 7f029f5..8a3bdbd 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "web": "expo start --web" }, "dependencies": { + "@aws-amplify/auth": "^6.3.10", "@aws-amplify/react-native": "^1.1.1", "@aws-amplify/rtn-web-browser": "^1.0.30", "@aws-amplify/ui-react-native": "^2.2.2", @@ -20,7 +21,7 @@ "@react-navigation/bottom-tabs": "^6.5.20", "@react-navigation/native": "^6.1.17", "@reduxjs/toolkit": "^2.2.6", - "aws-amplify": "^6.3.8", + "aws-amplify": "^6.4.2", "axios": "^1.7.2", "dotenv": "^16.4.5", "expo": "~51.0.17", diff --git a/reducers/qrCodesReducer.ts b/reducers/qrCodesReducer.ts index 7b6434e..5f4b0b3 100644 --- a/reducers/qrCodesReducer.ts +++ b/reducers/qrCodesReducer.ts @@ -6,13 +6,11 @@ import { RootState } from '../store'; interface QRCodeState { qrCodes: QRCode[]; histories: QRCodeType[] | null; - bookmarks: QRCodeType[] | null; userAttributes: UserAttributes; } const initialState: QRCodeState = { qrCodes: [], histories: [], - bookmarks: [], userAttributes: null, }; @@ -69,9 +67,6 @@ const qrCodesSlice = createSlice({ setScannedHistories(state, action: PayloadAction) { state.histories = action.payload; }, - setBookmarks(state, action: PayloadAction) { - state.bookmarks = action.payload; - }, } }); diff --git a/screens/QRScannerScreen.tsx b/screens/QRScannerScreen.tsx index d82113c..4ee5417 100644 --- a/screens/QRScannerScreen.tsx +++ b/screens/QRScannerScreen.tsx @@ -8,13 +8,14 @@ import { useFocusEffect, useNavigation } from '@react-navigation/native'; import * as ImagePicker from 'expo-image-picker'; import ScannedDataBox from '../components/ScannedDataBox'; import { useDispatch } from 'react-redux'; +import { RootState, AppDispatch } from '../store'; import { addQRCode } from '../reducers/qrCodesReducer'; // Assuming you have actions defined for Redux import { detectQRCodeType, verifyURL, checkRedirects } from '../api/qrCodeAPI'; // Import utility functions // Main Function const QRScannerScreen: React.FC<{ clearScanData: () => void }> = ({ clearScanData }) => { const navigation = useNavigation(); // call Navigation bar - const dispatch = useDispatch(); // Use dispatch for Redux actions + const dispatch = useDispatch(); // Use dispatch for Redux actions const [showSplash, setShowSplash] = useState(true); // call splash screen const qrCodeContext = useContext(QRCodeContext); // From ./types.ts @@ -147,15 +148,6 @@ const QRScannerScreen: React.FC<{ clearScanData: () => void }> = ({ clearScanDat } }; - // // Clear scan data when screen is focused - // useEffect(() => { - // const unsubscribe = navigation.addListener('focus', () => { - // clearScanDataInternal(); - // console.log("Screen focused, scan data cleared"); - // }); - // return unsubscribe; - // }, [navigation]); - // Clear scan data when screen is focused useFocusEffect( useCallback(() => { @@ -206,9 +198,9 @@ const QRScannerScreen: React.FC<{ clearScanData: () => void }> = ({ clearScanDat - + {/* - + */} @@ -252,6 +244,8 @@ const styles = StyleSheet.create({ justifyContent: 'center', alignItems: 'center', backgroundColor: '#f8f0fc', + height: '100%', + width: '100%', }, cameraContainer: { height: '60%', diff --git a/screens/SettingsScreen.tsx b/screens/SettingsScreen.tsx index 84042a7..4cec05f 100644 --- a/screens/SettingsScreen.tsx +++ b/screens/SettingsScreen.tsx @@ -1,15 +1,102 @@ import { View, Text, StyleSheet, TouchableOpacity, Linking, Button } from 'react-native'; import { useAuthenticator } from '@aws-amplify/ui-react-native'; import useFetchUserAttributes from '../hooks/useFetchUserAttributes'; +import { fetchAuthSession, getCurrentUser, signInWithRedirect } from 'aws-amplify/auth'; +import { useEffect, useState } from 'react'; +import { Buffer } from 'buffer'; function SignOutButton() { const { signOut } = useAuthenticator(); return