-
Notifications
You must be signed in to change notification settings - Fork 56
Minor improvements, cleanup #1529
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
Conversation
gemdev111
commented
Dec 24, 2025
- Remove empty feature modules: WalletAvatar, PriceWidget, Currency, NameResolver
- Rename TransactionService → TransactionStateService (module, type, and variable names)
- Consolidate duplicate date formatters into shared RelativeDateFormatter in Formatters package
- Remove ConnectionDateFormatter wrapper (now uses RelativeDateFormatter directly)
- Remove deprecated StateLoadingView component (zero usages)
- Remove empty/unused directories: Packages/JobRunner/, Services/
- Add unit tests for RelativeDateFormatter
Replaces all usages and dependencies of TransactionService with TransactionStateService across the codebase, including environment values, factories, view models, and package manifests. Updates import paths, test kits, and related service initializations. Also moves and generalizes the relative date formatter to a shared Formatters package, updates usages, and adds tests. Removes deprecated StateLoadingView and refactors InputValidationField and FloatTextField to use onClean instead of onWillClean.
Summary of ChangesHello @gemdev111, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on significant code cleanup and refactoring to enhance the project's maintainability, clarity, and overall efficiency. Key changes include the removal of unused components and modules, the standardization of naming conventions for a core service, and the centralization of common utility functions like date formatting. These efforts are aimed at reducing technical debt and making the codebase more understandable and extensible for future development. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces several valuable improvements and cleanups. The renaming of TransactionService to TransactionStateService is applied consistently across the codebase, enhancing clarity. Consolidating date formatting logic into a new shared RelativeDateFormatter is a great step towards reducing code duplication and improving maintainability. The removal of unused components and directories further streamlines the project.
I've identified a minor issue in the new RelativeDateFormatter where the includeTime parameter is not respected for 'today' and 'yesterday' dates. I've also suggested adding more test cases to cover this scenario. Apart from that, the changes are excellent. Well done!
| public func string(from date: Date, includeTime: Bool = true) -> String { | ||
| if Calendar.current.isDateInToday(date) { | ||
| return String(format: "%@, %@", Localized.Date.today, Self.time.string(from: date)) | ||
| } else if Calendar.current.isDateInYesterday(date) { | ||
| return String(format: "%@, %@", Localized.Date.yesterday, Self.time.string(from: date)) | ||
| } | ||
| return Self.dateAndTime.string(from: date) | ||
| return includeTime ? Self.dateAndTime.string(from: date) : Self.dateOnly.string(from: date) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The includeTime parameter is currently ignored for dates that are 'today' or 'yesterday'. This could lead to unexpected behavior where time is displayed even when it's not desired, for example in the chart view for yearly periods.
To ensure the includeTime flag is respected for all cases, you could refactor this method.
public func string(from date: Date, includeTime: Bool = true) -> String {
if Calendar.current.isDateInToday(date) {
let relativePart = Localized.Date.today
return includeTime ? String(format: "%@, %@", relativePart, Self.time.string(from: date)) : relativePart
} else if Calendar.current.isDateInYesterday(date) {
let relativePart = Localized.Date.yesterday
return includeTime ? String(format: "%@, %@", relativePart, Self.time.string(from: date)) : relativePart
}
return includeTime ? Self.dateAndTime.string(from: date) : Self.dateOnly.string(from: date)
}| #expect(!result.hasPrefix(Localized.Date.today)) | ||
| #expect(!result.hasPrefix(Localized.Date.yesterday)) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job adding tests for the new RelativeDateFormatter! To improve test coverage, it would be beneficial to add test cases for when includeTime is false. This would help verify the logic for 'today', 'yesterday', and older dates when the time component should be omitted.
@Test
func todayWithoutTime() {
let result = formatter.string(from: Date(), includeTime: false)
#expect(result == Localized.Date.today)
}
@Test
func yesterdayWithoutTime() {
let yesterday = Calendar.current.date(byAdding: .day, value: -1, to: Date())!
let result = formatter.string(from: yesterday, includeTime: false)
#expect(result == Localized.Date.yesterday)
}
@Test
func olderDateWithoutTime() {
let oldDate = Calendar.current.date(byAdding: .day, value: -7, to: Date())!
let result = formatter.string(from: oldDate, includeTime: false)
let expectedFormatter = DateFormatter()
expectedFormatter.timeStyle = .none
expectedFormatter.dateStyle = .long
#expect(result == expectedFormatter.string(from: oldDate))
}
}