From b709b0e0b0e5234d3bd8d557237ec739f946a2dd Mon Sep 17 00:00:00 2001 From: Timo Glastra Date: Mon, 24 Jun 2024 15:46:19 +0200 Subject: [PATCH] chore: cleanup (#112) Signed-off-by: Timo Glastra --- .github/workflows/continuous-integration.yaml | 9 +-- README.md | 10 +-- apps/funke/app/_layout.tsx | 23 +++---- apps/funke/app/index.tsx | 2 +- apps/funke/app/utils/index.ts | 1 - apps/paradym/app/_layout.tsx | 16 ++--- apps/paradym/app/index.tsx | 2 +- apps/paradym/app/utils/DeeplinkHandler.tsx | 69 ------------------- apps/paradym/app/utils/index.ts | 1 - package.json | 8 +-- packages/agent/src/didcomm/metadata.ts | 2 +- packages/agent/src/display.ts | 6 +- packages/agent/src/fixtures/dbcCredential.ts | 2 +- .../src/hooks/useDidCommCredentialActions.ts | 4 +- .../hooks/useDidCommPresentationActions.ts | 2 +- .../agent/src/hooks/useInboxNotifications.ts | 2 +- packages/agent/src/invitation/handler.ts | 28 ++++---- packages/agent/src/openid4vc/metadata.ts | 2 +- .../agent/src/providers/SdJwtVcsProvider.tsx | 4 +- .../src/providers/W3cCredentialsProvider.tsx | 4 +- .../src/components/CredentialAttributes.tsx | 2 +- .../app/src/components/CredentialCard.tsx | 2 +- .../src/components/DualResponseButtons.tsx | 2 +- packages/app/src/components/InboxIcon.tsx | 2 +- .../app/src/components/NoContentInbox.tsx | 2 +- .../app/src/components/NoContentWallet.tsx | 2 +- .../credentials/CredentialDetailScreen.tsx | 2 +- .../DidCommCredentialNotificationScreen.tsx | 2 +- .../DidCommPresentationNotificationScreen.tsx | 2 +- .../notifications/NotificationInboxScreen.tsx | 2 +- .../OpenIdCredentialNotificationScreen.tsx | 4 +- .../OpenIdPresentationNotificationScreen.tsx | 2 +- .../CredentialNotificationScreen.tsx | 2 +- .../PresentationNotificationScreen.tsx | 4 +- packages/app/src/features/scan/ScanScreen.tsx | 2 +- .../app/src/features/wallet/WalletScreen.tsx | 2 +- packages/app/src/hooks/index.ts | 1 + packages/app/src/hooks/useFonts.ts | 14 ++++ .../app/src/hooks/useScrollViewPosition.tsx | 2 +- .../app/src}/utils/DeeplinkHandler.tsx | 2 +- packages/app/src/utils/index.ts | 1 + packages/app/src/utils/unmatched.ts | 2 +- packages/scanner/src/Scanner.tsx | 4 +- packages/ui/src/base/Headings.tsx | 2 +- packages/ui/src/config/tamagui.config.ts | 4 +- packages/ui/src/table/TableRow.tsx | 2 +- 46 files changed, 98 insertions(+), 169 deletions(-) delete mode 100644 apps/funke/app/utils/index.ts delete mode 100644 apps/paradym/app/utils/DeeplinkHandler.tsx delete mode 100644 apps/paradym/app/utils/index.ts create mode 100644 packages/app/src/hooks/useFonts.ts rename {apps/funke/app => packages/app/src}/utils/DeeplinkHandler.tsx (100%) diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 8268c2b7..4a821638 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -31,11 +31,8 @@ jobs: - name: Compile run: pnpm build - - name: Linting - run: pnpm lint - - - name: Formatting - run: pnpm format + - name: Check Style + run: pnpm style:check - name: Check Types - run: pnpm check-types + run: pnpm types:check diff --git a/README.md b/README.md index e5708d8d..e3bf508e 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,8 @@ The project is a monorepo managed using **pnpm**, which contains an **Expo React The folder structure is as follows - `apps` top level applications - - `expo` react native app for iOS & Android + - `paradym` Paradym Wallet - react native app for iOS & Android + - `funke` Funke Wallet - react native app for iOS & Android - `packages` shared packages - `ui` includes our custom UI kit that will be optimized by Tamagui - `agent` includes the Aries Framework JavaScript (AFJ) agent and SSI capabilities @@ -44,15 +45,15 @@ The folder structure is as follows You can add other folders inside of `packages/` if you know what you're doing and have a good reason to. -## 🏁 Start the Paradym wallet +## 🏁 Start a wallet First, start by installing all dependencies by running `pnpm install`. Once all dependencies are installed, you need to make sure you have a development build of the app on your mobile device. You can install this using the following commands: -``` -cd apps/paradym +```sh +cd apps/paradym # or apps/funke pnpm prebuild pnpm ios # or android ``` @@ -65,7 +66,6 @@ Once installed you can run `pnpm start` from the root of the project to start yo 🚧 Soon documentation will be added on how to publish a new release to the Apple App Store and Google Play Stores. 🚧 - ## 🆕 Add new dependencies ### Pure JS dependencies diff --git a/apps/funke/app/_layout.tsx b/apps/funke/app/_layout.tsx index 835f9432..cac8a003 100644 --- a/apps/funke/app/_layout.tsx +++ b/apps/funke/app/_layout.tsx @@ -1,18 +1,22 @@ import type { OpenId4VcHolderAppAgent } from '@package/agent' import { AgentProvider } from '@package/agent' -import { useTransparentNavigationBar, Provider, NoInternetToastProvider, isAndroid } from '@package/app' +import { + DeeplinkHandler, + NoInternetToastProvider, + Provider, + isAndroid, + useFonts, + useTransparentNavigationBar, +} from '@package/app' import { Heading, Page, Paragraph, XStack, YStack, config, useToastController } from '@package/ui' import { getSecureWalletKey } from '@package/utils' import { DefaultTheme, ThemeProvider } from '@react-navigation/native' -import { useFonts } from 'expo-font' import { Stack } from 'expo-router' import * as SplashScreen from 'expo-splash-screen' import { useEffect, useState } from 'react' import { useSafeAreaInsets } from 'react-native-safe-area-context' -import { DeeplinkHandler } from './utils' - import { initializeAppAgent } from '.' void SplashScreen.preventAutoHideAsync() @@ -23,16 +27,7 @@ export const unstable_settings = { } export default function HomeLayout() { - const [fontLoaded] = useFonts({ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - InterRegular: require('@tamagui/font-inter/otf/Inter-Regular.otf'), - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - Inter: require('@tamagui/font-inter/otf/Inter-Medium.otf'), - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - InterSemiBold: require('@tamagui/font-inter/otf/Inter-SemiBold.otf'), - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - InterBold: require('@tamagui/font-inter/otf/Inter-Bold.otf'), - }) + const [fontLoaded] = useFonts() const [agent, setAgent] = useState() const [agentInitializationFailed, setAgentInitializationFailed] = useState(false) diff --git a/apps/funke/app/index.tsx b/apps/funke/app/index.tsx index 25bee1c9..53f1cd73 100644 --- a/apps/funke/app/index.tsx +++ b/apps/funke/app/index.tsx @@ -1,8 +1,8 @@ import type { OpenId4VcHolderAppAgent } from '@package/agent' import { initializeOpenId4VcHolderAgent, useAgent } from '@package/agent' -import { XStack } from '@package/ui' import { WalletScreen } from '@package/app' +import { XStack } from '@package/ui' import { Stack } from 'expo-router' import { useSafeAreaInsets } from 'react-native-safe-area-context' diff --git a/apps/funke/app/utils/index.ts b/apps/funke/app/utils/index.ts deleted file mode 100644 index 88a9b027..00000000 --- a/apps/funke/app/utils/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './DeeplinkHandler' diff --git a/apps/paradym/app/_layout.tsx b/apps/paradym/app/_layout.tsx index d1f24b75..5411aee7 100644 --- a/apps/paradym/app/_layout.tsx +++ b/apps/paradym/app/_layout.tsx @@ -1,18 +1,13 @@ import type { FullAppAgent } from '@package/agent' +import { AgentProvider, hasMediationConfigured, setupMediationWithDid, useMessagePickup } from '@package/agent' import { - AgentProvider, - hasMediationConfigured, - initializeFullAgent, - setupMediationWithDid, - useMessagePickup, -} from '@package/agent' -import { - useHasInternetConnection, - useTransparentNavigationBar, - Provider, + DeeplinkHandler, NoInternetToastProvider, + Provider, isAndroid, + useHasInternetConnection, + useTransparentNavigationBar, } from '@package/app' import { Heading, Page, Paragraph, XStack, YStack, config, useToastController } from '@package/ui' import { getSecureWalletKey } from '@package/utils' @@ -25,7 +20,6 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context' import { initializeAppAgent } from '.' import { mediatorDid } from './constants' -import { DeeplinkHandler } from './utils' void SplashScreen.preventAutoHideAsync() diff --git a/apps/paradym/app/index.tsx b/apps/paradym/app/index.tsx index ea2b52e6..2299a43e 100644 --- a/apps/paradym/app/index.tsx +++ b/apps/paradym/app/index.tsx @@ -1,8 +1,8 @@ import type { FullAppAgent } from '@package/agent' import { initializeFullAgent, useAgent } from '@package/agent' -import { XStack } from '@package/ui' import { WalletScreen } from '@package/app' +import { XStack } from '@package/ui' import { Stack } from 'expo-router' import { useSafeAreaInsets } from 'react-native-safe-area-context' diff --git a/apps/paradym/app/utils/DeeplinkHandler.tsx b/apps/paradym/app/utils/DeeplinkHandler.tsx deleted file mode 100644 index dde78b8d..00000000 --- a/apps/paradym/app/utils/DeeplinkHandler.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import { useCallback } from 'react' -import type { ReactNode } from 'react' - -import { InvitationQrTypes } from '@package/agent' -import { useToastController } from '@package/ui' -import { CommonActions } from '@react-navigation/native' -import { useCredentialDataHandler } from '@package/app' -import * as Linking from 'expo-linking' -import { useNavigation } from 'expo-router' -import { useEffect, useState } from 'react' - -interface DeeplinkHandlerProps { - children: ReactNode -} - -const deeplinkSchemes = Object.values(InvitationQrTypes) - -export const DeeplinkHandler = ({ children }: DeeplinkHandlerProps) => { - const { handleCredentialData } = useCredentialDataHandler() - const toast = useToastController() - const navigation = useNavigation() - - // TODO: I'm not sure if we need this? Or whether an useEffect without any deps is enough? - const [hasHandledInitialUrl, setHasHandledInitialUrl] = useState(false) - - const handleUrl = useCallback( - (url: string) => { - const isRecognizedDeeplink = deeplinkSchemes.some((scheme) => url.startsWith(scheme)) - - // Whenever a deeplink comes in, we reset the state. This is due to expo - // routing us always and we can't intercept that. It seems they are working on - // more control, but for now this is the cleanest approach - navigation.dispatch( - CommonActions.reset({ - routes: [{ key: 'index', name: 'index' }], - }) - ) - - // Ignore deeplinks that don't start with the schemes for credentials - if (isRecognizedDeeplink) { - void handleCredentialData(url).then((result) => { - if (!result.success) { - toast.show(result.error) - } - }) - } - }, - [navigation.dispatch, toast.show, handleCredentialData] - ) - - // NOTE: we use getInitialURL and the event listener over useURL as we don't know - // using that method whether the same url is opened multiple times. As we need to make - // sure to handle ALL incoming deeplinks (to prevent default expo-router behaviour) we - // handle them ourselves. On startup getInitialUrl will be called once. - useEffect(() => { - if (hasHandledInitialUrl) return - void Linking.getInitialURL().then((url) => { - if (url) handleUrl(url) - setHasHandledInitialUrl(true) - }) - }, [hasHandledInitialUrl, handleUrl]) - - useEffect(() => { - const eventListener = Linking.addEventListener('url', (event) => handleUrl(event.url)) - return () => eventListener.remove() - }, [handleUrl]) - - return <>{children} -} diff --git a/apps/paradym/app/utils/index.ts b/apps/paradym/app/utils/index.ts deleted file mode 100644 index 88a9b027..00000000 --- a/apps/paradym/app/utils/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './DeeplinkHandler' diff --git a/package.json b/package.json index 7bdc47ef..29297762 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,9 @@ "upgrade:tamagui:canary": "pnpm up '*tamagui*'@canary '@tamagui/*'@canary", "deps:check": "check-dependency-version-consistency .", "deps:fix": "pnpm deps:check --fix", - "check-types": "tsc --noEmit", - "lint": "biome lint .", - "lint:fix": "pnpm lint --write --unsafe", - "format": "biome format .", - "format:fix": "pnpm format --fix" + "types:check": "tsc --noEmit", + "style:check": "biome check --unsafe", + "style:fix": "biome check --write --unsafe" }, "engines": { "node": ">=18.0.0" diff --git a/packages/agent/src/didcomm/metadata.ts b/packages/agent/src/didcomm/metadata.ts index bb760346..ef8b505a 100644 --- a/packages/agent/src/didcomm/metadata.ts +++ b/packages/agent/src/didcomm/metadata.ts @@ -1,5 +1,5 @@ -import type { OpenId4VcCredentialMetadata } from '../openid4vc/metadata' import type { CredentialExchangeRecord, ProofExchangeRecord } from '@credo-ts/core' +import type { OpenId4VcCredentialMetadata } from '../openid4vc/metadata' export interface DidCommCredentialExchangeDisplayMetadata { issuerName?: string diff --git a/packages/agent/src/display.ts b/packages/agent/src/display.ts index c572def3..a9bddebb 100644 --- a/packages/agent/src/display.ts +++ b/packages/agent/src/display.ts @@ -1,10 +1,10 @@ +import type { W3cCredentialRecord } from '@credo-ts/core' import type { CredentialForDisplayId } from './hooks' import type { OpenId4VcCredentialMetadata } from './openid4vc/metadata' import type { W3cCredentialJson, W3cIssuerJson } from './types' -import type { W3cCredentialRecord } from '@credo-ts/core' -import { Hasher, SdJwtVcRecord, ClaimFormat, JsonTransformer } from '@credo-ts/core' -import { sanitizeString, getHostNameFromUrl } from '@package/utils' +import { ClaimFormat, Hasher, JsonTransformer, SdJwtVcRecord } from '@credo-ts/core' +import { getHostNameFromUrl, sanitizeString } from '@package/utils' import { decodeSdJwtSync, getClaimsSync } from '@sd-jwt/decode' import { getOpenId4VcCredentialMetadata } from './openid4vc/metadata' diff --git a/packages/agent/src/fixtures/dbcCredential.ts b/packages/agent/src/fixtures/dbcCredential.ts index 57b5bb16..e06cd575 100644 --- a/packages/agent/src/fixtures/dbcCredential.ts +++ b/packages/agent/src/fixtures/dbcCredential.ts @@ -1,5 +1,5 @@ -import type { FullAppAgent } from '../agent' import type { JwkDidCreateOptions } from '@credo-ts/core' +import type { FullAppAgent } from '../agent' import { KeyType, TypedArrayEncoder, W3cJwtVerifiableCredential } from '@credo-ts/core' diff --git a/packages/agent/src/hooks/useDidCommCredentialActions.ts b/packages/agent/src/hooks/useDidCommCredentialActions.ts index b112e6ed..56d56046 100644 --- a/packages/agent/src/hooks/useDidCommCredentialActions.ts +++ b/packages/agent/src/hooks/useDidCommCredentialActions.ts @@ -1,6 +1,6 @@ import type { CredentialStateChangedEvent } from '@credo-ts/core' -import { W3cCredentialRepository, CredentialState, CredentialEventTypes } from '@credo-ts/core' +import { CredentialEventTypes, CredentialState, W3cCredentialRepository } from '@credo-ts/core' import { useCredentialById } from '@credo-ts/react-hooks' import { useMutation, useQuery } from '@tanstack/react-query' import { firstValueFrom } from 'rxjs' @@ -8,8 +8,8 @@ import { filter, first, timeout } from 'rxjs/operators' import { useAgent } from '../agent' import { - openIdCredentialMetadataFromDidCommCredentialExchangeMetadata, getDidCommCredentialExchangeDisplayMetadata, + openIdCredentialMetadataFromDidCommCredentialExchangeMetadata, } from '../didcomm/metadata' import { setOpenId4VcCredentialMetadata } from '../openid4vc/metadata' diff --git a/packages/agent/src/hooks/useDidCommPresentationActions.ts b/packages/agent/src/hooks/useDidCommPresentationActions.ts index f712d33e..1331ffaf 100644 --- a/packages/agent/src/hooks/useDidCommPresentationActions.ts +++ b/packages/agent/src/hooks/useDidCommPresentationActions.ts @@ -1,4 +1,3 @@ -import type { FormattedSubmission } from '../format/formatPresentation' import type { AnonCredsPredicateType, AnonCredsRequestedAttributeMatch, @@ -6,6 +5,7 @@ import type { AnonCredsRequestedPredicateMatch, } from '@credo-ts/anoncreds' import type { ProofStateChangedEvent } from '@credo-ts/core' +import type { FormattedSubmission } from '../format/formatPresentation' import { CredentialRepository, CredoError, ProofEventTypes, ProofState } from '@credo-ts/core' import { useConnectionById, useProofById } from '@credo-ts/react-hooks' diff --git a/packages/agent/src/hooks/useInboxNotifications.ts b/packages/agent/src/hooks/useInboxNotifications.ts index cbf39342..16eb9c3f 100644 --- a/packages/agent/src/hooks/useInboxNotifications.ts +++ b/packages/agent/src/hooks/useInboxNotifications.ts @@ -1,6 +1,6 @@ import { CredentialState, ProofState } from '@credo-ts/core' import { useConnections, useCredentialByState, useProofByState } from '@credo-ts/react-hooks' -import { useMemo, useEffect } from 'react' +import { useEffect, useMemo } from 'react' import { useAgent } from '../agent' import { diff --git a/packages/agent/src/invitation/handler.ts b/packages/agent/src/invitation/handler.ts index 8402a5ce..bdc7b528 100644 --- a/packages/agent/src/invitation/handler.ts +++ b/packages/agent/src/invitation/handler.ts @@ -1,44 +1,44 @@ -import type { FullAppAgent } from '../agent' import type { ConnectionRecord, CredentialStateChangedEvent, + DifPexCredentialsForRequest, JwkDidCreateOptions, KeyDidCreateOptions, OutOfBandInvitation, OutOfBandRecord, ProofStateChangedEvent, - DifPexCredentialsForRequest, } from '@credo-ts/core' import type { PlaintextMessage } from '@credo-ts/core/build/types' import type { - OpenId4VciCredentialSupportedWithId, OpenId4VcSiopVerifiedAuthorizationRequest, + OpenId4VciCredentialSupportedWithId, } from '@credo-ts/openid4vc' +import type { FullAppAgent } from '../agent' import { V1OfferCredentialMessage, V1RequestPresentationMessage } from '@credo-ts/anoncreds' import { - DifPresentationExchangeService, - SdJwtVcRecord, - SdJwtVcRepository, - W3cCredentialRecord, - W3cCredentialRepository, - getJwkFromKey, CredentialEventTypes, CredentialState, + DidJwk, + DidKey, + DifPresentationExchangeService, + JwaSignatureAlgorithm, OutOfBandRepository, - parseMessageType, ProofEventTypes, ProofState, + SdJwtVcRecord, + SdJwtVcRepository, V2OfferCredentialMessage, V2RequestPresentationMessage, - DidJwk, - DidKey, - JwaSignatureAlgorithm, + W3cCredentialRecord, + W3cCredentialRepository, + getJwkFromKey, + parseMessageType, } from '@credo-ts/core' import { supportsIncomingMessageType } from '@credo-ts/core/build/utils/messageType' import { OpenId4VciCredentialFormatProfile } from '@credo-ts/openid4vc' import { getHostNameFromUrl } from '@package/utils' -import { filter, firstValueFrom, merge, first, timeout } from 'rxjs' +import { filter, first, firstValueFrom, merge, timeout } from 'rxjs' import { extractOpenId4VcCredentialMetadata, setOpenId4VcCredentialMetadata } from '../openid4vc/metadata' diff --git a/packages/agent/src/openid4vc/metadata.ts b/packages/agent/src/openid4vc/metadata.ts index e2e3301c..093f6df0 100644 --- a/packages/agent/src/openid4vc/metadata.ts +++ b/packages/agent/src/openid4vc/metadata.ts @@ -1,4 +1,4 @@ -import type { W3cCredentialRecord, SdJwtVcRecord } from '@credo-ts/core' +import type { SdJwtVcRecord, W3cCredentialRecord } from '@credo-ts/core' import type { OpenId4VciCredentialSupported, OpenId4VciIssuerMetadataDisplay } from '@credo-ts/openid4vc' import type { EndpointMetadataResult } from '@sphereon/oid4vci-common' diff --git a/packages/agent/src/providers/SdJwtVcsProvider.tsx b/packages/agent/src/providers/SdJwtVcsProvider.tsx index af6797a7..5d7eb65d 100644 --- a/packages/agent/src/providers/SdJwtVcsProvider.tsx +++ b/packages/agent/src/providers/SdJwtVcsProvider.tsx @@ -1,9 +1,9 @@ -import type { FullAppAgent } from '../agent' import type { PropsWithChildren } from 'react' +import type { FullAppAgent } from '../agent' import { SdJwtVcRecord } from '@credo-ts/core' import { recordsAddedByType, recordsRemovedByType, recordsUpdatedByType } from '@credo-ts/react-hooks/build/recordUtils' -import { useState, createContext, useContext, useEffect } from 'react' +import { createContext, useContext, useEffect, useState } from 'react' import type * as React from 'react' export { SdJwtVc, SdJwtVcRecord } from '@credo-ts/core' diff --git a/packages/agent/src/providers/W3cCredentialsProvider.tsx b/packages/agent/src/providers/W3cCredentialsProvider.tsx index 3614333d..625935f2 100644 --- a/packages/agent/src/providers/W3cCredentialsProvider.tsx +++ b/packages/agent/src/providers/W3cCredentialsProvider.tsx @@ -1,9 +1,9 @@ -import type { FullAppAgent } from '../agent' import type { PropsWithChildren } from 'react' +import type { FullAppAgent } from '../agent' import { W3cCredentialRecord } from '@credo-ts/core' import { recordsAddedByType, recordsRemovedByType, recordsUpdatedByType } from '@credo-ts/react-hooks/build/recordUtils' -import { useState, createContext, useContext, useEffect } from 'react' +import { createContext, useContext, useEffect, useState } from 'react' import type * as React from 'react' export { W3cCredentialRecord, W3cVerifiableCredential } from '@credo-ts/core' diff --git a/packages/app/src/components/CredentialAttributes.tsx b/packages/app/src/components/CredentialAttributes.tsx index a6eff064..8ce71780 100644 --- a/packages/app/src/components/CredentialAttributes.tsx +++ b/packages/app/src/components/CredentialAttributes.tsx @@ -1,4 +1,4 @@ -import { YStack, Paragraph, TableContainer, TableRow, CornerDownRight, XStack, Heading } from '@package/ui' +import { CornerDownRight, Heading, Paragraph, TableContainer, TableRow, XStack, YStack } from '@package/ui' import { formatCredentialSubject } from '../utils' diff --git a/packages/app/src/components/CredentialCard.tsx b/packages/app/src/components/CredentialCard.tsx index d7e684e6..e73f4b05 100644 --- a/packages/app/src/components/CredentialCard.tsx +++ b/packages/app/src/components/CredentialCard.tsx @@ -1,6 +1,6 @@ import type { DisplayImage } from '@package/agent' -import { XStack, YStack, Image, Paragraph, Heading, FileBadge, darken, getTextColorBasedOnBg, Card } from '@package/ui' +import { Card, FileBadge, Heading, Image, Paragraph, XStack, YStack, darken, getTextColorBasedOnBg } from '@package/ui' import { useHasInternetConnection } from '../hooks' diff --git a/packages/app/src/components/DualResponseButtons.tsx b/packages/app/src/components/DualResponseButtons.tsx index 6ff2f388..48c8193d 100644 --- a/packages/app/src/components/DualResponseButtons.tsx +++ b/packages/app/src/components/DualResponseButtons.tsx @@ -1,4 +1,4 @@ -import { YStack, Button, Spinner } from '@package/ui' +import { Button, Spinner, YStack } from '@package/ui' interface DualResponseButtonProps { isAccepting?: boolean diff --git a/packages/app/src/components/InboxIcon.tsx b/packages/app/src/components/InboxIcon.tsx index 44f5e6a4..e06cb076 100644 --- a/packages/app/src/components/InboxIcon.tsx +++ b/packages/app/src/components/InboxIcon.tsx @@ -1,5 +1,5 @@ import { useHasInboxNotifications } from '@package/agent' -import { XStack, Inbox } from '@package/ui' +import { Inbox, XStack } from '@package/ui' import React from 'react' import { TouchableOpacity } from 'react-native' import { useRouter } from 'solito/router' diff --git a/packages/app/src/components/NoContentInbox.tsx b/packages/app/src/components/NoContentInbox.tsx index 5c07f238..688824c0 100644 --- a/packages/app/src/components/NoContentInbox.tsx +++ b/packages/app/src/components/NoContentInbox.tsx @@ -1,4 +1,4 @@ -import { Paragraph, Button, Heading, YStack, Spacer } from '@package/ui' +import { Button, Heading, Paragraph, Spacer, YStack } from '@package/ui' import { useRouter } from 'solito/router' export function NoContentInbox() { diff --git a/packages/app/src/components/NoContentWallet.tsx b/packages/app/src/components/NoContentWallet.tsx index 5804d0f5..daaf4e37 100644 --- a/packages/app/src/components/NoContentWallet.tsx +++ b/packages/app/src/components/NoContentWallet.tsx @@ -1,4 +1,4 @@ -import { Paragraph, Button, Heading, YStack, Spacer } from '@package/ui' +import { Button, Heading, Paragraph, Spacer, YStack } from '@package/ui' import { useRouter } from 'solito/router' export function NoContentWallet() { diff --git a/packages/app/src/features/credentials/CredentialDetailScreen.tsx b/packages/app/src/features/credentials/CredentialDetailScreen.tsx index c6ba177f..5bf08164 100644 --- a/packages/app/src/features/credentials/CredentialDetailScreen.tsx +++ b/packages/app/src/features/credentials/CredentialDetailScreen.tsx @@ -1,7 +1,7 @@ import type { CredentialForDisplayId } from '@package/agent' import { useCredentialForDisplayById } from '@package/agent' -import { ScrollView, YStack, Spacer } from '@package/ui' +import { ScrollView, Spacer, YStack } from '@package/ui' import React from 'react' import { createParam } from 'solito' import { useRouter } from 'solito/router' diff --git a/packages/app/src/features/notifications/DidCommCredentialNotificationScreen.tsx b/packages/app/src/features/notifications/DidCommCredentialNotificationScreen.tsx index 3c0a3ae1..0d54a1d6 100644 --- a/packages/app/src/features/notifications/DidCommCredentialNotificationScreen.tsx +++ b/packages/app/src/features/notifications/DidCommCredentialNotificationScreen.tsx @@ -1,4 +1,4 @@ -import { useDidCommCredentialActions, useAgent } from '@package/agent' +import { useAgent, useDidCommCredentialActions } from '@package/agent' import { useToastController } from '@package/ui' import React from 'react' import { useRouter } from 'solito/router' diff --git a/packages/app/src/features/notifications/DidCommPresentationNotificationScreen.tsx b/packages/app/src/features/notifications/DidCommPresentationNotificationScreen.tsx index 223d4be5..6b4e4c19 100644 --- a/packages/app/src/features/notifications/DidCommPresentationNotificationScreen.tsx +++ b/packages/app/src/features/notifications/DidCommPresentationNotificationScreen.tsx @@ -1,4 +1,4 @@ -import { useDidCommPresentationActions, useAgent } from '@package/agent' +import { useAgent, useDidCommPresentationActions } from '@package/agent' import { useToastController } from '@package/ui' import React from 'react' import { useRouter } from 'solito/router' diff --git a/packages/app/src/features/notifications/NotificationInboxScreen.tsx b/packages/app/src/features/notifications/NotificationInboxScreen.tsx index 3a650745..3f1968e4 100644 --- a/packages/app/src/features/notifications/NotificationInboxScreen.tsx +++ b/packages/app/src/features/notifications/NotificationInboxScreen.tsx @@ -2,7 +2,7 @@ import { useInboxNotifications } from '@package/agent' import { ScrollView, YStack } from '@package/ui' import { useRouter } from 'solito/router' -import { NoContentInbox, InboxNotificationRowCard } from '../../components' +import { InboxNotificationRowCard, NoContentInbox } from '../../components' export function NotificationInboxScreen() { const inboxNotifications = useInboxNotifications() diff --git a/packages/app/src/features/notifications/OpenIdCredentialNotificationScreen.tsx b/packages/app/src/features/notifications/OpenIdCredentialNotificationScreen.tsx index c6e8c623..0274a14c 100644 --- a/packages/app/src/features/notifications/OpenIdCredentialNotificationScreen.tsx +++ b/packages/app/src/features/notifications/OpenIdCredentialNotificationScreen.tsx @@ -1,9 +1,9 @@ -import type { W3cCredentialRecord, SdJwtVcRecord } from '@package/agent' +import type { SdJwtVcRecord, W3cCredentialRecord } from '@package/agent' import { getCredentialForDisplay, - storeCredential, receiveCredentialFromOpenId4VciOffer, + storeCredential, useAgent, } from '@package/agent' import { useToastController } from '@package/ui' diff --git a/packages/app/src/features/notifications/OpenIdPresentationNotificationScreen.tsx b/packages/app/src/features/notifications/OpenIdPresentationNotificationScreen.tsx index 463089c4..08c1ef0c 100644 --- a/packages/app/src/features/notifications/OpenIdPresentationNotificationScreen.tsx +++ b/packages/app/src/features/notifications/OpenIdPresentationNotificationScreen.tsx @@ -1,4 +1,4 @@ -import { getCredentialsForProofRequest, shareProof, formatDifPexCredentialsForRequest, useAgent } from '@package/agent' +import { formatDifPexCredentialsForRequest, getCredentialsForProofRequest, shareProof, useAgent } from '@package/agent' import { useToastController } from '@package/ui' import React, { useEffect, useState, useMemo, useCallback } from 'react' import { createParam } from 'solito' diff --git a/packages/app/src/features/notifications/components/CredentialNotificationScreen.tsx b/packages/app/src/features/notifications/components/CredentialNotificationScreen.tsx index 359da408..4a625199 100644 --- a/packages/app/src/features/notifications/components/CredentialNotificationScreen.tsx +++ b/packages/app/src/features/notifications/components/CredentialNotificationScreen.tsx @@ -1,6 +1,6 @@ import type { CredentialDisplay } from '@package/agent' -import { YStack, Heading, ScrollView } from '@package/ui' +import { Heading, ScrollView, YStack } from '@package/ui' import React from 'react' import { useSafeAreaInsets } from 'react-native-safe-area-context' diff --git a/packages/app/src/features/notifications/components/PresentationNotificationScreen.tsx b/packages/app/src/features/notifications/components/PresentationNotificationScreen.tsx index 1a6836d0..15c01246 100644 --- a/packages/app/src/features/notifications/components/PresentationNotificationScreen.tsx +++ b/packages/app/src/features/notifications/components/PresentationNotificationScreen.tsx @@ -1,11 +1,11 @@ import type { FormattedSubmission } from '@package/agent' -import { YStack, Heading, Button, ScrollView, Paragraph } from '@package/ui' +import { Button, Heading, Paragraph, ScrollView, YStack } from '@package/ui' import { sanitizeString } from '@package/utils' import React from 'react' import { useSafeAreaInsets } from 'react-native-safe-area-context' -import { DualResponseButtons, CredentialRowCard } from '../../../components' +import { CredentialRowCard, DualResponseButtons } from '../../../components' interface PresentationNotificationScreenProps { submission: FormattedSubmission diff --git a/packages/app/src/features/scan/ScanScreen.tsx b/packages/app/src/features/scan/ScanScreen.tsx index e3734275..17cc8c06 100644 --- a/packages/app/src/features/scan/ScanScreen.tsx +++ b/packages/app/src/features/scan/ScanScreen.tsx @@ -1,5 +1,5 @@ import { QrScanner } from '@package/scanner' -import { Page, Spinner, Paragraph } from '@package/ui' +import { Page, Paragraph, Spinner } from '@package/ui' import { useIsFocused } from '@react-navigation/native' import React, { useState } from 'react' import { useRouter } from 'solito/router' diff --git a/packages/app/src/features/wallet/WalletScreen.tsx b/packages/app/src/features/wallet/WalletScreen.tsx index f39156c0..1b1027a4 100644 --- a/packages/app/src/features/wallet/WalletScreen.tsx +++ b/packages/app/src/features/wallet/WalletScreen.tsx @@ -20,7 +20,7 @@ import { import { useSafeAreaInsets } from 'react-native-safe-area-context' import { useRouter } from 'solito/router' -import { NoContentWallet, CredentialRowCard, CredentialCard, InboxIcon } from '../../components' +import { CredentialCard, CredentialRowCard, InboxIcon, NoContentWallet } from '../../components' import { useNetworkCallback, useScrollViewPosition } from '../../hooks' type WalletScreenProps = { diff --git a/packages/app/src/hooks/index.ts b/packages/app/src/hooks/index.ts index 7f1bcd38..99d29af4 100644 --- a/packages/app/src/hooks/index.ts +++ b/packages/app/src/hooks/index.ts @@ -3,3 +3,4 @@ export * from './useScrollViewPosition' export * from './useCredentialDataHandler' export * from './useHasInternetConnection' export * from './useTransparentNavigationBar' +export * from './useFonts' diff --git a/packages/app/src/hooks/useFonts.ts b/packages/app/src/hooks/useFonts.ts new file mode 100644 index 00000000..54366446 --- /dev/null +++ b/packages/app/src/hooks/useFonts.ts @@ -0,0 +1,14 @@ +import { useFonts as _useFonts } from 'expo-font' + +export function useFonts() { + return _useFonts({ + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + InterRegular: require('@tamagui/font-inter/otf/Inter-Regular.otf'), + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + Inter: require('@tamagui/font-inter/otf/Inter-Medium.otf'), + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + InterSemiBold: require('@tamagui/font-inter/otf/Inter-SemiBold.otf'), + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + InterBold: require('@tamagui/font-inter/otf/Inter-Bold.otf'), + }) +} diff --git a/packages/app/src/hooks/useScrollViewPosition.tsx b/packages/app/src/hooks/useScrollViewPosition.tsx index ebd29316..837a7a9f 100644 --- a/packages/app/src/hooks/useScrollViewPosition.tsx +++ b/packages/app/src/hooks/useScrollViewPosition.tsx @@ -1,6 +1,6 @@ import type { NativeScrollEvent, NativeSyntheticEvent } from 'react-native' -import { useState, useCallback } from 'react' +import { useCallback, useState } from 'react' export const useScrollViewPosition = (offset?: number) => { const scrollEventThrottle = 48 // used to decrease precision to increase performance diff --git a/apps/funke/app/utils/DeeplinkHandler.tsx b/packages/app/src/utils/DeeplinkHandler.tsx similarity index 100% rename from apps/funke/app/utils/DeeplinkHandler.tsx rename to packages/app/src/utils/DeeplinkHandler.tsx index dde78b8d..8c74fb2d 100644 --- a/apps/funke/app/utils/DeeplinkHandler.tsx +++ b/packages/app/src/utils/DeeplinkHandler.tsx @@ -2,9 +2,9 @@ import { useCallback } from 'react' import type { ReactNode } from 'react' import { InvitationQrTypes } from '@package/agent' +import { useCredentialDataHandler } from '@package/app' import { useToastController } from '@package/ui' import { CommonActions } from '@react-navigation/native' -import { useCredentialDataHandler } from '@package/app' import * as Linking from 'expo-linking' import { useNavigation } from 'expo-router' import { useEffect, useState } from 'react' diff --git a/packages/app/src/utils/index.ts b/packages/app/src/utils/index.ts index 00b97cb0..16225a22 100644 --- a/packages/app/src/utils/index.ts +++ b/packages/app/src/utils/index.ts @@ -1,3 +1,4 @@ export * from './formatCredentialSubject' export * from './unmatched' export * from './platform' +export * from './DeeplinkHandler' diff --git a/packages/app/src/utils/unmatched.ts b/packages/app/src/utils/unmatched.ts index 2b149253..db667c8d 100644 --- a/packages/app/src/utils/unmatched.ts +++ b/packages/app/src/utils/unmatched.ts @@ -1,4 +1,4 @@ -import { usePathname, useGlobalSearchParams } from 'expo-router' +import { useGlobalSearchParams, usePathname } from 'expo-router' // NOTE: for all unmatched routes we render null, as it's good chance that // we got here due to deep-linking, and we already handle that somewhere else diff --git a/packages/scanner/src/Scanner.tsx b/packages/scanner/src/Scanner.tsx index b8a6fea7..e2c67757 100644 --- a/packages/scanner/src/Scanner.tsx +++ b/packages/scanner/src/Scanner.tsx @@ -1,10 +1,10 @@ import type { StyleProp, ViewStyle } from 'react-native' -import { Heading, AnimatePresence, Page, Paragraph, Button, XStack, YStack, Spacer, AlertOctagon } from '@package/ui' +import { AlertOctagon, AnimatePresence, Button, Heading, Page, Paragraph, Spacer, XStack, YStack } from '@package/ui' import MaskedView from '@react-native-masked-view/masked-view' import { BarCodeScanner as ExpoBarCodeScanner } from 'expo-barcode-scanner' import { useCallback, useEffect, useState } from 'react' -import { Linking, StyleSheet, Dimensions, Platform } from 'react-native' +import { Dimensions, Linking, Platform, StyleSheet } from 'react-native' interface BarcodeScannerProps { onScan(data: string): void diff --git a/packages/ui/src/base/Headings.tsx b/packages/ui/src/base/Headings.tsx index 50b56c05..962b7e0a 100644 --- a/packages/ui/src/base/Headings.tsx +++ b/packages/ui/src/base/Headings.tsx @@ -1,6 +1,6 @@ import type { GetProps } from 'tamagui' -import { styled, Heading as THeading } from 'tamagui' +import { Heading as THeading, styled } from 'tamagui' export const Heading = styled(THeading, { name: 'Heading', diff --git a/packages/ui/src/config/tamagui.config.ts b/packages/ui/src/config/tamagui.config.ts index b1c8a902..515526a2 100644 --- a/packages/ui/src/config/tamagui.config.ts +++ b/packages/ui/src/config/tamagui.config.ts @@ -1,10 +1,10 @@ import { shorthands } from '@tamagui/shorthands' -import { radius, space, zIndex, size } from '@tamagui/themes' +import { radius, size, space, zIndex } from '@tamagui/themes' import { createTamagui, createTokens } from 'tamagui' import { animations } from '../animations' -import { fontRegular, fontMedium, fontSemiBold, fontBold } from './font' +import { fontBold, fontMedium, fontRegular, fontSemiBold } from './font' export const absoluteFill = { position: 'absolute', diff --git a/packages/ui/src/table/TableRow.tsx b/packages/ui/src/table/TableRow.tsx index 42813cbc..5c10a83e 100644 --- a/packages/ui/src/table/TableRow.tsx +++ b/packages/ui/src/table/TableRow.tsx @@ -1,4 +1,4 @@ -import { Paragraph, YStack, XStack } from '../base' +import { Paragraph, XStack, YStack } from '../base' import { Image } from '../content' interface TableRowProps {