Commit Graph

5515 Commits

Author SHA1 Message Date
Allan Odgaard
3818da6410 Remove support for NSNull in OakSetupKeyViewLoop
Also specify the object type (NSView*) for the arrays passed to OakSetupKeyViewLoop and OakAddAutoLayoutViewsToSuperview.
2020-05-25 12:47:47 +07:00
Allan Odgaard
74e03499ab Do not pass NSNull objects to OakSetupKeyViewLoop for non-existing views
We only need this in one location, and it’s easy to handle at that call-site, rather than add complexity to something which is already a little opaque.
2020-05-25 12:39:58 +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
2b6d0de95b Remove version::less (C++) API 2020-05-24 17:14:09 +07:00
Allan Odgaard
2de550b16c Switch from using version::less → OakCompareVersionStrings 2020-05-24 17:14:09 +07:00
Allan Odgaard
6349447f67 Introduce OakCompareVersionStrings wrapper and use in tests 2020-05-24 17:14:09 +07:00
Allan Odgaard
a40c840040 Change version.cc from C++ to Objective-C++ 2020-05-24 17:14:09 +07:00
Allan Odgaard
caedb11305 Add read/write subview property to OakTransitionViewController
This feels like a better API than the previous transitionToView: method.
2020-05-22 21:48:09 +07:00
Allan Odgaard
7aed23f5ad Connect “Check Now” button directly to software update controller 2020-05-22 21:48:09 +07:00
Allan Odgaard
0731c1cde1 Remove log message when trying to update bundle index
This already happens in an os_activity block which produce a similar log message.
2020-05-22 21:48: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
e9a873a5d0 Rename OakNetworkManager files to OakDownloadManager 2020-05-22 21:48:09 +07:00
Allan Odgaard
bafc8f0f3e Rename OakNetworkManager class to OakDownloadManager 2020-05-22 21:48:09 +07:00
Allan Odgaard
0a66805df5 Let software update preferences bind directly to user defaults
We would go through ‘self’ only to unify things in the xib file, as some values are stored via .tm_properties.
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
87667e04ae Refactor software update preferences
We now use kUserDefaultsLastSoftwareUpdateCheckKey to obtain “last check” and observe user defaults for changes.

Also eliminate local mirroring of software update controller properties and other minor tweaks.
2020-05-22 21:48:09 +07:00
Allan Odgaard
9a2eef2b50 Make kUserDefaultsLastSoftwareUpdateCheckKey public 2020-05-22 21:48:09 +07:00
Allan Odgaard
2c407be15b Obtain OS version via NSProcessInfo.processInfo.operatingSystemVersion
The oak::os_major, oak::os_minor, and oak::os_patch functions are wrapping deprecated API.
2020-05-22 21:48:09 +07:00
Allan Odgaard
3ea2cd2423 Use compile-time string concatenation instead of %s 2020-05-22 21:48:09 +07:00
Allan Odgaard
e98dd0ce32 Change key (in session state) used to store file browser state
We changed the type of file browser state from NSDictionary → NSData in 4a1e9113f3.

While we do check the type of the object read, previous versions did not, so if the user runs latest version of TextMate, and then downgrades, they will have state that cannot be read by the older version of TextMate (and will cause exception during launch, incase file browser state is restored).
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
733ab302e2 Change variable name: observerId → token
Several places already used ‘token’ as the name for the result from NSNotificationCenter’s addObserver:… so this change is to be consistent.

