Repository navigation
Conversation
同期用のデータはiCloudのレコードにだけもち、ローカルにはCKSyncEngineの同期状態だけを UserDefaultsに保存する。未送信の変更はメモリ上にだけもつ。
将来注釈を同期するときに、この版が他の端末の保存した注釈を消してしまわないように、 iCloudのレコードの注釈のフィールドには読み書きどちらも触れない。 他の端末から受け取った変換候補が既にあれば、その注釈はそのまま残す。
- 送信の競合で受け取った変換候補は1件ずつではなくまとめてユーザー辞書に反映する - 初回同期の取得中の集計と、同期開始前からある変換候補の送信状況をそれぞれ1つの状態にまとめる - 取得のエラー処理と、iCloudからの削除処理の重複をなくす - レコード名の16進文字列への変換を速くする (結果は変えない) - 辞書の編集を通知する処理をFileDictの1か所にまとめる
辞書の内容を丸ごと置き換えるのをやめ、受け取った変換候補を日時の古い順に追加・削除する。 編集の通知はFileDictではなくUserDictから変更後に1回だけ出す。
大量の変更を受け取ったときに、一定の件数ごとに他の処理に譲りながら反映する。 反映中の編集を他の端末からの変更として数えないように、受け取った変換候補だけを比べる。
取得中は受け取った件数を、反映中は反映した件数と全体の件数を表示する。 CloudKitからは全体の件数がわからないので、取得中は受け取った件数だけを表示する。
Developer IDでのエクスポートではXcodeが自動でProductionを設定していたが、 暗黙の動作に頼らないようにエクスポートの設定に書いておく。
CloudKitの日時はミリ秒で表現されるので、ミリ秒に丸めた日時をそのまま保存できる。
保存した同期状態から再開すると前回以降の変更しか取得できず、 iCloudにある変換候補もすべて送り直してしまっていた。
全体の件数まで出すと4桁で2行になってしまうので、取得中の表示に合わせる。
1 of 3 tasks
Owner
Author
|
このあと50コミットくらい積んでおり、 #547 として出し直します。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#528 ユーザー辞書をiCloudで同期できるようにします。
動作環境
CKSyncEngineを使うため)