Skip to content

Commit 395e20b

Browse files
graycreateweb-flow
andcommitted
refactor: Address Copilot review comments
- Remove unused extractNumber helper methods in OnlineStatsInfo - Use explicit Task syntax for parallel execution instead of async let Co-Authored-By: GitHub Copilot <[email protected]>
1 parent 3f157ec commit 395e20b

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

V2er/State/DataFlow/Model/OnlineStatsInfo.swift

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -64,46 +64,6 @@ public struct OnlineStatsInfo: BaseModel, Codable {
6464
}
6565
}
6666

67-
private func extractNumber(before keyword: String, from text: String) -> Int? {
68-
let components = text.components(separatedBy: keyword)
69-
guard let firstPart = components.first else { return nil }
70-
71-
// Extract the last number from the text before keyword
72-
let pattern = "(\\d+)\\s*$"
73-
guard let regex = try? NSRegularExpression(pattern: pattern) else { return nil }
74-
75-
let nsText = firstPart as NSString
76-
let matches = regex.matches(in: firstPart, range: NSRange(location: 0, length: nsText.length))
77-
78-
if let match = matches.last, match.numberOfRanges > 1 {
79-
let numberStr = nsText.substring(with: match.range(at: 1))
80-
return Int(numberStr.replacingOccurrences(of: ",", with: ""))
81-
}
82-
83-
return nil
84-
}
85-
86-
private func extractNumber(after keyword: String, from text: String) -> Int? {
87-
let components = text.components(separatedBy: keyword)
88-
guard components.count > 1 else { return nil }
89-
90-
let afterPart = components[1]
91-
92-
// Extract the first number from the text after keyword
93-
let pattern = "(\\d+)"
94-
guard let regex = try? NSRegularExpression(pattern: pattern) else { return nil }
95-
96-
let nsText = afterPart as NSString
97-
let matches = regex.matches(in: afterPart, range: NSRange(location: 0, length: nsText.length))
98-
99-
if let match = matches.first, match.numberOfRanges > 1 {
100-
let numberStr = nsText.substring(with: match.range(at: 1))
101-
return Int(numberStr.replacingOccurrences(of: ",", with: ""))
102-
}
103-
104-
return nil
105-
}
106-
10767
func isValid() -> Bool {
10868
return onlineCount > 0
10969
}

V2er/View/Feed/FeedPage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct FeedPage: BaseHomePageView {
4747
.updatable(autoRefresh: state.showProgressView, hasMoreData: state.hasMoreData, max(state.scrollToTop, scrollTop(tab: .feed)), onlineStats: state.onlineStats) {
4848
if AccountState.hasSignIn() {
4949
// Fetch online stats in parallel with feed data
50-
async let _ = run(action: FeedActions.FetchOnlineStats.Start())
50+
Task { await run(action: FeedActions.FetchOnlineStats.Start()) }
5151
await run(action: FeedActions.FetchData.Start())
5252
}
5353
} loadMore: {

0 commit comments

Comments
 (0)