Fix migration window showed up every time

This commit is contained in:
1024jp 2015-10-06 10:21:27 +02:00
parent d7fd06a681
commit 0685b3eb87
4 changed files with 15 additions and 3 deletions

View File

@ -11,6 +11,11 @@ develop
- Add “geojson” to extension list.
### Fixes
- Fix an issue under the specific conditions where the migration window showed up every time on launch.
2.2.1 (75)
--------------------------

View File

@ -957,7 +957,7 @@
<key>CFBundleSignature</key>
<string>cEd1</string>
<key>CFBundleVersion</key>
<string>76a</string>
<string>76</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>NSAppleScriptEnabled</key>

View File

@ -957,7 +957,7 @@
<key>CFBundleSignature</key>
<string>cEd1</string>
<key>CFBundleVersion</key>
<string>76a</string>
<string>76</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>NSAppleScriptEnabled</key>

View File

@ -382,8 +382,15 @@
// >= 2.2.0 : Single Integer
NSString *lastVersion = [[NSUserDefaults standardUserDefaults] stringForKey:CEDefaultLastVersionKey];
NSString *thisVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
BOOL isDigit = lastVersion && [lastVersion rangeOfString:@"^[\\d]+$" options:NSRegularExpressionSearch].location != NSNotFound;
if (isDigit && [thisVersion integerValue] > [lastVersion integerValue]) {
BOOL isPreRelease = lastVersion && [lastVersion rangeOfString:@"^[\\d]+[a-z]+[\\d]?$" options:NSRegularExpressionSearch].location != NSNotFound;
// -> [@"100b3" integerValue] is 100
if ((!lastVersion) || // first launch
(!isDigit && !isPreRelease) || // probably semver (semver must be older than 2.2.0)
((isDigit || isPreRelease) && ([thisVersion integerValue] > [lastVersion integerValue]))) // normal integer or Sparkle-style pre-release
{
[[NSUserDefaults standardUserDefaults] setObject:thisVersion forKey:CEDefaultLastVersionKey];
}