Skip to content

Commit

Permalink
fix: wait for connecting/initializing ledgers (#721)
Browse files Browse the repository at this point in the history
Remove Indicio ledgers

Signed-off-by: Clécio Varjão <[email protected]>
  • Loading branch information
cvarjao authored Nov 18, 2022
1 parent 948129c commit 6c12d80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions app/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { translationResources, ConfigurationContext, types, Record } from 'aries-bifold'
import { translationResources, ConfigurationContext, types, Record, indyLedgers } from 'aries-bifold'
import { Bundles } from 'aries-bifold/lib/typescript/App/types/oca'
import merge from 'lodash.merge'

Expand All @@ -16,6 +16,7 @@ const localization = merge({}, translationResources, {
en: { translation: en },
})

const selectedLedgers = indyLedgers.filter((item) => !item.id.startsWith('Indicio'))
const configuration: ConfigurationContext = {
pages,
splash: Splash,
Expand All @@ -24,7 +25,7 @@ const configuration: ConfigurationContext = {
OCABundle: new types.oca.DefaultOCABundleResolver().loadBundles(bundles as unknown as Bundles),
useBiometry: UseBiometry,
record: Record,
indyLedgers: [],
indyLedgers: selectedLedgers,
settings: [],
developer: () => null,
}
Expand Down
8 changes: 5 additions & 3 deletions app/src/screens/Splash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import {
useTheme,
useStore,
ToastType,
indyLedgers,
LoadingIndicator,
useConfiguration,
} from 'aries-bifold'
import React, { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
Expand Down Expand Up @@ -65,6 +65,7 @@ const Splash: React.FC = () => {
const navigation = useNavigation()
const { getWalletCredentials } = useAuth()
const { ColorPallet } = useTheme()
const { indyLedgers } = useConfiguration()
const styles = StyleSheet.create({
container: {
flex: 1,
Expand Down Expand Up @@ -169,15 +170,15 @@ const Splash: React.FC = () => {

const newAgent = new Agent(
{
label: 'Aries Bifold',
label: 'BC Wallet',
mediatorConnectionsInvite: Config.MEDIATOR_URL,
mediatorPickupStrategy: MediatorPickupStrategy.Implicit,
walletConfig: { id: credentials.id, key: credentials.key },
autoAcceptConnections: true,
autoAcceptCredentials: AutoAcceptCredential.ContentApproved,
logger: new ConsoleLogger(LogLevel.trace),
indyLedgers,
connectToIndyLedgersOnStartup: true,
connectToIndyLedgersOnStartup: false,
autoUpdateStorageOnStartup: true,
},
agentDependencies
Expand All @@ -190,6 +191,7 @@ const Splash: React.FC = () => {
newAgent.registerOutboundTransport(httpTransport)

await newAgent.initialize()
await newAgent.ledger.connectToPools()
setAgent(newAgent)
navigation.navigate(Stacks.TabStack as never)

Expand Down

0 comments on commit 6c12d80

Please sign in to comment.