Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chat] sync chat sdk with kotlin implementation and add reject method #322

Merged
merged 15 commits into from
Jul 12, 2022

Conversation

llbartekll
Copy link
Contributor

@llbartekll llbartekll commented Jul 12, 2022

  1. sync chat sdk with kotlin implementation:
  • rpc methods property names and structure
  • timestamp format
  • rpc methods serialisation
  1. add reject method

@llbartekll llbartekll changed the base branch from main to develop July 12, 2022 09:48
@llbartekll llbartekll changed the title [Chat] sync chat sdk with kotlin implementation add reject method [Chat] sync chat sdk with kotlin implementation and add reject method Jul 12, 2022
Copy link
Contributor

@flypaper0 flypaper0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just few comments


class LeaveService {
func leave(topic: String) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused?

@@ -52,7 +53,8 @@ class MessagingService {
private func setUpRequestHandling() {
networkingInteractor.requestPublisher.sink { [unowned self] subscriptionPayload in
switch subscriptionPayload.request.params {
case .message(let message):
case .message(var message):
message.topic = subscriptionPayload.topic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need to do that? Is it possible to avoid struct mutation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wc_chatMessage does not contain topic but when we query messages from storage it is convenient to distinguish them by topic.
maybe some storage improvement could allow to avoid this but instant sync with kotlin was a priority
will take this into consideration in next storage PR


try await networkingInteractor.respond(topic: responseTopic, response: response)

invitePayloadStore.delete(forKey: inviteId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gj, need to do the same for approve

@@ -67,7 +69,7 @@ class InviteService {
let inviteResponse = try jsonrpc.result.get(InviteResponse.self)
logger.debug("Invite has been accepted")
guard case .invite(let inviteParams) = response.requestParams else { return }
Task { try await createThread(selfPubKeyHex: inviteParams.pubKey, peerPubKey: inviteResponse.pubKey, account: inviteParams.account, peerAccount: peerAccount)}
Task { try await createThread(selfPubKeyHex: inviteParams.publicKey, peerPubKey: inviteResponse.publicKey, account: inviteParams.account, peerAccount: peerAccount)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use priority .background everywhere?

} else {
throw Errors.decoding
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line

@llbartekll llbartekll merged commit 566fed3 into develop Jul 12, 2022
@llbartekll llbartekll deleted the kotlin-sync branch July 12, 2022 12:58
@flypaper0 flypaper0 mentioned this pull request Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants