Skip to content

Commit

Permalink
Merge pull request #93 from 87kangsw/hotfix/buddy-contribution
Browse files Browse the repository at this point in the history
[Hotfix] buddy contribution
  • Loading branch information
87kangsw authored Jul 25, 2023
2 parents c2b1599 + 1246401 commit 3374c98
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
28 changes: 12 additions & 16 deletions GitTime/Sources/ViewControllers/Activity/ActivityViewReactor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,25 +263,21 @@ final class ActivityViewReactor: ReactorKit.Reactor {
var profileURL: String = ""

if let doc = try? HTML(html: response.data, encoding: .utf8) {
if let calendar = doc.css("div.js-calendar-graph").first {
for weekdayRow in calendar.css("tbody tr") {
for rect in weekdayRow.css("td.ContributionCalendar-day") {

if var date = rect["data-date"],
let dataLevel = rect["data-level"] {

date = date.replacingOccurrences(of: "\\", with: "")
.replacingOccurrences(of: "/", with: "")
.replacingOccurrences(of: "\"", with: "")

let colorType = ContributionHexColorTypes.allCases.first { $0.rawValue == Int(dataLevel) }
if let hexString = colorType?.hexString {
contributions.append(Contribution(date: date, contribution: Int(dataLevel)!, hexColor: hexString))
}
}
for rect in doc.css("td") {
if var date = rect["data-date"],
let dataLevel = rect["data-level"] {

date = date.replacingOccurrences(of: "\\", with: "")
.replacingOccurrences(of: "/", with: "")
.replacingOccurrences(of: "\"", with: "")

let colorType = ContributionHexColorTypes.allCases.first { $0.rawValue == Int(dataLevel) }
if let hexString = colorType?.hexString {
contributions.append(Contribution(date: date, contribution: Int(dataLevel)!, hexColor: hexString))
}
}
}


for count in doc.css("h2, f4 text-normal mb-2") {
let decimalCharacters = CharacterSet.decimalDigits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ final class BuddyViewReactor: Reactor {
var profileURL: String = ""

if let doc = try? HTML(html: response.data, encoding: .utf8) {
for rect in doc.css("rect") {
for rect in doc.css("td") {
if var date = rect["data-date"],
let dataLevel = rect["data-level"] {

Expand Down
4 changes: 2 additions & 2 deletions GitTime/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.2.0</string>
<string>2.2.1</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -100,7 +100,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>7</string>
<string>9</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down

0 comments on commit 3374c98

Please sign in to comment.