Skip to content

Commit

Permalink
fix(manager): start iridium manager fix (#4973)
Browse files Browse the repository at this point in the history
  • Loading branch information
maljuburi committed Sep 22, 2022
1 parent 71111d6 commit accbf03
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
26 changes: 13 additions & 13 deletions libraries/Iridium/IridiumManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@ export class IridiumManager extends Emitter {
* @param param0 Textile Configuration that includes id, password and SolanaWallet instance
* @returns a promise that resolves when the initialization completes
*/
async start({ pass, wallet }: { pass: string; wallet: Account }) {
async start() {
this.connector?.on('stopping', async () => {
logger.info('iridium/manager', 'stopping')
await this.stop()
})

logger.info('iridium/manager', 'init()')
const seed = await IdentityManager.seedFromWallet(pass, wallet)
return this.initFromEntropy(seed)
}

async stop() {
await this.friends.stop?.()
await this.users.stop?.()
await this.profile.stop?.()
await this.groups.stop?.()
await this.chat.stop?.()
await this.files.stop?.()
await this.webRTC.stop?.()
await this.settings.stop?.()
await this.notifications.stop?.()
await Promise.all([
this.friends.stop?.(),
this.users.stop?.(),
this.profile.stop?.(),
this.groups.stop?.(),
this.chat.stop?.(),
this.files.stop?.(),
this.webRTC.stop?.(),
this.settings.stop?.(),
this.notifications.stop?.(),
])
}

get id(): string {
Expand Down
2 changes: 2 additions & 0 deletions store/accounts/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export default {
'dispatching iridium/initializeFromEntropy',
)
await iridium.initFromEntropy(entropy)
await iridium.start()
}

const profile = await iridium.profile?.get()
Expand Down Expand Up @@ -285,6 +286,7 @@ export default {
'dispatching iridium/initializeFromEntropy',
)
await iridium.initFromEntropy(entropy)
await iridium.start()
}

if (!iridium.connector) {
Expand Down

0 comments on commit accbf03

Please sign in to comment.