Skip to content

Commit

Permalink
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -769,4 +769,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 95d6ace79946933ecf80684613842ee553dd76a2

COCOAPODS: 1.15.2
COCOAPODS: 1.14.2
25 changes: 12 additions & 13 deletions src/lib/Client.ts
Original file line number Diff line number Diff line change
@@ -19,11 +19,13 @@ import { DecodedMessage } from '../index'

declare const Buffer

export type GetMessageContentTypeFromClient<C> =
C extends Client<infer T> ? T : never
export type GetMessageContentTypeFromClient<C> = C extends Client<infer T>

Check warning on line 22 in src/lib/Client.ts

GitHub Actions / lint

Replace `·C·extends·Client<infer·T>⏎··?·T⏎·` with `⏎··C·extends·Client<infer·T>·?·T`
? T
: never

export type ExtractDecodedType<C> =
C extends XMTPModule.ContentCodec<infer T> ? T : never
export type ExtractDecodedType<C> = C extends XMTPModule.ContentCodec<infer T>

Check warning on line 26 in src/lib/Client.ts

GitHub Actions / lint

Replace `·C·extends·XMTPModule.ContentCodec<infer·T>⏎··?·T⏎·` with `⏎··C·extends·XMTPModule.ContentCodec<infer·T>·?·T`
? T
: never

export class Client<
ContentTypes extends DefaultContentTypes = DefaultContentTypes,
@@ -142,22 +144,20 @@ export class Client<
const options = defaultOptions(opts)
const { enableSubscription, createSubscription } =
this.setupSubscriptions(options)
const json = await XMTPModule.createRandom(
const addressInboxId = await XMTPModule.createRandom(
options.env,
options.appVersion,
Boolean(createSubscription),
Boolean(enableSubscription),
Boolean(options.enableAlphaMls),
options.dbEncryptionKey
)

const addressInboxId = JSON.parse(json)
this.removeSubscription(enableSubscription)
this.removeSubscription(createSubscription)

return new Client(
addressInboxId.address,
addressInboxId.inboxId,
addressInboxId['address'],
addressInboxId['inboxId'],
opts?.codecs || []
)
}
@@ -179,18 +179,17 @@ export class Client<
opts?: Partial<ClientOptions> & { codecs?: ContentCodecs }
): Promise<Client<ContentCodecs>> {
const options = defaultOptions(opts)
const json = await XMTPModule.createFromKeyBundle(
const addressInboxId = await XMTPModule.createFromKeyBundle(
keyBundle,
options.env,
options.appVersion,
Boolean(options.enableAlphaMls),
options.dbEncryptionKey
)
const addressInboxId = JSON.parse(json)

return new Client(
addressInboxId.address,
addressInboxId.inboxId,
addressInboxId['address'],
addressInboxId['inboxId'],
opts?.codecs || []
)
}

0 comments on commit 404d7be

Please sign in to comment.