47 Commits

Author SHA1 Message Date
Allan Odgaard
fb7c2cef3f Use NSUserDefaults’s specialized «type»ForKey: 2016-06-20 11:43:40 +02:00
Allan Odgaard
ebf20acc20 Prefer CFBundleShortVersionString over CFBundleVersion 2014-11-10 09:01:05 +01:00
Allan Odgaard
2f1c4c05c4 Do not use ‘timeIntervalSinceNow’ with dates in the past
We previously negated the result but now we instead ask for [[NSDate date] timeIntervalSinceDate:startDate].
2014-08-21 16:07:23 +02:00
Allan Odgaard
603f06d2db Move version comparison out of s/w update framework 2014-04-25 16:55:31 +07:00
Allan Odgaard
1f0e3db472 Remove trailing zeroes from numeric literals
I mainly dislike the trailing zeroes because CGFloat used to be a float but 1.0 is a double (1.0f would be a float). So better to under-specify and let the compiler figure out the proper type.
2014-04-14 14:26:52 +07:00
Allan Odgaard
cf8f796053 Do not use va_start macro with variable reference
This is undefined according to the standard and is a warning with clang-503.0.38.
2014-03-13 20:51:15 +07:00
Allan Odgaard
1e11a30a53 Remove redundant storage keywords for @property
These were required prior to the new 64 bit run-time.
2014-03-05 16:39:54 +07:00
Allan Odgaard
c2397484b8 Use C++11 for loop
Majority of the edits done using the following ruby script:

    def update_loops(src)
      dst, cnt = '', 0

      block_indent, variable = nil, nil
      src.each_line do |line|
        if block_indent
          if line =~ /^#{block_indent}([{}\t])|^\t*$/
            block_indent = nil if $1 == '}'
            line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
              $1.to_s + variable + ($2 == "->" ? "." : "")
            end
          else
            block_indent = nil
          end
        elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
          block_indent, variable = $1, $2
          line = "#$1for(auto const& #$2 : #$3\n"
          cnt += 1
        end
        dst << line
      end
      return dst, cnt
    end

    paths.each do |path|
      src = IO.read(path)

      cnt = 1
      while cnt != 0
        src, cnt = update_loops(src)
        STDERR << "#{path}: #{cnt}\n"
      end

      File.open(path, "w") { |io| io << src }
    end
2014-03-03 10:34:13 +07:00
Allan Odgaard
e4e80a946c Use std::make_shared 2013-09-03 12:27:20 +02:00
Allan Odgaard
ee10f79ed4 Fix non-retaining Objective-C property
The ‘lastVersionDownloaded’ property used ‘assign’ (since it used to be an integer) which meant TextMate would likely crash when the property was read (and had a non-nil value), which it would, when TextMate did a version check after already having downloaded an update (but not yet installed and relaunched).

Also drop the atomic requirement of the ‘archive’ property since we no longer access it from multiple threads.
2013-08-03 11:54:52 +02:00
Allan Odgaard
8d51e930e3 Ensure version_less(NULL_STR, «any») → true 2013-08-02 16:21:21 +02:00
Allan Odgaard
33a47898e1 Remove revision field from version_info_t 2013-07-02 18:43:46 +02:00
Allan Odgaard
9adac35f86 Use complex version string during software update checks
While it is simpler to compare a monotonically increasing integer (the revision), we always use the semantic version string in the user interface, meaning that this version string should change together with the revision, which effectively means we are maintaing two version numbers.

We previously embedded the revision in the version string (2.0-alpha.$revision) but when going from alpha → beta, it would be nice to reset the visible counter, so that first beta becomes 2.0-beta.1, furthermore, test versions could benefit from a more descriptive version string, e.g. “2.0-alpha.9439.2+debug” would be the second (semi-public) debug build after “2.0-alpha.9439”.
2013-07-02 18:43:46 +02:00
Allan Odgaard
6c2ed2053d Trim version string received from server 2013-07-02 18:43:46 +02:00
Allan Odgaard
dc1a53aa38 Add code for comparing complex version strings 2013-07-02 18:43:46 +02:00
Allan Odgaard
8017428011 If deleting old version fails then move it to trash
We also add a time suffix to the old version so that if we fail to remove it, the user will not get (another) error when retrying the update.

Presumably fixes #991.
2013-05-26 13:32:46 +08:00
Allan Odgaard
b489687403 Disable AuthorizationExecuteWithPrivileges deprecation warning
The “proper” replacement for this API is to use the ServiceManagement framework’s SMJobBless() to bless our helper tool. In two of the three use-cases our helper tool is however regular shell commands, so it seems redundant to wrap these shell tools as helper tools we can install as launchd jobs.
2013-05-06 14:51:31 +07:00
Allan Odgaard
04963caf01 Remove use of deprecated method 2013-04-09 15:39:38 +07:00
Allan Odgaard
b8c81b4acf Fix software updater to not skip checking
Initially ‘downloadWindow’ was a property that was nil until we showed the download window, but now that the download window is re-used for downloading newer versions (incase a newer version appear before user does the “Install & Relaunch”) the fetching the property will return the window (and create it if not already created).
2013-03-28 22:01:40 +01:00
Allan Odgaard
e1e0e5a8a5 Re-use download window if already visible
This is useful if a new update arrives after TextMate has downloaded the previous update but before the user relaunched TextMate.

