Skip to content

Commit

Permalink
Implement version 2.0 (#30)
Browse files Browse the repository at this point in the history
* Change solar window min size (#15)

* Change min size for solar window

* Add min size to other windows

* Update window sizes

* Add remove menu (#17)

* Add collection menu

* Update localisation

* Update assets for macOS Ventura (#26)

* Update assets

* Fix time calculations (#27)

* Improve help menu (#22)

* Add urlStrings enum for GitHub, EquinoxWebsite, MacAppStore & ProductHunt URLs. Add unwrapOpenURL methods. Add methods to open helpMenu URLs. Refactor helpMenu items.

* Rename helpURLs to helpMenuLinks & refactor enum. Refactor open...URL methods to single open URL. Refactor helpMenu with forEach loop.

* Fix MenuItem Swift complier warning

* Optimize helpMenu loop. Refactor & move unwrapOpenURL method logic to openURL method. Delete unwrapOpenURL method.

* Move helpMenuLinks to separate file

* Optimize openURL method with MenuItem representedObject & delete switch on MenuItem title

* Setup Help menu for localization

* Revert "Fix MenuItem Swift complier warning"

This reverts commit 983ba41.

* Add test for Mint path to SwiftLint build phase. Rename helpMenuLinks to HelpMenuLinks. Code restyling.

* Remove redundant internal

Co-authored-by: rlxone <[email protected]>

* Add FR localization (#20)

* Setup FR translation

* Update FR translation

* Add Info.plist translation

* Update FR translation

* Add translation section to README

* Update README.md

* Adjust README translation section

* Fix translation author link

* Update FR translation for Help menu links

* Add FR localization to Localizable.stringsdict

* Add delete key with FR translation

* Update FR localization

* Update help menu EN localization

* Add fallback for macOS 10.15 and lower

Co-authored-by: rlxone <[email protected]>

* Migrate to Swift 5 and XCode 14 (#28)

* Swift 5

* Improve CI

* Swift 5

* Bump version (#32)

* Bump version (#34)

Co-authored-by: William Mead <[email protected]>
  • Loading branch information
rlxone and W1W1-M authored Dec 3, 2022
1 parent 720c4ed commit 3cfd61e
Show file tree
Hide file tree
Showing 79 changed files with 767 additions and 144 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ on:

jobs:
build:
runs-on: macOS-latest
runs-on: macos-12
steps:
- uses: actions/checkout@master
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '14.1'

- name: Test
run: sh build/test.sh
Expand Down
4 changes: 4 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,9 @@ nesting:

identifier_name:
min_length: 2

type_name:
min_length: 3
max_length: 50

reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji, sonarqube, markdown)
42 changes: 36 additions & 6 deletions Equinox/Equinox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
3D8467CE2899BB0C00D19E32 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3D8467CC2899BB0C00D19E32 /* InfoPlist.strings */; };
3D916CE428B1682700D29FFF /* HelpMenuLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D916CE328B1682700D29FFF /* HelpMenuLinks.swift */; };
F3003226213081F0008D1352 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3003225213081F0008D1352 /* AppDelegate.swift */; };
F30C86DC26D6CEE600F93E60 /* WallpaperType.swift in Sources */ = {isa = PBXBuildFile; fileRef = F30C86DB26D6CEE600F93E60 /* WallpaperType.swift */; };
F30C86E626DC761300F93E60 /* RoundedPushButtonExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F30C86E526DC761300F93E60 /* RoundedPushButtonExtensions.swift */; };
Expand Down Expand Up @@ -76,6 +78,9 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
3D8467CD2899BB0C00D19E32 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = "<group>"; };
3D8467CF2899BCDA00D19E32 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
3D916CE328B1682700D29FFF /* HelpMenuLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelpMenuLinks.swift; sourceTree = "<group>"; };
F3003222213081F0008D1352 /* Equinox.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Equinox.app; sourceTree = BUILT_PRODUCTS_DIR; };
F3003225213081F0008D1352 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
F300322C213081F0008D1352 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -278,6 +283,7 @@
F32BE0D326DD861B00CF90F8 /* AppIcon.xcassets */,
F300322C213081F0008D1352 /* Info.plist */,
F300322D213081F0008D1352 /* Equinox.entitlements */,
3D8467CC2899BB0C00D19E32 /* InfoPlist.strings */,
);
path = Resources;
sourceTree = "<group>";
Expand All @@ -299,6 +305,7 @@
F3D2EE4A267EDA18009704C5 /* ApplicationMenu.swift */,
F3E14A632742049400D986B6 /* DockMenu.swift */,
F3D2EE4F267EE774009704C5 /* MenuItem.swift */,
3D916CE328B1682700D29FFF /* HelpMenuLinks.swift */,
);
path = Menu;
sourceTree = "<group>";
Expand Down Expand Up @@ -339,6 +346,7 @@
TargetAttributes = {
F3003221213081F0008D1352 = {
CreatedOnToolsVersion = 10.0;
LastSwiftMigration = "";
SystemCapabilities = {
com.apple.Sandbox = {
enabled = 0;
Expand All @@ -354,6 +362,7 @@
knownRegions = (
en,
Base,
fr,
);
mainGroup = F3003219213081F0008D1352;
packageReferences = (
Expand All @@ -373,6 +382,7 @@
buildActionMask = 2147483647;
files = (
F32BE0D426DD861B00CF90F8 /* AppIcon.xcassets in Resources */,
3D8467CE2899BB0C00D19E32 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -381,6 +391,7 @@
/* Begin PBXShellScriptBuildPhase section */
F31A9E2926E9701B00135E49 /* Lint */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -395,7 +406,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if test -d \"/opt/homebrew/bin/\"; then\n PATH=\"/opt/homebrew/bin/:${PATH}\"\nfi\n\nexport PATH\n\nif which swiftlint >/dev/null; then\n cd ..\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "if test -d \"${HOME}/.mint/bin\"; then\n PATH=\"${HOME}/.mint/bin/:${PATH}\"\nfi\n\nif test -d \"/opt/homebrew/bin/\"; then\n PATH=\"/opt/homebrew/bin/:${PATH}\"\nfi\n\nexport PATH\n\nif which swiftlint >/dev/null; then\n cd ..\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -432,6 +443,7 @@
F329B3DE26F6838500A31035 /* WallpaperGalleryDataController.swift in Sources */,
F356C8B1272F78B500E915C6 /* SolarTimezoneController.swift in Sources */,
F30C86DC26D6CEE600F93E60 /* WallpaperType.swift in Sources */,
3D916CE428B1682700D29FFF /* HelpMenuLinks.swift in Sources */,
F3E7B05E26ADE71100287C60 /* GalleryContentViewExtensions.swift in Sources */,
F32F3778273AD25400A52762 /* WorkspaceRunner.swift in Sources */,
F3AC410E26D57AA1000A7253 /* WallpaperRootViewController.swift in Sources */,
Expand All @@ -451,6 +463,18 @@
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
3D8467CC2899BB0C00D19E32 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
3D8467CD2899BB0C00D19E32 /* fr */,
3D8467CF2899BCDA00D19E32 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
F3003239213081F0008D1352 /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down Expand Up @@ -486,6 +510,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2.0;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand All @@ -510,6 +535,7 @@
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -547,6 +573,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2.0;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -564,6 +591,7 @@
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -576,18 +604,19 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Equinox/Resources/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.rlxone.equinox;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -600,18 +629,19 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Equinox/Resources/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.rlxone.equinox;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
25 changes: 20 additions & 5 deletions Equinox/Equinox/Menu/ApplicationMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,32 @@ final class ApplicationMenu: NSMenu {

private var helpMenu: MenuItem {
let menu = MenuItem()
let menuSearch = MenuItem()
menuSearch.view = NSTextField()
menu.submenu = NSMenu(title: Localization.Menu.Help.help)
menu.submenu?.items = [
menuSearch
]
HelpMenuLinks.allCases.forEach { helpLink in
let menuItem = MenuItem(
title: helpLink.linkInfo.title,
keyEquivalent: "",
keyModifier: .command,
action: #selector(openURL(_:)),
target: self
)
menuItem.representedObject = helpLink.linkInfo.url
menu.submenu?.items.append(menuItem)
}
menu.submenu?.items.insert(MenuItem.separator(), at: 3)
return menu
}

@objc
private func new(_ sender: Any?) {
applicationDelegate?.applicationMenuNew(sender)
}

@objc
private func openURL(_ sender: NSMenuItem) {
guard let unwrappedURL = sender.representedObject as? URL else {
return
}
NSWorkspace.shared.open(unwrappedURL)
}
}
74 changes: 74 additions & 0 deletions Equinox/Equinox/Menu/HelpMenuLinks.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright (c) 2022 William Mead
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// Notwithstanding the foregoing, you may not use, copy, modify, merge, publish,
// distribute, sublicense, create a derivative work, and/or sell copies of the
// Software in any work that is designed, intended, or marketed for pedagogical or
// instructional purposes related to programming, coding, application development,
// or information technology. Permission for such use, copying, modification,
// merger, publication, distribution, sublicensing, creation of derivative works,
// or sale is expressly withheld.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import EquinoxAssets
import Foundation

enum HelpMenuLinks: CaseIterable {
case githubProject
case githubFAQ
case githubIssue
case equinoxWebsite
case macAppStoreReview
case productHunt

var linkInfo: (title: String, url: URL?) {
switch self {
case .githubProject:
return (
Localization.Menu.Help.githubProject,
URL(string: "https://github.com/rlxone/Equinox")
)
case .githubFAQ:
return (
Localization.Menu.Help.githubFAQ,
URL(string: "https://github.com/rlxone/Equinox#faq")
)
case .githubIssue:
return (
Localization.Menu.Help.githubIssue,
URL(string: "https://github.com/rlxone/Equinox/issues")
)
case .equinoxWebsite:
return (
Localization.Menu.Help.equinoxWebsite,
URL(string: "https://equinoxmac.com")
)
case .macAppStoreReview:
return (
Localization.Menu.Help.macAppStoreReview,
URL(string: "https://apps.apple.com/us/app/equinox-create-wallpaper/id1591510203?action=write-review")
)
case .productHunt:
return (
Localization.Menu.Help.productHunt,
URL(string: "https://www.producthunt.com/products/equinox")
)
}
}
}
4 changes: 2 additions & 2 deletions Equinox/Equinox/Menu/MenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ final class MenuItem: NSMenuItem {
keyEquivalent charCode: String,
keyModifier: NSEvent.ModifierFlags,
action selector: Selector?,
target: AnyObject = self as AnyObject,
target: AnyObject? = nil,
isEnabled: Bool = true
) {
super.init(title: string, action: selector, keyEquivalent: charCode)
keyEquivalentModifierMask = keyModifier
self.keyEquivalentModifierMask = keyModifier
self.isEnabled = isEnabled
self.target = target
}
Expand Down
9 changes: 7 additions & 2 deletions Equinox/Equinox/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,27 @@
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>fr</string>
</array>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>5</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2021 rlxone. All rights reserved.</string>
<string>Copyright © 2022 rlxone. All rights reserved.</string>
<key>NSLocationUsageDescription</key>
<string>Equinox wants to use your location for making more correct solar calculations</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 2 additions & 0 deletions Equinox/Equinox/Resources/en.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NSHumanReadableCopyright = "Copyright © 2022 rlxone. All rights reserved.";
NSLocationUsageDescription = "Equinox wants to use your location for making more correct solar calculations";
2 changes: 2 additions & 0 deletions Equinox/Equinox/Resources/fr.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NSHumanReadableCopyright = "Copyright © 2022 rlxone. Tous droits réservés.";
NSLocationUsageDescription = "Equinox a besoin d'utiliser votre position pour faire des calculs solaires adaptés à votre région.";
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ final class SolarMainViewController: ViewController {
}

private func reloadChartData() {
let calendar = timezoneController.calendar
let calendar = getCurrentCalendar

let startTime = calendar.startOfDay(for: latestDate)
var chartData: [InteractiveLineChart.ChartData] = []
Expand Down
Loading

0 comments on commit 3cfd61e

Please sign in to comment.