Skip to content

Commit dfa2a30

Browse files
author
Ehlen, David
committed
#26 show update activity indicator
1 parent 3acdbc4 commit dfa2a30

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

Capture/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>0.9.2</string>
20+
<string>0.9.3</string>
2121
<key>CFBundleVersion</key>
22-
<string>0.9.2</string>
22+
<string>0.9.3</string>
2323
<key>LSMinimumSystemVersion</key>
2424
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
2525
<key>NSHumanReadableCopyright</key>

Capture/Preferences/View/GeneralPreferencesViewController.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import Cocoa
22
import KeyHolder
33
import Magnet
44
import os
5+
import PromiseKit
56

67
class GeneralPreferencesViewController: PreferencesViewController {
78

89
// MARK: - Properties
910
@IBOutlet private weak var stopRecordingShortcutRecordView: RecordView!
11+
@IBOutlet private weak var updateActivityIndicator: NSProgressIndicator!
1012

1113
// MARK: - Initialize
1214
override func loadView() {
@@ -17,14 +19,26 @@ class GeneralPreferencesViewController: PreferencesViewController {
1719
prepareHotKeys()
1820
}
1921

20-
@IBAction func userRequestedAnExplicitUpdateCheck(_ sender: Any) {
22+
@IBAction func userRequestedAnExplicitUpdateCheck(_ sender: NSButton) {
2123
let delegate = NSApplication.shared.delegate as? AppDelegate
24+
25+
updateActivityIndicator.startAnimation(nil)
26+
updateActivityIndicator.isHidden = false
27+
sender.isEnabled = false
28+
2229
delegate?.updater.check().catch(policy: .allErrors) { error in
30+
self.updateActivityIndicator.stopAnimation(nil)
31+
sender.isEnabled = true
32+
2333
if error.isCancelled {
2434
showAlert(title: "alreadyUpToDateTitle".localized, message: ErrorMessageProvider.string(for: AppUpdaterError.alreadyUpToDate))
2535
} else {
2636
self.presentError(NSError.create(from: AppUpdaterError.failure(error.localizedDescription)))
2737
}
38+
}.finally {
39+
self.updateActivityIndicator.stopAnimation(nil)
40+
self.updateActivityIndicator.isHidden = true
41+
sender.isEnabled = true
2842
}
2943
}
3044
}

Capture/Preferences/View/Preferences.storyboard

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,21 @@
141141
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
142142
</textFieldCell>
143143
</textField>
144+
<progressIndicator hidden="YES" wantsLayer="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="aCH-uL-5ms">
145+
<rect key="frame" x="351" y="61" width="16" height="16"/>
146+
</progressIndicator>
144147
</subviews>
145148
<constraints>
146149
<constraint firstAttribute="trailing" secondItem="btq-nd-DrW" secondAttribute="trailing" constant="20" id="078-OX-KBz"/>
147150
<constraint firstItem="xix-mN-5C6" firstAttribute="leading" secondItem="IDG-1b-v6d" secondAttribute="trailing" constant="10" id="3UI-KT-DWK"/>
148151
<constraint firstAttribute="trailing" secondItem="Maz-20-LlC" secondAttribute="trailing" constant="20" id="41h-OP-eMs"/>
149152
<constraint firstItem="K7Z-TW-8U8" firstAttribute="centerY" secondItem="UDU-Gc-nF1" secondAttribute="centerY" id="7fS-hS-Mf1"/>
153+
<constraint firstItem="aCH-uL-5ms" firstAttribute="leading" secondItem="OBT-6X-HhQ" secondAttribute="trailing" constant="8" id="89v-xc-R4n"/>
150154
<constraint firstItem="btq-nd-DrW" firstAttribute="leading" secondItem="IDG-1b-v6d" secondAttribute="leading" id="8Cv-GA-lj2"/>
151155
<constraint firstItem="Y8G-g4-hdo" firstAttribute="leading" secondItem="4Ei-kU-JuY" secondAttribute="leading" constant="20" id="AgO-fd-4zk"/>
152156
<constraint firstItem="BYr-zV-DCp" firstAttribute="top" secondItem="Maz-20-LlC" secondAttribute="bottom" constant="20" id="Bro-qe-PVH"/>
153157
<constraint firstItem="Maz-20-LlC" firstAttribute="top" secondItem="K7Z-TW-8U8" secondAttribute="bottom" constant="10" id="DlR-2F-fjH"/>
158+
<constraint firstItem="aCH-uL-5ms" firstAttribute="centerY" secondItem="OBT-6X-HhQ" secondAttribute="centerY" id="EJV-Ud-3Sa"/>
154159
<constraint firstItem="IDG-1b-v6d" firstAttribute="top" secondItem="4Ei-kU-JuY" secondAttribute="top" constant="20" id="Exg-sT-rCA"/>
155160
<constraint firstItem="Y8G-g4-hdo" firstAttribute="top" secondItem="OBT-6X-HhQ" secondAttribute="bottom" constant="10" id="FL5-cX-QmI"/>
156161
<constraint firstItem="OBT-6X-HhQ" firstAttribute="leading" secondItem="BYr-zV-DCp" secondAttribute="trailing" constant="10" id="OFT-n9-A8z"/>
@@ -169,6 +174,7 @@
169174
</view>
170175
<connections>
171176
<outlet property="stopRecordingShortcutRecordView" destination="K7Z-TW-8U8" id="v6c-pU-Fzg"/>
177+
<outlet property="updateActivityIndicator" destination="aCH-uL-5ms" id="qBn-Wk-ExD"/>
172178
</connections>
173179
</viewController>
174180
<customObject id="FvE-cN-eWk" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>

0 commit comments

Comments
 (0)