Skip to content

Commit

Permalink
Merge develop to main (#150)
Browse files Browse the repository at this point in the history
* fix: close contact modal after deletion (#141)

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* fix: import wallet failure scenario (#142)

* fix: import wallet failure scenario

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* fix: connection already exists

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* chore: bump ios version

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

---------

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* fix: scanning qrcode multiple times (#143)

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* feat/social-share certificate (#144)

Co-authored-by: Sai Ranjit Tummalapalli <[email protected]>
Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* feat: deeplink with universal link (#145)

* feat: add agent link as deep link

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* chore: bump iOS version

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

---------

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* fix deep link issue (#147)

* feat: add agent link as deep link

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* chore: bump iOS version

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* chore: bump versions

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

---------

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* feat: add remote verification templates (#148)

* feat: add remote verification templates

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* chore: bump versions

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

* fix: verifier capability for previous version

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

---------

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

---------

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>
Co-authored-by: poonam-ghewande <[email protected]>
  • Loading branch information
sairanjit and poonam-ghewande committed Nov 27, 2023
1 parent 10d283a commit e9945c2
Show file tree
Hide file tree
Showing 41 changed files with 784 additions and 333 deletions.
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ OCA_URL=https://raw.githubusercontent.com/credebl/credebl-aries-oca-bundles/rele

#BASE_URL
PUBLIC_ORG=https://example.com

#PROOF_TEMPLATE_URL
PROOF_TEMPLATE_URL=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ local.properties
.cxx/
*.keystore
!debug.keystore
*.aab

# node.js
#
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ android {
applicationId "id.credebl.adeya"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 4
versionName "1.0.1"
versionCode 8
versionName "1.0.5"

missingDimensionStrategy 'react-native-camera', 'general'
}
Expand Down
106 changes: 66 additions & 40 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,42 +1,68 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="id.credebl.adeya"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.USE_BIOMETRICS" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission-sdk-23 android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
</queries>

<application android:name=".MainApplication" android:label="@string/app_name"
android:icon="@mipmap/ic_launcher" android:allowBackup="false" android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
android:requestLegacyExternalStorage="true">
<activity android:name=".MainActivity" android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask" android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait" android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="didcomm" />
<data android:scheme="adeyawallet" />
</intent-filter>
</activity>
</application>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="id.credebl.adeya"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.USE_BIOMETRICS" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />

<uses-permission-sdk-23 android:name="android.permission.VIBRATE" />

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
</queries>

<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
android:requestLegacyExternalStorage="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="didcomm" />
<data android:scheme="adeyawallet" />
</intent-filter>

<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="https" />

<data android:host="agent.credebl.id" />
</intent-filter>

</activity>
</application>
</manifest>

2 changes: 1 addition & 1 deletion app/api/Organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const fetchOrganizationData = async ({ pageNumber, pageSize, searchText }
} catch (error) {
Toast.show({
type: ToastType.Error,
text1: searchText ? 'Searching organizatio failed' : 'Fetching organizations failed',
text1: searchText ? 'Searching organizations failed' : 'Fetching organizations failed',
})
}
}
Expand Down
1 change: 1 addition & 0 deletions app/api/api-constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const ORG_PROFILE = '/orgs/public-profile'
export const ORG_DETAILS = '/orgs/public-profiles/'
export const USER_CERTIFICATE = '/users/certificate'
export const PAGE_SIZE = 20
3 changes: 2 additions & 1 deletion app/contexts/configuration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface ConfigurationContext {
credentialEmptyList: React.FC<EmptyListProps>
developer: React.FC
OCABundleResolver: OCABundleResolverType
proofTemplateBaseUrl?: string
scan: React.FC<ScanProps>
useBiometry: React.FC
record: React.FC<RecordProps>
Expand All @@ -39,7 +40,7 @@ export interface ConfigurationContext {
useCustomNotifications: () => { total: number; notifications: any }
connectionTimerDelay?: number
autoRedirectConnectionToHome?: boolean
proofRequestTemplates?: Array<ProofRequestTemplate>
proofRequestTemplates?: () => Array<ProofRequestTemplate>
enableTours?: boolean
enableWalletNaming?: boolean
enableBackupWallet?: boolean
Expand Down
2 changes: 1 addition & 1 deletion app/contexts/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const defaultState: State = {
developerModeEnabled: false,
biometryPreferencesUpdated: false,
useBiometry: false,
useVerifierCapability: false,
useVerifierCapability: true,
useConnectionInviterCapability: false,
useDevVerifierTemplates: false,
walletName: generateRandomWalletName(),
Expand Down
5 changes: 3 additions & 2 deletions app/defaultConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BrandingOverlayType, RemoteOCABundleResolver } from '@hyperledger/aries
import { Config } from 'react-native-config'

import defaultIndyLedgers from '../configs/ledgers/indy'
import { defaultProofRequestTemplates } from '../verifier'
import { useProofRequestTemplates } from '../verifier'

import EmptyList from './components/misc/EmptyList'
import Record from './components/record/Record'
Expand Down Expand Up @@ -30,6 +30,7 @@ export const defaultConfiguration: ConfigurationContext = {
brandingOverlayType: BrandingOverlayType.Branding10,
preLoad: true,
}),
proofTemplateBaseUrl: Config.PROOF_TEMPLATE_URL ?? '',
scan: Scan,
useBiometry: UseBiometry,
record: Record,
Expand All @@ -45,7 +46,7 @@ export const defaultConfiguration: ConfigurationContext = {
pageTitle: '',
},
useCustomNotifications: useNotifications,
proofRequestTemplates: defaultProofRequestTemplates,
proofRequestTemplates: useProofRequestTemplates,
enableTours: false,
enableWalletNaming: true,
enableBackupWallet: true,
Expand Down
32 changes: 27 additions & 5 deletions app/hooks/proof-request-templates.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
import { useMemo } from 'react'
import { useEffect, useState } from 'react'

import { ProofRequestTemplate } from '../../verifier'
import { useConfiguration } from '../contexts/configuration'
import { applyTemplateMarkers, useRemoteProofBundleResolver } from '../utils/proofBundle'

export const useTemplates = (): Array<ProofRequestTemplate> => {
const { proofRequestTemplates } = useConfiguration()
return proofRequestTemplates || []
const [proofRequestTemplates, setProofRequestTemplates] = useState<ProofRequestTemplate[]>([])
const { proofTemplateBaseUrl } = useConfiguration()
const resolver = useRemoteProofBundleResolver(proofTemplateBaseUrl)
const acceptDevCredentials = false
useEffect(() => {
resolver.resolve(acceptDevCredentials).then(templates => {
if (templates) {
setProofRequestTemplates(applyTemplateMarkers(templates))
}
})
}, [])
return proofRequestTemplates
}

export const useTemplate = (templateId: string): ProofRequestTemplate | undefined => {
const { proofRequestTemplates } = useConfiguration()
return useMemo(() => proofRequestTemplates?.find(template => template.id === templateId), [templateId])
const [proofRequestTemplate, setProofRequestTemplate] = useState<ProofRequestTemplate | undefined>(undefined)
const { proofTemplateBaseUrl } = useConfiguration()
const resolver = useRemoteProofBundleResolver(proofTemplateBaseUrl)
const acceptDevCredentials = false

useEffect(() => {
resolver.resolveById(templateId, acceptDevCredentials).then(template => {
if (template) {
setProofRequestTemplate(applyTemplateMarkers(template))
}
})
}, [])
return proofRequestTemplate
}
1 change: 1 addition & 0 deletions app/localization/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ const translation = {
"PeopleAndOrganizations": "People and organizations you've interacted with are listed here.",
"WhatAreContacts": "What are Contacts",
"AddContact": "Add Contact",
"AlreadyConnected": "You have already accepted this invitation.",
},
"Organizations": {
"EmptyOrganizationsList": "No matching organization found. Please refine your search.",
Expand Down
20 changes: 17 additions & 3 deletions app/navigators/RootStack.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { deleteConnectionById, ProofState, useProofByState } from '@adeya/ssi'
import { deleteConnectionRecordById, ProofState, useProofByState } from '@adeya/ssi'
import { useNavigation } from '@react-navigation/core'
import { createStackNavigator, StackCardStyleInterpolator, StackNavigationProp } from '@react-navigation/stack'
import React, { useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { AppState } from 'react-native'
import Toast from 'react-native-toast-message'

import { ProofCustomMetadata, ProofMetadata } from '../../verifier'
import { ToastType } from '../components/toast/BaseToast'
import { walletTimeout } from '../constants'
import { useAuth } from '../contexts/auth'
import { useConfiguration } from '../contexts/configuration'
Expand All @@ -24,7 +26,7 @@ import PINCreate from '../screens/PINCreate'
import PINEnter from '../screens/PINEnter'
import { AuthenticateStackParams, Screens, Stacks } from '../types/navigators'
import { useAppAgent } from '../utils/agent'
import { connectFromInvitation, getOobDeepLink } from '../utils/helpers'
import { checkIfAlreadyConnected, connectFromInvitation, getOobDeepLink } from '../utils/helpers'
import { testIdWithKey } from '../utils/testable'

import ConnectStack from './ConnectStack'
Expand Down Expand Up @@ -58,7 +60,8 @@ const RootStack: React.FC = () => {
declinedProofs.forEach(proof => {
const meta = proof?.metadata?.get(ProofMetadata.customMetadata) as ProofCustomMetadata
if (meta?.delete_conn_after_seen) {
deleteConnectionById(agent, proof?.connectionId ?? '').catch(() => {})
deleteConnectionRecordById(agent, proof?.connectionId ?? '').catch(() => {})

proof?.metadata.set(ProofMetadata.customMetadata, { ...meta, delete_conn_after_seen: false })
}
})
Expand All @@ -85,6 +88,17 @@ const RootStack: React.FC = () => {
useEffect(() => {
async function handleDeepLink(deepLink: string) {
try {
// check if connection already exists
const isAlreadyConnected = await checkIfAlreadyConnected(agent, deepLink)

if (isAlreadyConnected) {
Toast.show({
type: ToastType.Warn,
text1: t('Contacts.AlreadyConnected'),
})
return
}

// Try connection based
const { connectionRecord } = await connectFromInvitation(agent, deepLink)
navigation.navigate(Stacks.ConnectionStack as any, {
Expand Down
Loading

0 comments on commit e9945c2

Please sign in to comment.