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

Move Presence from Client to Document and replace selection with presence #130

Merged
merged 14 commits into from
Aug 18, 2023

Conversation

7hong13
Copy link
Contributor

@7hong13 7hong13 commented Aug 14, 2023

What this PR does / why we need it?

  • Move presence from the client to the document.
  • Replace selection handling with presence.

Any background context you want to provide?

This PR builds upon the changes introduced in the following PR:

What are the relevant tickets?

Fixes #

Checklist

  • Added relevant tests or not required
  • Didn't break anything

@7hong13 7hong13 added this to the 0.4.5 milestone Aug 14, 2023
@7hong13 7hong13 self-assigned this Aug 14, 2023
@7hong13 7hong13 marked this pull request as draft August 16, 2023 05:55
/**
* [PresenceProxy] represents a proxy for the Presence to be manipulated from the outside.
*/
public data class PresenceProxy internal constructor(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should remove 'Proxy' from the class name, since the users shouldn't have to know whether it is a proxy or not.

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 renamed it to Presence in this commit.

private val actorID: ActorID,
) {

public fun set(data: Map<String, String>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

set could be a little misleading as it may imply that previous presence data would be overriden by new data map.
Maybe we should use put instead, or we could change the parameter type to collection of pairs of strings.

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 changed the function name as put in this commit.

- Presence -> P
- fix presences emission
@7hong13
Copy link
Contributor Author

7hong13 commented Aug 16, 2023

In 77ab8e1, several adjustments have been made to maintain presences as a StateFlow and to handle flow emission correctly. If storing presences in a map seems sufficient or there is a better way to improve it, I will consider making additional changes.

@7hong13 7hong13 marked this pull request as ready for review August 16, 2023 17:11
@7hong13 7hong13 modified the milestones: 0.4.5, 0.4.6 Aug 17, 2023
@codecov
Copy link

codecov bot commented Aug 18, 2023

Codecov Report

Merging #130 (027edeb) into main (5290bdb) will decrease coverage by 0.60%.
The diff coverage is 80.71%.

@@            Coverage Diff             @@
##             main     #130      +/-   ##
==========================================
- Coverage   83.05%   82.46%   -0.60%     
==========================================
  Files          63       64       +1     
  Lines        3654     3696      +42     
  Branches      534      563      +29     
==========================================
+ Hits         3035     3048      +13     
- Misses        325      343      +18     
- Partials      294      305      +11     
Files Changed Coverage Δ
...tlin/dev/yorkie/document/JsonSerializableStruct.kt 52.94% <ø> (ø)
...c/main/kotlin/dev/yorkie/document/json/JsonText.kt 75.78% <0.00%> (ø)
...src/main/kotlin/dev/yorkie/api/ElementConverter.kt 72.48% <66.66%> (-4.42%) ⬇️
...c/main/kotlin/dev/yorkie/api/OperationConverter.kt 99.38% <66.66%> (ø)
...kotlin/dev/yorkie/document/change/ChangeContext.kt 95.45% <66.66%> (+0.21%) ⬆️
...dev/yorkie/document/operation/TreeEditOperation.kt 75.86% <66.66%> (+0.86%) ⬆️
yorkie/src/main/kotlin/dev/yorkie/core/Client.kt 86.17% <70.83%> (-1.09%) ⬇️
.../src/main/kotlin/dev/yorkie/api/ChangeConverter.kt 98.00% <75.00%> (-2.00%) ⬇️
...orkie/src/main/kotlin/dev/yorkie/core/Presences.kt 75.00% <75.00%> (ø)
...c/main/kotlin/dev/yorkie/document/crdt/CrdtTree.kt 75.17% <76.47%> (-0.10%) ⬇️
... and 9 more

... and 2 files with indirect coverage changes

@7hong13 7hong13 merged commit 6b9c463 into main Aug 18, 2023
7 checks passed
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