Skip to content

Commit

Permalink
Merge pull request #11 from SNQ-2001/feature/bug-fix
Browse files Browse the repository at this point in the history
1.2.0
  • Loading branch information
SNQ-2001 authored Jan 10, 2023
2 parents 590b7d3 + 7284bb3 commit cd832e5
Show file tree
Hide file tree
Showing 25 changed files with 385 additions and 447 deletions.
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.7
89 changes: 46 additions & 43 deletions GitHubContributionsMenuBar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
objects = {

/* Begin PBXBuildFile section */
1C078205296C3D0D000D42B4 /* ThemaColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C078204296C3D0D000D42B4 /* ThemaColor.swift */; };
1C078207296C6943000D42B4 /* ViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C078206296C6943000D42B4 /* ViewType.swift */; };
1C078209296C6C0C000D42B4 /* Contributions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C078208296C6C0C000D42B4 /* Contributions.swift */; };
1C1787502909248700BFEB6E /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 1C17874F2909248700BFEB6E /* Settings.bundle */; };
1C1787542909291900BFEB6E /* Assets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C1787532909291900BFEB6E /* Assets.swift */; };
1C1AF58E2915253B00576761 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1C17875529092A3800BFEB6E /* Assets.xcassets */; };
Expand All @@ -18,23 +21,21 @@
1C6694AB2822EB6600ABFED2 /* Color+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C6694AA2822EB6600ABFED2 /* Color+.swift */; };
1C6694AD2822EB9400ABFED2 /* ContributionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C6694AC2822EB9400ABFED2 /* ContributionsView.swift */; };
1C6694AF2822EBC300ABFED2 /* GridStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C6694AE2822EBC300ABFED2 /* GridStack.swift */; };
1C6694B12822EBD800ABFED2 /* UXView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C6694B02822EBD800ABFED2 /* UXView.swift */; };
1C6694B52822EC2700ABFED2 /* View+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C6694B42822EC2700ABFED2 /* View+.swift */; };
1C6694B82822EC8F00ABFED2 /* Contribution.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C6694B72822EC8F00ABFED2 /* Contribution.swift */; };
1C6694BA2822ECA400ABFED2 /* GitHub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C6694B92822ECA400ABFED2 /* GitHub.swift */; };
1C6694BD2822ECC500ABFED2 /* SwiftSoup in Frameworks */ = {isa = PBXBuildFile; productRef = 1C6694BC2822ECC500ABFED2 /* SwiftSoup */; };
1C6694C22822EDC300ABFED2 /* Network+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C6694C12822EDC300ABFED2 /* Network+.swift */; };
1C921BF22909399300BA091E /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 1C921BF12909399300BA091E /* README.md */; };
1CA831B9290950D900FC6AB4 /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1CA831B8290950D900FC6AB4 /* icon.icns */; };
1CA8E632295DC92600F3D623 /* SkeletonUI in Frameworks */ = {isa = PBXBuildFile; productRef = 1CA8E631295DC92600F3D623 /* SkeletonUI */; };
1CAFD6862823D81100C9A576 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CAFD6852823D81100C9A576 /* SettingsView.swift */; };
1CAFD68B282412F500C9A576 /* SettingsLabelStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CAFD68A282412F400C9A576 /* SettingsLabelStyle.swift */; };
1CAFD68F282417F000C9A576 /* UserName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CAFD68E282417F000C9A576 /* UserName.swift */; };
1CAFD6912824181200C9A576 /* Thema.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CAFD6902824181200C9A576 /* Thema.swift */; };
1CAFD6932824186B00C9A576 /* OpenSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CAFD6922824186B00C9A576 /* OpenSource.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
1C078204296C3D0D000D42B4 /* ThemaColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemaColor.swift; sourceTree = "<group>"; };
1C078206296C6943000D42B4 /* ViewType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewType.swift; sourceTree = "<group>"; };
1C078208296C6C0C000D42B4 /* Contributions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Contributions.swift; sourceTree = "<group>"; };
1C17874F2909248700BFEB6E /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
1C1787532909291900BFEB6E /* Assets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Assets.swift; sourceTree = "<group>"; };
1C17875529092A3800BFEB6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand All @@ -49,18 +50,14 @@
1C6694AA2822EB6600ABFED2 /* Color+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+.swift"; sourceTree = "<group>"; };
1C6694AC2822EB9400ABFED2 /* ContributionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContributionsView.swift; sourceTree = "<group>"; };
1C6694AE2822EBC300ABFED2 /* GridStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GridStack.swift; sourceTree = "<group>"; };
1C6694B02822EBD800ABFED2 /* UXView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UXView.swift; sourceTree = "<group>"; };
1C6694B42822EC2700ABFED2 /* View+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+.swift"; sourceTree = "<group>"; };
1C6694B72822EC8F00ABFED2 /* Contribution.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Contribution.swift; sourceTree = "<group>"; };
1C6694B92822ECA400ABFED2 /* GitHub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitHub.swift; sourceTree = "<group>"; };
1C6694C12822EDC300ABFED2 /* Network+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Network+.swift"; sourceTree = "<group>"; };
1C921BF12909399300BA091E /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
1C921BF12909399300BA091E /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.markdown; };
1CA831B8290950D900FC6AB4 /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = icon.icns; sourceTree = "<group>"; };
1CAFD6852823D81100C9A576 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
1CAFD68A282412F400C9A576 /* SettingsLabelStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsLabelStyle.swift; sourceTree = "<group>"; };
1CAFD68E282417F000C9A576 /* UserName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserName.swift; sourceTree = "<group>"; };
1CAFD6902824181200C9A576 /* Thema.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Thema.swift; sourceTree = "<group>"; };
1CAFD6922824186B00C9A576 /* OpenSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenSource.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -69,13 +66,31 @@
buildActionMask = 2147483647;
files = (
1C6694BD2822ECC500ABFED2 /* SwiftSoup in Frameworks */,
1CA8E632295DC92600F3D623 /* SkeletonUI in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
1C078202296C3C93000D42B4 /* Model */ = {
isa = PBXGroup;
children = (
1C078203296C3CEF000D42B4 /* Entity */,
1C6694B62822EC7200ABFED2 /* Network */,
);
path = Model;
sourceTree = "<group>";
};
1C078203296C3CEF000D42B4 /* Entity */ = {
isa = PBXGroup;
children = (
1C078204296C3D0D000D42B4 /* ThemaColor.swift */,
1C078206296C6943000D42B4 /* ViewType.swift */,
1C078208296C6C0C000D42B4 /* Contributions.swift */,
);
path = Entity;
sourceTree = "<group>";
};
1C17874C290921ED00BFEB6E /* Resource */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -115,10 +130,9 @@
isa = PBXGroup;
children = (
1C921BF12909399300BA091E /* README.md */,
1C66949A2822EA3A00ABFED2 /* GitHubContributionsMenuBar.entitlements */,
1C6694912822EA3800ABFED2 /* GitHubContributionsMenuBarApp.swift */,
1CBC3A2D296AE60E00E1EDB5 /* Application */,
1C6694A02822EA5800ABFED2 /* View */,
1C6694B62822EC7200ABFED2 /* Network */,
1C078202296C3C93000D42B4 /* Model */,
1C6694A42822EAED00ABFED2 /* ViewModel */,
1C17874D290922D200BFEB6E /* Generated */,
1C6694A72822EB3200ABFED2 /* Extension */,
Expand All @@ -140,7 +154,6 @@
isa = PBXGroup;
children = (
1C6694A22822EAD900ABFED2 /* ContentView.swift */,
1C6694B02822EBD800ABFED2 /* UXView.swift */,
1CAFD6942824193200C9A576 /* Contributions */,
1CAFD689282411D700C9A576 /* Settings */,
);
Expand Down Expand Up @@ -180,9 +193,6 @@
children = (
1CAFD6852823D81100C9A576 /* SettingsView.swift */,
1CAFD68A282412F400C9A576 /* SettingsLabelStyle.swift */,
1CAFD68E282417F000C9A576 /* UserName.swift */,
1CAFD6902824181200C9A576 /* Thema.swift */,
1CAFD6922824186B00C9A576 /* OpenSource.swift */,
);
path = Settings;
sourceTree = "<group>";
Expand All @@ -196,6 +206,15 @@
path = Contributions;
sourceTree = "<group>";
};
1CBC3A2D296AE60E00E1EDB5 /* Application */ = {
isa = PBXGroup;
children = (
1C66949A2822EA3A00ABFED2 /* GitHubContributionsMenuBar.entitlements */,
1C6694912822EA3800ABFED2 /* GitHubContributionsMenuBarApp.swift */,
);
path = Application;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand All @@ -215,7 +234,6 @@
name = GitHubContributionsMenuBar;
packageProductDependencies = (
1C6694BC2822ECC500ABFED2 /* SwiftSoup */,
1CA8E631295DC92600F3D623 /* SkeletonUI */,
);
productName = GitHubContributionsMenuBar;
productReference = 1C66948E2822EA3800ABFED2 /* Contributions.app */;
Expand Down Expand Up @@ -247,7 +265,6 @@
mainGroup = 1C6694852822EA3800ABFED2;
packageReferences = (
1C6694BB2822ECC500ABFED2 /* XCRemoteSwiftPackageReference "SwiftSoup" */,
1CA8E630295DC92600F3D623 /* XCRemoteSwiftPackageReference "SkeletonUI" */,
);
productRefGroup = 1C66948F2822EA3800ABFED2 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -301,22 +318,21 @@
files = (
1C6694A32822EAD900ABFED2 /* ContentView.swift in Sources */,
1C6694A92822EB4F00ABFED2 /* Array+.swift in Sources */,
1CAFD6912824181200C9A576 /* Thema.swift in Sources */,
1C6694C22822EDC300ABFED2 /* Network+.swift in Sources */,
1CAFD68F282417F000C9A576 /* UserName.swift in Sources */,
1C6694AD2822EB9400ABFED2 /* ContributionsView.swift in Sources */,
1CAFD68B282412F500C9A576 /* SettingsLabelStyle.swift in Sources */,
1CAFD6932824186B00C9A576 /* OpenSource.swift in Sources */,
1C1787542909291900BFEB6E /* Assets.swift in Sources */,
1C6694B12822EBD800ABFED2 /* UXView.swift in Sources */,
1C6694A62822EAFB00ABFED2 /* ContributionsViewModel.swift in Sources */,
1CAFD6862823D81100C9A576 /* SettingsView.swift in Sources */,
1C6694BA2822ECA400ABFED2 /* GitHub.swift in Sources */,
1C6694922822EA3800ABFED2 /* GitHubContributionsMenuBarApp.swift in Sources */,
1C6694AF2822EBC300ABFED2 /* GridStack.swift in Sources */,
1C6694B82822EC8F00ABFED2 /* Contribution.swift in Sources */,
1C078209296C6C0C000D42B4 /* Contributions.swift in Sources */,
1C078205296C3D0D000D42B4 /* ThemaColor.swift in Sources */,
1C6694B52822EC2700ABFED2 /* View+.swift in Sources */,
1C6694AB2822EB6600ABFED2 /* Color+.swift in Sources */,
1C078207296C6943000D42B4 /* ViewType.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -444,11 +460,11 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_ENTITLEMENTS = GitHubContributionsMenuBar/GitHubContributionsMenuBar.entitlements;
CODE_SIGN_ENTITLEMENTS = GitHubContributionsMenuBar/Application/GitHubContributionsMenuBar.entitlements;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 111;
CURRENT_PROJECT_VERSION = 112;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"GitHubContributionsMenuBar/Preview Content\"";
DEVELOPMENT_TEAM = 69BMRJXU5B;
Expand All @@ -465,7 +481,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.1.1;
MARKETING_VERSION = 1.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.GitHubContributionsMenuBar;
PRODUCT_NAME = Contributions;
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -479,11 +495,11 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_ENTITLEMENTS = GitHubContributionsMenuBar/GitHubContributionsMenuBar.entitlements;
CODE_SIGN_ENTITLEMENTS = GitHubContributionsMenuBar/Application/GitHubContributionsMenuBar.entitlements;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 111;
CURRENT_PROJECT_VERSION = 112;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"GitHubContributionsMenuBar/Preview Content\"";
DEVELOPMENT_TEAM = 69BMRJXU5B;
Expand All @@ -500,7 +516,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.1.1;
MARKETING_VERSION = 1.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.GitHubContributionsMenuBar;
PRODUCT_NAME = Contributions;
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -540,14 +556,6 @@
minimumVersion = 2.0.0;
};
};
1CA8E630295DC92600F3D623 /* XCRemoteSwiftPackageReference "SkeletonUI" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/CSolanaM/SkeletonUI";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand All @@ -556,11 +564,6 @@
package = 1C6694BB2822ECC500ABFED2 /* XCRemoteSwiftPackageReference "SwiftSoup" */;
productName = SwiftSoup;
};
1CA8E631295DC92600F3D623 /* SkeletonUI */ = {
isa = XCSwiftPackageProductDependency;
package = 1CA8E630295DC92600F3D623 /* XCRemoteSwiftPackageReference "SkeletonUI" */;
productName = SkeletonUI;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 1C6694862822EA3800ABFED2 /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
{
"pins" : [
{
"identity" : "skeletonui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CSolanaM/SkeletonUI",
"state" : {
"revision" : "132f12a34b7fdab275bfc61968749b1f11c36300",
"version" : "1.0.7"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "f8a9c997c3c1dab4e216a8ec9014e23144cbab37",
"version" : "1.9.0"
}
},
{
"identity" : "swiftsoup",
"kind" : "remoteSourceControl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct GitHubContributionsMenuBarApp: App {
MenuBarExtra {
ContentView(viewModel: viewModel)
} label: {
Image(nsImage: NSImage(named: Asset.menuBarIcon.name))
Image(nsImage: NSImage(named: Asset.menuBarIcon.name)!)
}
.menuBarExtraStyle(.window)
}
Expand Down
2 changes: 1 addition & 1 deletion GitHubContributionsMenuBar/Generated/Assets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ internal struct ImageAsset {
#if os(iOS) || os(tvOS)
let image = Image(named: name, in: bundle, compatibleWith: nil)
#elseif os(macOS)
let name = NSImage.Name(self.name)
let name = NSImage.Name(name)
let image = (bundle == .main) ? NSImage(named: name) : bundle.image(forResource: name)
#elseif os(watchOS)
let image = Image(named: name)
Expand Down
13 changes: 13 additions & 0 deletions GitHubContributionsMenuBar/Model/Entity/Contributions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Contributions.swift
// GitHubContributionsMenuBar
//
// Created by 宮本大新 on 2023/01/10.
//

import Foundation

struct Contributions {
var levels: [[GitHub.Contribution.Level]] = []
var count: Int = .zero
}
30 changes: 30 additions & 0 deletions GitHubContributionsMenuBar/Model/Entity/ThemaColor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// ThemaColor.swift
// GitHubContributionsMenuBar
//
// Created by 宮本大新 on 2023/01/09.
//

import Foundation

enum ThemaColor: Int {
case green
case blue
case red
case purple

var colorName: String {
switch self {
case .green:
return "Green"
case .blue:
return "Blue"
case .red:
return "Red"
case .purple:
return "Purple"
}
}
}

extension ThemaColor: CaseIterable {}
32 changes: 32 additions & 0 deletions GitHubContributionsMenuBar/Model/Entity/ViewType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// ViewType.swift
// GitHubContributionsMenuBar
//
// Created by 宮本大新 on 2023/01/10.
//

import Foundation

enum ViewType {
case contributions
case settings
case emptyUserName
case error(Error)
case progress
}

extension ViewType {
static func == (lhs: ViewType, rhs: ViewType) -> Bool {
switch (lhs, rhs) {
case (.contributions, .contributions),
(.settings, .settings),
(.emptyUserName, .emptyUserName),
(.progress, .progress):
return true
case let (.error(lhsError), .error(rhsError)):
return lhsError.localizedDescription == rhsError.localizedDescription
default:
return false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ public enum GitHub {
}

private static func contribution(from htmlElement: Element) throws -> Contribution? {
let dataCount = try htmlElement.attr("data-count")
let dataCount = try htmlElement.text().components(separatedBy: " ").first
let dataDate = try htmlElement.attr("data-date")
let dataLevel = try htmlElement.attr("data-level")

guard let level = Int(dataLevel),
let count = Int(dataCount),
let date = dateFormatter.date(from: dataDate)
guard
let level = Int(dataLevel),
let dataCount,
let count = Int(dataCount),
let date = dateFormatter.date(from: dataDate)
else { return nil }

return Contribution(date: date, count: count, level: Contribution.Level(rawValue: level) ?? .zero)
Expand Down
Loading

0 comments on commit cd832e5

Please sign in to comment.