From 8ce304fd56c8f8aec2e1f97caf9b4c9a87477ed9 Mon Sep 17 00:00:00 2001 From: Sai Ranjit Tummalapalli Date: Mon, 15 Apr 2024 17:57:19 +0530 Subject: [PATCH] fix: list credential page Signed-off-by: Sai Ranjit Tummalapalli --- app/components/record/RecordField.tsx | 16 +++ app/screens/CredentialDetails.tsx | 9 +- app/screens/CredentialOffer.tsx | 9 +- app/screens/ListCredentials.tsx | 4 +- app/utils/credential.ts | 11 +- ios/AdeyaWallet.xcodeproj/project.pbxproj | 8 +- ios/Podfile | 4 +- ios/Podfile.lock | 125 +++------------------- 8 files changed, 50 insertions(+), 136 deletions(-) diff --git a/app/components/record/RecordField.tsx b/app/components/record/RecordField.tsx index 2a5813c05..155ed07b6 100644 --- a/app/components/record/RecordField.tsx +++ b/app/components/record/RecordField.tsx @@ -92,6 +92,22 @@ const RecordField: React.FC = ({ }, }) + const isJSON = (text: string) => { + if (typeof text !== 'string') { + return false + } + try { + JSON.parse(text) + return true + } catch (error) { + return false + } + } + + if (isJSON(field?.value)) { + return + } + return ( diff --git a/app/screens/CredentialDetails.tsx b/app/screens/CredentialDetails.tsx index 8d466e245..1308170ec 100644 --- a/app/screens/CredentialDetails.tsx +++ b/app/screens/CredentialDetails.tsx @@ -37,12 +37,7 @@ import { CredentialMetadata, customMetadata } from '../types/metadata' import { CredentialStackParams, Screens } from '../types/navigators' import { ModalUsage } from '../types/remove' import { useAppAgent } from '../utils/agent' -import { - credentialTextColor, - getCredentialIdentifiers, - isValidAnonCredsCredential, - toImageSource, -} from '../utils/credential' +import { credentialTextColor, getCredentialIdentifiers, toImageSource } from '../utils/credential' import { formatTime, getCredentialConnectionLabel } from '../utils/helpers' import { buildFieldsFromAnonCredsCredential } from '../utils/oca' import { useSocialShare } from '../utils/social-share' @@ -163,7 +158,7 @@ const CredentialDetails: React.FC = ({ navigation, route }, []) useEffect(() => { - if (!(credential && isValidAnonCredsCredential(credential))) { + if (!credential) { return } diff --git a/app/screens/CredentialOffer.tsx b/app/screens/CredentialOffer.tsx index 011eacf42..c490e7e6c 100644 --- a/app/screens/CredentialOffer.tsx +++ b/app/screens/CredentialOffer.tsx @@ -33,12 +33,7 @@ import { TabStacks, NotificationStackParams, Screens } from '../types/navigators import { W3CCredentialAttributeField } from '../types/record' import { ModalUsage } from '../types/remove' import { useAppAgent } from '../utils/agent' -import { - buildFieldsFromJSONLDCredential, - formatCredentialSubject, - getCredentialIdentifiers, - isValidAnonCredsCredential, -} from '../utils/credential' +import { buildFieldsFromJSONLDCredential, formatCredentialSubject, getCredentialIdentifiers } from '../utils/credential' import { getCredentialConnectionLabel } from '../utils/helpers' import { buildFieldsFromAnonCredsCredential } from '../utils/oca' import { testIdWithKey } from '../utils/testable' @@ -106,7 +101,7 @@ const CredentialOffer: React.FC = ({ navigation, route }) }, []) useEffect(() => { - if (!(credential && isValidAnonCredsCredential(credential))) { + if (!credential) { return } diff --git a/app/screens/ListCredentials.tsx b/app/screens/ListCredentials.tsx index df6651fad..79a370b72 100644 --- a/app/screens/ListCredentials.tsx +++ b/app/screens/ListCredentials.tsx @@ -54,7 +54,7 @@ const ListCredentials: React.FC = () => { const updatedCredentials = await Promise.all( credentials.map(async credential => { - if (!isW3CCredential(credential)) { + if (isW3CCredential(credential)) { const credentialRecordId = credential.credentials[0].credentialRecordId try { const record = await getW3cCredentialRecordById(agent, credentialRecordId) @@ -78,7 +78,7 @@ const ListCredentials: React.FC = () => { updateCredentials().then(updatedCredentials => { setCredentialList(updatedCredentials) }) - }, [credentialList]) + }, []) return ( diff --git a/app/utils/credential.ts b/app/utils/credential.ts index e7c751c3e..fedb1bf86 100644 --- a/app/utils/credential.ts +++ b/app/utils/credential.ts @@ -8,8 +8,9 @@ import { luminanceForHexColor } from './luminance' export const isValidAnonCredsCredential = (credential: CredentialExchangeRecord) => { return ( credential && - (credential.state === CredentialState.OfferReceived || - credential.credentials.find(c => c.credentialRecordType !== 'anoncreds')) + credential.state === CredentialState.OfferReceived && + credential.credentialAttributes && + credential.credentialAttributes?.length > 0 ) } @@ -37,7 +38,11 @@ export const getCredentialIdentifiers = (credential: CredentialExchangeRecord) = } export const isW3CCredential = (credential: CredentialExchangeRecord) => { - return credential && credential.credentials.find(c => c.credentialRecordType === 'w3c') + return ( + credential && + credential.credentials[0].credentialRecordType === 'w3c' && + credential.credentialAttributes?.length === 0 + ) } export const sanitizeString = (str: string) => { diff --git a/ios/AdeyaWallet.xcodeproj/project.pbxproj b/ios/AdeyaWallet.xcodeproj/project.pbxproj index 93ee0204a..1e2002a1a 100644 --- a/ios/AdeyaWallet.xcodeproj/project.pbxproj +++ b/ios/AdeyaWallet.xcodeproj/project.pbxproj @@ -507,7 +507,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = AdeyaWallet/AdeyaWallet.entitlements; - CURRENT_PROJECT_VERSION = 25; + CURRENT_PROJECT_VERSION = 27; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = Z5W7KRPGHZ; ENABLE_BITCODE = NO; @@ -517,7 +517,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.6; + MARKETING_VERSION = 1.0.7; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -545,7 +545,7 @@ CODE_SIGN_ENTITLEMENTS = AdeyaWallet/AdeyaWallet.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 25; + CURRENT_PROJECT_VERSION = 27; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = Z5W7KRPGHZ; INFOPLIST_FILE = AdeyaWallet/Info.plist; @@ -554,7 +554,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.6; + MARKETING_VERSION = 1.0.7; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", diff --git a/ios/Podfile b/ios/Podfile index 0283fe70c..5db926f06 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -27,7 +27,7 @@ setup_permissions([ # dependencies: { # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), # ``` -flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled +# flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled linkage = ENV['USE_FRAMEWORKS'] if linkage != nil @@ -53,7 +53,7 @@ target 'AdeyaWallet' do # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. - :flipper_configuration => flipper_config, + # :flipper_configuration => flipper_config, # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 03b2783da..827de552e 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,9 +1,9 @@ PODS: - - anoncreds (0.1.0): + - anoncreds (0.2.1): - React - React-callinvoker - React-Core - - aries-askar (0.1.1): + - aries-askar (0.2.0): - React - React-callinvoker - React-Core @@ -69,64 +69,6 @@ PODS: - GoogleUtilities/Reachability (~> 7.8) - GoogleUtilities/UserDefaults (~> 7.8) - nanopb (< 2.30910.0, >= 2.30908.0) - - Flipper (0.182.0): - - Flipper-Folly (~> 2.6) - - Flipper-Boost-iOSX (1.76.0.1.11) - - Flipper-DoubleConversion (3.2.0.1) - - Flipper-Fmt (7.1.7) - - Flipper-Folly (2.6.10): - - Flipper-Boost-iOSX - - Flipper-DoubleConversion - - Flipper-Fmt (= 7.1.7) - - Flipper-Glog - - libevent (~> 2.1.12) - - OpenSSL-Universal (= 1.1.1100) - - Flipper-Glog (0.5.0.5) - - Flipper-PeerTalk (0.0.4) - - FlipperKit (0.182.0): - - FlipperKit/Core (= 0.182.0) - - FlipperKit/Core (0.182.0): - - Flipper (~> 0.182.0) - - FlipperKit/CppBridge - - FlipperKit/FBCxxFollyDynamicConvert - - FlipperKit/FBDefines - - FlipperKit/FKPortForwarding - - SocketRocket (~> 0.6.0) - - FlipperKit/CppBridge (0.182.0): - - Flipper (~> 0.182.0) - - FlipperKit/FBCxxFollyDynamicConvert (0.182.0): - - Flipper-Folly (~> 2.6) - - FlipperKit/FBDefines (0.182.0) - - FlipperKit/FKPortForwarding (0.182.0): - - CocoaAsyncSocket (~> 7.6) - - Flipper-PeerTalk (~> 0.0.4) - - FlipperKit/FlipperKitHighlightOverlay (0.182.0) - - FlipperKit/FlipperKitLayoutHelpers (0.182.0): - - FlipperKit/Core - - FlipperKit/FlipperKitHighlightOverlay - - FlipperKit/FlipperKitLayoutTextSearchable - - FlipperKit/FlipperKitLayoutIOSDescriptors (0.182.0): - - FlipperKit/Core - - FlipperKit/FlipperKitHighlightOverlay - - FlipperKit/FlipperKitLayoutHelpers - - YogaKit (~> 1.18) - - FlipperKit/FlipperKitLayoutPlugin (0.182.0): - - FlipperKit/Core - - FlipperKit/FlipperKitHighlightOverlay - - FlipperKit/FlipperKitLayoutHelpers - - FlipperKit/FlipperKitLayoutIOSDescriptors - - FlipperKit/FlipperKitLayoutTextSearchable - - YogaKit (~> 1.18) - - FlipperKit/FlipperKitLayoutTextSearchable (0.182.0) - - FlipperKit/FlipperKitNetworkPlugin (0.182.0): - - FlipperKit/Core - - FlipperKit/FlipperKitReactPlugin (0.182.0): - - FlipperKit/Core - - FlipperKit/FlipperKitUserDefaultsPlugin (0.182.0): - - FlipperKit/Core - - FlipperKit/SKIOSNetworkPlugin (0.182.0): - - FlipperKit/Core - - FlipperKit/FlipperKitNetworkPlugin - fmt (6.2.1) - glog (0.3.5) - GoogleAppMeasurement (10.14.0): @@ -189,7 +131,7 @@ PODS: - hermes-engine (0.72.3): - hermes-engine/Pre-built (= 0.72.3) - hermes-engine/Pre-built (0.72.3) - - indy-vdr (0.1.0): + - indy-vdr (0.2.1): - React - React-callinvoker - React-Core @@ -199,7 +141,6 @@ PODS: - nanopb/encode (= 2.30909.0) - nanopb/decode (2.30909.0) - nanopb/encode (2.30909.0) - - OpenSSL-Universal (1.1.1100) - PromisesObjC (2.3.1) - RCT-Folly (2021.07.22.00): - boost @@ -701,6 +642,8 @@ PODS: - RNScreens (3.23.0): - React-Core - React-RCTImage + - RNSecureRandom (1.0.1): + - React - RNShare (10.0.1): - React-Core - RNSVG (13.10.0): @@ -709,8 +652,6 @@ PODS: - React-Core - SocketRocket (0.6.1) - Yoga (1.14.0) - - YogaKit (1.18.1): - - Yoga (~> 1.14) DEPENDENCIES: - "anoncreds (from `../node_modules/@hyperledger/anoncreds-react-native`)" @@ -722,32 +663,11 @@ DEPENDENCIES: - Firebase - FirebaseCore - FirebaseCoreInternal - - Flipper (= 0.182.0) - - Flipper-Boost-iOSX (= 1.76.0.1.11) - - Flipper-DoubleConversion (= 3.2.0.1) - - Flipper-Fmt (= 7.1.7) - - Flipper-Folly (= 2.6.10) - - Flipper-Glog (= 0.5.0.5) - - Flipper-PeerTalk (= 0.0.4) - - FlipperKit (= 0.182.0) - - FlipperKit/Core (= 0.182.0) - - FlipperKit/CppBridge (= 0.182.0) - - FlipperKit/FBCxxFollyDynamicConvert (= 0.182.0) - - FlipperKit/FBDefines (= 0.182.0) - - FlipperKit/FKPortForwarding (= 0.182.0) - - FlipperKit/FlipperKitHighlightOverlay (= 0.182.0) - - FlipperKit/FlipperKitLayoutPlugin (= 0.182.0) - - FlipperKit/FlipperKitLayoutTextSearchable (= 0.182.0) - - FlipperKit/FlipperKitNetworkPlugin (= 0.182.0) - - FlipperKit/FlipperKitReactPlugin (= 0.182.0) - - FlipperKit/FlipperKitUserDefaultsPlugin (= 0.182.0) - - FlipperKit/SKIOSNetworkPlugin (= 0.182.0) - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) - GoogleUtilities - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) - "indy-vdr (from `../node_modules/@hyperledger/indy-vdr-react-native`)" - libevent (~> 2.1.12) - - OpenSSL-Universal (= 1.1.1100) - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) @@ -755,7 +675,6 @@ DEPENDENCIES: - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) - React-Codegen (from `build/generated/ios`) - React-Core (from `../node_modules/react-native/`) - - React-Core/DevSupport (from `../node_modules/react-native/`) - React-Core/RCTWebSocket (from `../node_modules/react-native/`) - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) @@ -806,6 +725,7 @@ DEPENDENCIES: - RNPermissions (from `../node_modules/react-native-permissions`) - RNReanimated (from `../node_modules/react-native-reanimated`) - RNScreens (from `../node_modules/react-native-screens`) + - RNSecureRandom (from `../node_modules/react-native-securerandom`) - RNShare (from `../node_modules/react-native-share`) - RNSVG (from `../node_modules/react-native-svg`) - RNVectorIcons (from `../node_modules/react-native-vector-icons`) @@ -822,24 +742,14 @@ SPEC REPOS: - FirebaseCoreInternal - FirebaseInstallations - FirebaseMessaging - - Flipper - - Flipper-Boost-iOSX - - Flipper-DoubleConversion - - Flipper-Fmt - - Flipper-Folly - - Flipper-Glog - - Flipper-PeerTalk - - FlipperKit - fmt - GoogleAppMeasurement - GoogleDataTransport - GoogleUtilities - libevent - nanopb - - OpenSSL-Universal - PromisesObjC - SocketRocket - - YogaKit EXTERNAL SOURCES: anoncreds: @@ -973,6 +883,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-reanimated" RNScreens: :path: "../node_modules/react-native-screens" + RNSecureRandom: + :path: "../node_modules/react-native-securerandom" RNShare: :path: "../node_modules/react-native-share" RNSVG: @@ -983,8 +895,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/yoga" SPEC CHECKSUMS: - anoncreds: 8e6ab626d5250ae6301c3e96d6fc739186e083f0 - aries-askar: 738c677e194913ed3c256adc953db3fe0494f8f8 + anoncreds: ded0f63df11448ade577836092a8a3e5574dd1d8 + aries-askar: c87454db9e0fab377f26ac15dcf6356ad7014f90 boost: 57d2868c099736d80fcd648bf211b4431e51a558 CatCrypto: a477899b6be4954e75be4897e732da098cc0a5a8 CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 @@ -998,24 +910,15 @@ SPEC CHECKSUMS: FirebaseCoreInternal: 2f4bee5ed00301b5e56da0849268797a2dd31fb4 FirebaseInstallations: cae95cab0f965ce05b805189de1d4c70b11c76fb FirebaseMessaging: 1077a4499f0c0a140b9a2e34fe08a1acc806b36d - Flipper: 6edb735e6c3e332975d1b17956bcc584eccf5818 - Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c - Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30 - Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b - Flipper-Folly: 584845625005ff068a6ebf41f857f468decd26b3 - Flipper-Glog: 70c50ce58ddaf67dc35180db05f191692570f446 - Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 - FlipperKit: 2efad7007d6745a3f95e4034d547be637f89d3f6 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b GoogleAppMeasurement: 7fee012a868315d418f365fbc8d394d8e020e749 GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2 GoogleUtilities: 13e2c67ede716b8741c7989e26893d151b2b2084 hermes-engine: 10fbd3f62405c41ea07e71973ea61e1878d07322 - indy-vdr: 85cd66089f151256581323440e78988891f4082e + indy-vdr: 8c58240b94429aab779413626ed4793561e22a24 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431 - OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4 RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1 RCTRequired: a2faf4bad4e438ca37b2040cb8f7799baa065c18 @@ -1073,13 +976,13 @@ SPEC CHECKSUMS: RNPermissions: f5763a7aa5b1aae3b0c0546791b002e3048042bd RNReanimated: 53ca20eee770c41173703f5948cd8898aa08262c RNScreens: 6a8a3c6b808aa48dca1780df7b73ea524f602c63 + RNSecureRandom: 07efbdf2cd99efe13497433668e54acd7df49fef RNShare: bed7c4fbe615f3d977f22feb0902af9a790c1660 RNSVG: 80584470ff1ffc7994923ea135a3e5ad825546b9 RNVectorIcons: 8b5bb0fa61d54cd2020af4f24a51841ce365c7e9 SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Yoga: 8796b55dba14d7004f980b54bcc9833ee45b28ce - YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: c701686bcda8cdefea2f6655d5b3b865e3e3a8c6 +PODFILE CHECKSUM: c4f2b64f733d5092ed97bf9c8913baae9338ea31 -COCOAPODS: 1.14.2 +COCOAPODS: 1.15.2