Browse Source

Minor changes.

pull/113/head
Abhishek 3 years ago
parent
commit
59a9cc2d64
  1. 5
      Clocker/Panel/ParentPanelController.swift
  2. 9
      Clocker/Panel/Rate Controller/ReviewController.swift
  3. 47
      Clocker/Preferences/OneWindowController.swift

5
Clocker/Panel/ParentPanelController.swift

@ -686,8 +686,7 @@ class ParentPanelController: NSWindowController {
}
@objc private func openPreferencesWindow() {
oneWindow?.showWindow(nil)
NSApp.activate(ignoringOtherApps: true)
oneWindow?.openGeneralPane()
}
@IBAction func dismissNextEventLabel(_: NSButton) {
@ -724,7 +723,7 @@ class ParentPanelController: NSWindowController {
}
private func showPermissionsWindow() {
oneWindow?.openPermissions()
oneWindow?.openPermissionsPane()
NSApp.activate(ignoringOtherApps: true)
}

9
Clocker/Panel/Rate Controller/ReviewController.swift

@ -50,7 +50,7 @@ final class ReviewController {
let lastVersion = storage.object(forKey: Keys.lastVersion) as? String
else { return true }
// Minimum interval between two versions should be 45
// Minimum interval between two versions should be 3 months
let minInterval: TimeInterval = day * 90
// never prompt w/in the same version
@ -60,13 +60,12 @@ final class ReviewController {
}
class func prompt() {
guard let ratingsURL = URL(string: AboutUsConstants.AppStoreLink) else {
return
}
if #available(OSX 10.14, *) {
SKStoreReviewController.requestReview()
} else {
guard let ratingsURL = URL(string: AboutUsConstants.AppStoreLink) else {
return
}
NSWorkspace.shared.open(ratingsURL)
}

47
Clocker/Preferences/OneWindowController.swift

@ -50,23 +50,7 @@ class OneWindowController: NSWindowController {
window?.backgroundColor = Themer.shared().mainBackgroundColor()
window?.identifier = NSUserInterfaceItemIdentifier("Preferences")
}
func openPermissions() {
guard let window = window else {
return
}
if !window.isMainWindow || !window.isVisible {
showWindow(nil)
}
guard let tabViewController = contentViewController as? CenteredTabViewController else {
return
}
tabViewController.selectedTabViewItemIndex = 3
}
private func setupToolbarImages() {
guard let tabViewController = contentViewController as? CenteredTabViewController else {
return
@ -92,4 +76,33 @@ class OneWindowController: NSWindowController {
}
}
}
// MARK: Public
func openPermissionsPane() {
openPreferenceTab(at: 3)
NSApp.activate(ignoringOtherApps: true)
}
// Action mapped to the + button in the PanelController. We should always open the General Pane when the + button is clicked.
func openGeneralPane() {
openPreferenceTab(at: 0)
NSApp.activate(ignoringOtherApps: true)
}
private func openPreferenceTab(at index: Int) {
guard let window = window else {
return
}
if !window.isMainWindow || !window.isVisible {
showWindow(nil)
}
guard let tabViewController = contentViewController as? CenteredTabViewController else {
return
}
tabViewController.selectedTabViewItemIndex = index
}
}

Loading…
Cancel
Save