Fixes #909.
2013-03-19 16:24:56 +01:00
Allan Odgaard
769831f629 Use Objective-C literals 2013-03-19 15:49:18 +01:00
Allan Odgaard
c65e0718e6 Show human readable version string
This is instead of only showing the revision, which lack semantic info such as ‘alpha’ and 2.0 versus 1.5.11.

We now also show the version after a successful download instead of just “Download Completed”.
2013-02-15 15:27:55 +01:00
Allan Odgaard
50a7c17dbd Use initializer list with path::join 2013-02-12 11:09:24 +01:00
Allan Odgaard
ad03811df0 Ensure session restore when relaunching
The user can manually disable session restore, which is undesired when relaunching due to a software update or installing a plug-in, so we now override the user’s choice for the new instance launched.
2013-02-11 14:21:22 +01:00
Allan Odgaard
d00b9b34aa Change how we update TextMate.app
We now keep the root folder and instead replace the inner Contents folder — hopefully this way LaunchServices won’t add the update as a new entry (causing duplicates to show up in the Open With menu).
2013-01-21 15:03:52 +01:00
Allan Odgaard
0208414672 Download s/w updates to cache folder
This should hopefully solve the issue with the (on some systems) fairly aggressive temp cleaner.

Also remove the archive incase the user cancels the update, now that we are extracting it to a less temporary location.
2013-01-21 15:03:52 +01:00
Allan Odgaard
47fa0f040c Use Objective-C literals for YES/NO 2013-01-02 01:46:48 +01:00
Allan Odgaard
09abc8eede Fix software update logic
It would previously not ask to update (but go directly to download) when doing a manual update check.
2012-12-24 14:09:41 +01:00
Allan Odgaard
601cf28366 Use the low priority dispatch queue for update checks
Presently mainly a semantic change, as the dispatch queues are mostly empty, but as we adopt GCD for more things, it’ll be more important to put background tasks in a queue with lower priority than the one handling user requested tasks.
2012-12-20 14:02:39 +01:00
Allan Odgaard
c7780d1392 Add placeholder text for “time remaining” 2012-12-20 14:02:39 +01:00
Allan Odgaard
cd78f6d29d Eliminate two instance variables 2012-12-20 14:02:39 +01:00
Allan Odgaard
97ca44f8ad Use NSRunningApplication for application name 2012-12-19 19:42:45 +01:00
Allan Odgaard
f87a11f1bb Improve s/w update dialog text
A “Downgrade” button now appear if the version on the server is lower than the current one. This would e.g. happen if the user has upgraded to a nightly build and does a manual version check (for non-nightly builds).

If the version on the server is the same version as the one running, the user can make a “Redownload” button appear by holding down shift (⇧) when running the update check.
2012-12-19 19:42:45 +01:00
Allan Odgaard
0bac97c9ae Use GCD + blocks for s/w update download 2012-12-19 19:42:45 +01:00
Allan Odgaard
6969d7a98e Use GCD + blocks for s/w update check 2012-12-19 19:42:36 +01:00
Allan Odgaard
88358ccf26 ARC: Update SoftwareUpdate framework 2012-12-19 19:42:36 +01:00
Allan Odgaard
ed45e1a241 Handle download in s/w update singleton 2012-12-19 19:42:35 +01:00
Allan Odgaard
4a25c7b98d Refactor software update
Move logic out of DownloadWindowController.
2012-12-19 19:42:35 +01:00
Allan Odgaard
0834649011 Improve binding properties
Each property now correspond to exactly one aspect of the UI allowing us to remove the logic and use the class as a view.
2012-12-19 19:42:35 +01:00
Allan Odgaard
476247b047 Use generated properties 2012-12-19 19:42:35 +01:00
Allan Odgaard
6272ea40e8 Remove release notes handling
This doesn’t really belong in the software update framework.
2012-09-29 00:20:38 +02:00
Allan Odgaard
983bce86aa Use @autoreleasepool blocks 2012-09-25 12:30:12 +02:00
Jacob Bandes-Storch
dfdde3283f Use 64-bit: explicit visibility where required 2012-08-28 21:32:47 +02:00
Jacob Bandes-Storch
e3aa997b06 Use libc++: replace std::tr1 with std 2012-08-28 13:30:20 +02:00
Allan Odgaard
6949361558 Release notes no longer a floating window
Floating windows are not part of the normal window cycle chain (⌘`) so should be avoided. This was mainly done to ensure that the notes are on top at launch (where other windows may open, and the order of this is sort of undefined) — what we do now is use performSelector:withObject:afterDelay: — on a general note, using the afterDelay: methods is a big no-no!!! But as long as we only have one thing do it, and it’s for showing a window, it should be predictable enough.

This closes issue #265.
2012-08-28 12:52:52 +02:00
Allan Odgaard
85a17b6355 Software update no longer asks about saving changes
If session restore has been disabled then we will still ask, since the user would otherwise lose his changes. Ideally we’d launch the new instances with session restore temporarily enabled.
2012-08-15 22:11:50 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00