112 Commits

Author SHA1 Message Date
Allan Odgaard
94d3b9b670 Remove old build files 2021-02-15 16:01:50 +01:00
Allan Odgaard
f7d765ba0e Add build files (for new build system) 2021-02-15 16:01:50 +01:00
Allan Odgaard
8e6c60d013 build: Remove Info.plist files from frameworks
These were previously required when we built frameworks as dynamically linked, but the files are now explicitly ignored by our build system.
2021-01-24 10:37:22 +01:00
Allan Odgaard
bcd44a8d14 Ensure we are running on the main thread when updating property
Since we bind the disabled state of the “Check Now” button (in preferences) to this property, we cannot update the property in a background thread, as the UI can only be updated from the main thread.
2021-01-13 22:59:11 +01:00
Allan Odgaard
53897ce4d5 Improve “estimated time remaining” code for software update
Use int64_t instead of NSUInteger, check against NSURLSessionTransferSizeUnknown, and ensure that completedUnitCount is the last thing we set on the NSProgress object, so that there is no potential race condition with a progress object being completed, but still having a non-zero estimated time remaining value.
2021-01-11 12:09:02 +01:00
Allan Odgaard
58d1cce527 Do not rely on OakSetupKeyViewLoop to set initial first responder
We either set it explicitly or rely on automatic key view loop calculations.

As for the latter: When auto-layout was initially introduced, the automatic key view loop calculation broke, as it used the view frames before layout. It should have been fixed several OS versions ago though, so we can use it again, as long as we are not working with view-based table views.
2020-05-25 12:47:47 +07:00
Allan Odgaard
7369f785c2 Improve log message for a failed download 2020-05-24 17:27:16 +07:00
Allan Odgaard
a3cd28370a Move OakCompareVersionStrings function to SoftwareUpdate framework 2020-05-24 17:27:16 +07:00
Allan Odgaard
fda314ef9b Move OakDownloadManager to SoftwareUpdate framework 2020-05-24 17:27:16 +07:00
Allan Odgaard
e38dc44ab8 Rewrite SoftwareUpdate singleton
Changes:

- Use NSURLSession and OakDownloadManager to download updates (instead of libcurl).
- Use NSFileManager’s replaceItemAtURL:… to update the application bundle (instead of custom code).
- Use NSTask to relaunch the application (instead of fork/exec).
- Use the same window for the initial prompt, and for showing download progress.
- Show estimated time remaining in download window (via NSProgress).
- Allow retrying downloads on various forms of failures.
- Don’t require xib file for download window.

Regressions:

- We no longer support updating the application as root: I tried using an authorized NSFileManager instance, but it did not work for me, and the previous code we used for this was using legacy APIs.
2020-05-24 17:27:16 +07:00
Allan Odgaard
2de550b16c Switch from using version::less → OakCompareVersionStrings 2020-05-24 17:14:09 +07:00
Allan Odgaard
cfb523e713 Remove tests for software update framework
The code being tested is scheduled for replacement and it’ll be too cumbersome to update these tests.
2020-05-22 21:48:09 +07:00
Allan Odgaard
3f21f65a4a Remove ‘lastPoll’ property from software update controller 2020-05-22 21:48:09 +07:00
Allan Odgaard
9a2eef2b50 Make kUserDefaultsLastSoftwareUpdateCheckKey public 2020-05-22 21:48:09 +07:00
Allan Odgaard
dce26956e7 Rename methods and constants to use software update in singular form
The program only checks for a single update.
2020-05-22 21:48:09 +07:00
Allan Odgaard
300624b20e Don’t let software update framework expose DownloadWindowController 2020-05-22 21:48:09 +07:00
Allan Odgaard
05cf51d42e Move software update signing key to Info.plist
This simplifies usage of the software update singleton and still allows to use it in other projects that have different signing key(s).
2020-05-22 21:48:09 +07:00
Allan Odgaard
ad1cc8abd8 Deliver all NSUserDefaultsDidChangeNotification in main queue
This is easier than ensuring that we do not update user defaults from a background thread.
2020-05-14 09:52:38 +07:00
Allan Odgaard
57336423ca Remove unused user defaults key 2020-05-13 18:49:55 +07:00
Allan Odgaard
7723831d48 Use imageWithSize:flipped:drawingHandler: instead of OakImage
Also increase size of the badge to one third of the app icon (instead of a quarter).
2020-04-29 08:02:02 +07:00
Allan Odgaard
59ca4f35a4 Remove unused include 2020-04-29 08:02:02 +07:00
Allan Odgaard
d38688d0ff Revise some include statements 2020-04-25 23:11:32 +07:00
Allan Odgaard
b514114ec7 Access most system singletons using dot syntax
These are identified by having a prefix of shared, default, or standard in the class method.
2020-04-23 12:25:11 +07:00
Allan Odgaard
715d023673 Declare “sharedInstance” as a class property 2020-04-23 12:25:11 +07:00
Allan Odgaard
8f3f3d9d16 Update deployment version for xibs to 10.12
This was done using search and replace. Presumably it should be done in Xcode so that it can adjust the xib for the new deployment target, otherwise what is the point of storing deployment version in the xib and provide it as a command line argument to the xib compiler as well (only to get a warning if the versions do not match)?
2019-07-07 18:03:30 +02:00
Allan Odgaard
1ef78b3af7 Rename symbols to what’s expected by the 10.14 SDK 2019-06-29 20:14:15 +02:00
Allan Odgaard
5aa58e5543 Do not include $APP_NAME in framework’s bundle identifier
Since we have multiple application targets, it doesn’t make sense with a global APP_NAME variable.

