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

Added customMessageType to Publish, Signal, Subscribe, History, File. #302

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

marcin-cebo
Copy link
Contributor

No description provided.

Copy link
Contributor

@wkal-pubnub wkal-pubnub left a comment

Choose a reason for hiding this comment

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

Additionally there are some build errors related to missing parameters in JS and iOS in fetchMessages

channel.publish(
message = generatePayload(),
customMessageType = expectedCustomMessageType
).await { resutl: Result<PNPublishResult> ->
Copy link
Contributor

Choose a reason for hiding this comment

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

this await could just be .sync() I think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I will change it.

@@ -93,6 +98,8 @@ class PublishEndpoint internal constructor(
queryParams["norep"] = true.valueString
}

customMessageType?.run { queryParams[CUSTOM_MESSAGE_TYPE_QUERY_PARAM] = this }
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I prefer to use .let { it -> } in situations when changing the receiver (this) is not required or beneficial.
For example this could easily be ?.let { queryParams[CUSTOM_MESSAGE_TYPE_QUERY_PARAM] = it } and then we don't have the this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would also use .let but I wanted to be in line with approach used in this method where there are:

meta?.run { queryParams["meta"] = pubnub.mapper.toJson(this) }
shouldStore?.run { queryParams["store"] = this.numericString }
ttl?.run { queryParams["ttl"] = this.toString() }

I will refactor this method to use:
.?.let {}

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