While ‘token’ is less meaningful than ‘observerId’, the variable is only used with NSNotificationCenter API where the context makes it clear.
2020-05-22 21:48:09 +07:00
Allan Odgaard
569dc9a198 Make token used in notification block weak as it retains the block
This is not made clear from the documentation, however, the documentation does state that the token will be strongly held by the notification center, until the notification is removed, therefore it is safe to only keep a weak reference to the token (even if the implementation should change).
2020-05-22 21:48:09 +07:00
Allan Odgaard
6d045e2fd7 Update URL schemes (mainly in comments) to use https 2020-05-22 21:48:09 +07:00
Allan Odgaard
dcd630e649 Use constants for find panel and font manager tag values in main menu 2020-05-22 21:48:09 +07:00
Allan Odgaard
43b6548d5e Close NSFileHandle instances obtained from NSPipe when done writing
The documentation is not clear on whether or not file handles from an NSPipe will be automatically closed, so to be safe, we close them manually.
2020-05-22 21:48:09 +07:00
Allan Odgaard
b693db4fd1 Use NSDictionary for SCM repository variables (instead of std::map) 2020-05-22 21:48:09 +07:00
Allan Odgaard
6108a437c1 Check for NULL_STR when producing error message from uuid_t constructor 2020-05-22 21:48:09 +07:00
Allan Odgaard
8200f445bc Use a dynamic name for the commit window’s service 2020-05-22 21:48:09 +07:00
Allan Odgaard
43db695fd3 Update to use non-deprecated NSButtonType constant names 2020-05-22 21:48:09 +07:00
Allan Odgaard
66c1bc7f78 Clear background when using a theme with transparent background
This partially reverts 6ffd0f2e92

While we do not support transparent themes per se, we still use the alpha colors and thus would previously fill the background using alpha, into a layer that we hadn’t previously cleared.
2020-05-17 08:15:55 +07:00
Allan Odgaard
af8b51f629 Use std::optional for variable lookup function used by format string 2020-05-17 08:15:55 +07:00
Allan Odgaard
7b51a4fbeb Use std::optional for the result of scope::selector_t::does_match
This does change ranking of the wildcard scope selector, as incase of a wildcard match, the old code did not change the rank, so it would be up the caller, which was 1 for bundle item matching but 0 for settings and theme matching.
2020-05-17 08:15:55 +07:00
Allan Odgaard
a0087330fc Use std::optional for the result of item_t::does_match
This avoids having to pass a pointer for the actual rank (incase of a match).
2020-05-17 08:15:55 +07:00
Allan Odgaard
25ff20fbb4 Avoid accessing the find results view until we really need it
This is to postpone constructing the view: It’s probably not costly to construct it before we need it, but everything adds up, and it just feels proper to avoid constructing the views of view controllers until as late as possible.
2020-05-17 08:15:55 +07:00
Allan Odgaard
d0fe8a0513 Do not create Find dialog until loadWindow is called 2020-05-17 08:15:55 +07:00
Allan Odgaard
2216df2c9b Fix vertical truncation of checkbox labels in find dialog
We now add some bottom padding to the containing grid view, as it may be oblivious to alignment rectangles, and would therefore snap to the bottom of the checkbox label’s alignment rectangle, clipping anything drawn outside of it.
2020-05-16 11:46:33 +07:00
Allan Odgaard
2e5d4d1d6b Checkin release notes for 2.0.15 v2.0.15 2020-05-16 07:24:33 +07:00
Allan Odgaard
d04c76b15b QuickLook plug-in selects theme the same as TextMate (supporting auto) 2020-05-16 07:12:01 +07:00
Allan Odgaard
6ffd0f2e92 Avoid potential crash by not updating window’s opaque property
This does completely remove support for transparent themes, but any recent version of macOS would not support it anyway due to layer-backed views.

The crash resulting from setting opaque is because of recursion: After session restore, the window will calculate shadow, this triggers a “user defaults did change” notification, which updates theme of text view, which sets opaque, which re-calculates shadow and tries to recursively obtain a non-recursive mutex.
2020-05-16 07:12:01 +07:00
Allan Odgaard
c5d58c4ac8 Improve API for adding a folder submenu 2020-05-16 07:12:01 +07:00
Allan Odgaard
94022fb4f7 Simplify implementation of parentMenuItem 2020-05-16 07:12:01 +07:00
Allan Odgaard
2134480791 Checkin release notes for 2.0.14 v2.0.14 2020-05-14 20:48:49 +07:00
Ronald Wampler
dde90fe4f5 Fix crash in AboutWindowController when license owner is nil 2020-05-14 20:42:52 +07:00
Allan Odgaard
666d93db27 Checkin release notes for 2.0.13 v2.0.13 2020-05-14 15:52:43 +07:00