Though if building the frameworks as standalone bundles and embedding them in different applications, we may need some sort of unique component in the bundle identifier, but we currently do not do this (they are all statically linked, so the Info.plist is currently unused).
2019-06-26 23:32:54 +02:00
Allan Odgaard
82de01589f Update deployment target of all xib files to 10.10 2018-10-30 13:46:34 +07:00
Allan Odgaard
f6fa273912 Update coding style for where to place colon after dictionary keys
This follows the Swift style and also makes it possible to align dictionary values using TextMate’s Align Assignments command.
2018-10-07 09:54:45 +02:00
Ronald Wampler
dfecd02e62 Fix typo: 'therefor' → 'therefore' 2018-10-03 20:16:50 +02:00
Allan Odgaard
0e863b76ea Use title case for software update error dialog 2018-07-30 22:37:35 +02:00
Allan Odgaard
177321e3c4 Warn user when running on a read-only file system.
See https://mjtsai.com/blog/2016/06/16/gatekeeper-path-randomization/ for details.
2018-07-30 22:37:35 +02:00
Allan Odgaard
52fda481dc Change beta/nightly software update constants to prerelease/canary 2018-06-28 10:40:27 +02:00
Allan Odgaard
e70791ee89 Rename a bunch of constants to fix deprecation warnings (10.12) 2018-06-16 22:55:30 +02:00
Allan Odgaard
06bd8b2be0 Add a ‘didUpdateFrom’ argument when relaunching during software update 2017-10-08 20:17:43 +02:00
Allan Odgaard
a8b7906a4b Do not hardcode bundle identifier in Caches path 2017-10-08 20:12:14 +02:00
Allan Odgaard
6893bceae6 Accept application/json for version update information 2017-10-08 19:54:32 +02:00
Allan Odgaard
81d1f84a2c Change sw_update.cc → sw_update.mm 2017-10-08 09:13:03 +02:00
Allan Odgaard
e804a57e04 Change name of property setter: isChecking → checking 2017-10-02 20:53:05 +02:00
Allan Odgaard
8d56ad455a Use NSBundle API instead of oak::application_t 2017-10-02 20:53:05 +02:00
Allan Odgaard
5bc450f56f Move instance variables from implementation to interface block 2017-10-02 20:53:05 +02:00
Ronald Wampler
b8143a626c Avoid use of NSRunInformationalAlertPanel (10.9)
Although this is actually deprecated in 10.10, new APIs are available in 10.9 and it will make addressing deprecation warnings when upgrading to 10.10 easier.
2017-05-31 21:58:31 +02:00
Ronald Wampler
9fae8a3192 Update deployment target to 10.9 for all xib files 2017-05-31 10:03:41 +02:00
Allan Odgaard
9d980a07df Remove NSPrincipalClass from framework bundles’s Info.plist
This is not something which is used anywhere and a few of the frameworks does not have a principal class.
2016-10-31 17:30:30 +07:00
mathbunnyru
440414f96c Use nullptr in all C++ files instead of NULL
This brings us a bit of extra type safety, for example where an integer is expected, nullptr should be disallowed by the compiler (unlike NULL).
2016-10-22 21:40:14 +07:00
mathbunnyru
d6db299a8f Changed from NULL to nullptr in variadic templates for portability 2016-10-19 00:59:11 +03:00
Allan Odgaard
7cc017f343 Harmonize all implementations of sharedInstance 2016-09-19 12:54:19 +02:00
Allan Odgaard
46fb745bbe Use perrorf when printing errors with dynamic strings
Also revise error messages to be more consistent.
2016-08-28 17:25:26 +02:00
Allan Odgaard
dbdfa3c6af Add identifying information to perror output 2016-08-21 12:09:30 +02:00
Allan Odgaard
7dd19c0c0e Update deployment target to 10.8 for all xib files 2016-06-22 20:43:28 +02:00