Skip to content

fix(updates): アップデートのダウンロード進捗が表示されない不具合を修正 - #71

Open
HR0101 wants to merge 1 commit into
mainfrom
fix/updater-download-progress
Open

HR0101 wants to merge 1 commit into
mainfrom
fix/updater-download-progress

Conversation

@HR0101

@HR0101 HR0101 commented Nov 24, 2026

Copy link
Copy Markdown
Owner

概要

アップデートのダウンロード中に進捗バーが動かない不具合を修正します.

async 版の URLSession.download(for:delegate:) は URLSessionDownloadDelegate の didWriteData を呼ばないため,進捗が一度も届いていませんでした.作られたタスクの task.progress を KVO で監視する方式に変えています.

変更点

  • UpdateDownloadProgress を URLSessionTaskDelegate にし,didCreateTask で task.progress.fractionCompleted を監視
  • サイズ不明の判定は旧実装と同じく countOfBytesExpectedToReceive > 0 で行う(不明のときはスピナー表示)
  • 通知の順序は保証されないため,進捗は増える方向にだけ反映し,1% 未満の変化は間引く(applyProgress)
  • AppUpdater に downloadsDirectory を追加し,テストで保存先を差し替え可能に
  • presentsWindows == false のときは完了後に Finder で表示しない

テスト

  • downloadReportsProgressAndSavesDMG を追加(2回に分けて返すモックで,進捗の報告・保存先・中身の一致を確認)
  • ローカルで AppUpdaterTests 7件すべて成功

未確認

  • Content-Length のない応答で実際にスピナー表示になるか(テストなし)

async 版の URLSession.download(for:delegate:) は URLSessionDownloadDelegate の
didWriteData を呼ばないため,進捗が一度も届かずバーが動いていなかった.
作られたタスクの task.progress を KVO で監視する方式に変える.

- サイズ不明の判定は旧実装と同じく,応答の予定サイズ(countOfBytesExpectedToReceive)で行う
- 通知の順序は保証されないので,進捗は増える方向にだけ反映し,1% 未満の変化は間引く
- テスト用に保存先フォルダを差し替えられるようにし,進捗の報告と DMG の保存を確かめるテストを追加
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5ef23f94-df25-486d-bdb5-990e6adf1c3e
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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.

1 participant