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

Implement pause and resume #90

Merged
merged 6 commits into from
Mar 17, 2023
Merged

Implement pause and resume #90

merged 6 commits into from
Mar 17, 2023

Conversation

7hong13
Copy link
Contributor

@7hong13 7hong13 commented Mar 16, 2023

What this PR does / why we need it?

  • Implement the pause and resume functions.
  • Pause the real time sync when the Hangul composition starts, and resume when it ends
  • Detect the Hangul composition by using Unicode Hangul Jamo and Syllables.

Any background context you want to provide?

implemented based on the iOS SDK implementation.

What are the relevant tickets?

Fixes #

Checklist

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

@7hong13 7hong13 self-assigned this Mar 16, 2023
require(isActive) {
"client is not active"
}
attachments.value[document.key]?.isRealTimeSync = isRealTimeSync
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if it would be better to throw exceptions for non-existing keys, I'll fix it.

@@ -4,7 +4,7 @@ import dev.yorkie.document.Document

internal data class Attachment(
val document: Document,
val isRealTimeSync: Boolean,
var isRealTimeSync: Boolean,
Copy link
Contributor

Choose a reason for hiding this comment

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

having mutable properties for a state could be dangerous, as value changes in such properties do not emit changes to subscirbers, and isRealTimeSync is used in a Flow.map.
we should keep it immutable and always create a new instance of an Attachment when there are changes.
this is why I changed peerPresences to a immutable map in previous work.

remoteChangeEventReceived is a special case, since it is only used inside a while loop, and changes do not need emissions. but it would be better to make it immutable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you for explaining it in detail.
I made isRealTimeSync and remoteChangeEventReceived immutable: 56aa510

@codecov
Copy link

codecov bot commented Mar 17, 2023

Codecov Report

Merging #90 (6932975) into main (a6cb0e8) will decrease coverage by 0.30%.
The diff coverage is 43.75%.

@@            Coverage Diff             @@
##             main      #90      +/-   ##
==========================================
- Coverage   81.93%   81.63%   -0.30%     
==========================================
  Files          52       52              
  Lines        2397     2407      +10     
  Branches      335      335              
==========================================
+ Hits         1964     1965       +1     
- Misses        252      261       +9     
  Partials      181      181              
Impacted Files Coverage Δ
yorkie/src/main/kotlin/dev/yorkie/core/Client.kt 84.39% <40.00%> (-2.74%) ⬇️
...rkie/src/main/kotlin/dev/yorkie/core/Attachment.kt 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@7hong13 7hong13 merged commit 56382fc into main Mar 17, 2023
@7hong13 7hong13 deleted the pause_and_resume branch March 17, 2023 08:57
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