Update fallback management (with unpublished) #1329
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on https://gitlab.matrix.org/matrix-org/olm/-/merge_requests/48
OlmKit now manage the published/unpublished status of fallback keys.
So now #markOneTimeKeysAsPublished will also mark any unpublished fallback key as published.
As a consequence we must upload unpublished fallback key at the same time we do uplaod OTK.
We should also call forget fallback key once we are reasonably certain that you will not receive any more messages that uses the old fallback key (via forgetFallbackKey)
@manuroe Letting this as a Draft, because there is a race issue where I receveive an old sync response telling that I need to generate a new fallback key, while I just uploaded it. Causing the SDK to over generate and then loose a fallback key (potentially creating a fail to establish channel)
Also where should I store the lastFallbackUploadTime, I am using UserDefault but not sure I shouldn't be using some existing mecanism
Pull Request Checklist