Skip to content

Fixes#11

Merged
Sajjon merged 3 commits into
mainfrom
tuesday
Apr 21, 2026
Merged

Fixes#11
Sajjon merged 3 commits into
mainfrom
tuesday

Conversation

@Sajjon
Copy link
Copy Markdown
Owner

@Sajjon Sajjon commented Apr 21, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR applies a set of small refactors and string updates across the Loading and Game Setup flows.

Changes:

  • Refactors LoadingViewModel → view binding from Diffuser to an onPhaseChange callback and reorganizes code into extensions.
  • Updates Game Setup localization keys from “Username” to “Wikimedia query” and adds difficulty-change logging.
  • Moves WikimediaClientProtocol conformance into an extension for clearer file structure.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
SwiftIntro/Features/Loading/View/LoadingView.swift Moves rendering API into an internal extension (structure/organization).
SwiftIntro/Features/Loading/LoadingViewModel.swift Replaces Diffuser dependency with onPhaseChange closure; reorganizes Phase into an extension.
SwiftIntro/Features/Loading/LoadingVC.swift Updates VM construction/wiring to use the new onPhaseChange callback.
SwiftIntro/Features/GameSetup/View/GameSetupView.swift Switches to new localized string keys and adds a log when difficulty changes.
SwiftIntro/Features/GameSetup/View/GameSetup.xcstrings Renames string catalog keys to match updated UI terminology.
SwiftIntro/Dependencies/Wikimedia/WikimediaClient.swift Moves protocol conformance to an extension (structure/organization).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +43 to 44
view.onRetry = { [weak viewModel] in viewModel?.retry() }
super.init(nibName: nil, bundle: nil)
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

view.onRetry = { [weak viewModel] ... } captures the viewModel stored property before super.init is called. In Swift initializers this typically triggers “self used before super.init call” because reading a stored property implies self access. Consider restoring a local vm variable (assign to viewModel after wiring onRetry) or move the onRetry wiring to after super.init (e.g., viewDidLoad) so it compiles safely.

Copilot uses AI. Check for mistakes.
Comment on lines 28 to 32
/// Current visual phase. Every assignment is automatically pushed to the view
/// via the diffuser — no optional unwrap, no manual `run` call at the call site.
private var phase: Phase = .loading {
didSet { diffuser.run(phase) }
didSet { onPhaseChange(phase) }
}
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

The phase property comment still refers to pushing updates “via the diffuser”, but the implementation now uses the onPhaseChange closure. Please update this comment (and the class header comment if needed) to reflect the new mechanism, and remove import Diffuser from this file if it’s no longer used.

Copilot uses AI. Check for mistakes.
@@ -65,7 +67,6 @@ extension LoadingViewModel {
// Logger interpolation is @autoclosure → closure context; compiler needs self.
// swiftformat:disable:next redundantSelf
logNet.info("LoadingViewModel starting — config: \(self.config)")
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

start() is documented as “Renders the initial state”, but it no longer calls onPhaseChange with the current phase. Either trigger an initial onPhaseChange(phase) here (to keep the view driven solely by the view model) or adjust the doc comment to match the actual behavior.

Suggested change
logNet.info("LoadingViewModel starting — config: \(self.config)")
logNet.info("LoadingViewModel starting — config: \(self.config)")
onPhaseChange(phase)

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 75.86207% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.74%. Comparing base (14cd5b1) to head (e05ed23).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
SwiftIntro/Features/Loading/LoadingViewModel.swift 60.00% 6 Missing ⚠️
SwiftIntro/Features/Loading/View/LoadingView.swift 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #11      +/-   ##
==========================================
- Coverage   98.96%   98.74%   -0.22%     
==========================================
  Files          68       68              
  Lines        3581     3593      +12     
==========================================
+ Hits         3544     3548       +4     
- Misses         37       45       +8     
Files with missing lines Coverage Δ
...Intro/Dependencies/Wikimedia/WikimediaClient.swift 100.00% <ø> (ø)
...tIntro/Features/GameSetup/View/GameSetupView.swift 100.00% <100.00%> (ø)
SwiftIntro/Features/Loading/LoadingVC.swift 81.48% <100.00%> (-1.28%) ⬇️
SwiftIntroTests/App/StringsTests.swift 100.00% <100.00%> (ø)
SwiftIntro/Features/Loading/View/LoadingView.swift 94.28% <50.00%> (-1.31%) ⬇️
SwiftIntro/Features/Loading/LoadingViewModel.swift 81.66% <60.00%> (-10.34%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Sajjon Sajjon merged commit 269c505 into main Apr 21, 2026
2 checks passed
@Sajjon Sajjon deleted the tuesday branch April 21, 2026 13:18
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