2
0

Xcode updates, type fixes and Mac versioning improvements.

This commit is contained in:
Maarten Billemont 2015-09-23 00:31:33 -04:00
parent 8f1d897660
commit db7f9d8af8
23 changed files with 314 additions and 79 deletions

2
External/Pearl vendored

@ -1 +1 @@
Subproject commit bf1dffdbb4eb1a926a8a31b93b559d1053e083ea
Subproject commit 986f092d10eaab64b2ff7347f29e193b9b9e5de4

View File

@ -10,6 +10,7 @@
#include <string.h>
#include <errno.h>
#include <arpa/inet.h>
#include <objc/message.h>
#include "mpw-types.h"
#include "mpw-util.h"

View File

@ -11,16 +11,16 @@
//// Logging.
#ifdef DEBUG
#ifndef trc
#define trc(...) fprintf( stderr, __VA_ARGS__ )
#endif
#ifndef trc
#define trc(...) fprintf( stderr, __VA_ARGS__ )
#endif
#else
#ifndef trc
#define trc(...) do {} while (0)
#endif
#ifndef trc
#define trc(...) do {} while (0)
#endif
#endif
#ifndef ftl
#define ftl(...) do { fprintf( stderr, __VA_ARGS__ ); abort(); } while (0)
#define ftl(...) do { fprintf( stderr, __VA_ARGS__ ); abort(); } while (0)
#endif
//// Buffers and memory.

View File

@ -24,7 +24,7 @@
#define MPAlgorithmDefaultVersion MPAlgorithmVersionCurrent
#define MPAlgorithmDefault MPAlgorithmForVersion(MPAlgorithmDefaultVersion)
id<MPAlgorithm> MPAlgorithmForVersion(NSUInteger version);
id<MPAlgorithm> MPAlgorithmForVersion(MPAlgorithmVersion version);
id<MPAlgorithm> MPAlgorithmDefaultForBundleVersion(NSString *bundleVersion);
PearlEnum( MPAttacker,

View File

@ -17,7 +17,7 @@
#import "MPAlgorithm.h"
id<MPAlgorithm> MPAlgorithmForVersion(NSUInteger version) {
id<MPAlgorithm> MPAlgorithmForVersion(MPAlgorithmVersion version) {
static NSMutableDictionary *versionToAlgorithm = nil;
if (!versionToAlgorithm)

View File

@ -15,12 +15,14 @@
// Copyright 2012 lhunath (Maarten Billemont). All rights reserved.
//
#ifndef trc
#error error
#endif
#import "MPAlgorithmV0.h"
#import "MPEntities.h"
#import "MPAppDelegate_Shared.h"
#import "MPAppDelegate_InApp.h"
#import "mpw-util.h"
#import "mpw-types.h"
#include <openssl/bn.h>
#include <openssl/err.h>
@ -64,6 +66,11 @@ NSOperationQueue *_mpwQueue = nil;
- (NSString *)description {
return strf( @"V%lu", (unsigned long)self.version );
}
- (NSString *)debugDescription {
return strf( @"<%@: version=%lu>", NSStringFromClass( [self class] ), (unsigned long)self.version );
}

View File

@ -142,7 +142,7 @@ PearlAssociatedObjectProperty( NSMutableArray*, ProductObservers, productObserve
float currentFuel = [[MPiOSConfig get].developmentFuelRemaining floatValue];
float purchasedFuel = transaction.payment.quantity / MP_FUEL_HOURLY_RATE;
[MPiOSConfig get].developmentFuelRemaining = @(currentFuel + purchasedFuel);
if (![MPiOSConfig get].developmentFuelChecked || !currentFuel)
if (![MPiOSConfig get].developmentFuelChecked || currentFuel < DBL_EPSILON)
[MPiOSConfig get].developmentFuelChecked = [NSDate date];
}
[[NSUserDefaults standardUserDefaults] setObject:transaction.transactionIdentifier

View File

@ -223,20 +223,13 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
self.storeCorrupted = @NO;
#if TARGET_OS_IPHONE
PearlAddNotificationObserver( UIApplicationWillTerminateNotification, UIApp, [NSOperationQueue mainQueue],
^(MPAppDelegate_Shared *self, NSNotification *note) {
[self.mainManagedObjectContext saveToStore];
} );
PearlAddNotificationObserver( UIApplicationDidEnterBackgroundNotification, UIApp, [NSOperationQueue mainQueue],
^(MPAppDelegate_Shared *self, NSNotification *note) {
[self.mainManagedObjectContext saveToStore];
} );
PearlAddNotificationObserver( UIApplicationWillResignActiveNotification, UIApp, [NSOperationQueue mainQueue],
#else
PearlAddNotificationObserver( NSApplicationWillTerminateNotification, NSApp, [NSOperationQueue mainQueue],
^(MPAppDelegate_Shared *self, NSNotification *note) {
[self.mainManagedObjectContext saveToStore];
} );
PearlAddNotificationObserver( NSApplicationWillResignActiveNotification, NSApp, [NSOperationQueue mainQueue],
#endif
^(MPAppDelegate_Shared *self, NSNotification *note) {
[self.mainManagedObjectContext saveToStore];
} );
// Perform a data sanity check on the newly loaded store to find and fix any issues.
if ([[MPConfig get].checkInconsistency boolValue])
@ -723,7 +716,7 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
NSDate *lastUsed = [[NSDateFormatter rfc3339DateFormatter] dateFromString:siteElements[0]];
NSUInteger uses = (unsigned)[siteElements[1] integerValue];
MPSiteType type = (MPSiteType)[siteElements[2] integerValue];
NSUInteger version = (unsigned)[siteElements[3] integerValue];
MPAlgorithmVersion version = (MPAlgorithmVersion)[siteElements[3] integerValue];
NSUInteger counter = [siteElements[4] length]? (unsigned)[siteElements[4] integerValue]: NSNotFound;
NSString *loginName = [siteElements[5] length]? siteElements[5]: nil;
NSString *siteName = siteElements[6];

View File

@ -93,7 +93,9 @@
- (id<MPAlgorithm>)algorithm {
return MPAlgorithmForVersion( MIN( MPAlgorithmVersionCurrent, MAX( MPAlgorithmVersion0, [self.version_ unsignedIntegerValue] ) ) );
return MPAlgorithmForVersion(
MIN( MPAlgorithmVersionCurrent,
MAX( MPAlgorithmVersion0, (MPAlgorithmVersion)[self.version_ unsignedIntegerValue] ) ) );
}
- (void)setAlgorithm:(id<MPAlgorithm>)algorithm {
@ -148,7 +150,7 @@
MPAlgorithmVersion algorithmVersion;
while ((algorithmVersion = [self.algorithm version]) < MPAlgorithmDefaultVersion) {
NSUInteger toVersion = algorithmVersion + 1;
MPAlgorithmVersion toVersion = algorithmVersion + 1;
if (![MPAlgorithmForVersion( toVersion ) tryMigrateSite:self explicit:explicit]) {
wrn( @"%@ migration to version: %ld failed for site: %@",
explicit? @"Explicit": @"Automatic", (long)toVersion, self );
@ -295,7 +297,9 @@
- (id<MPAlgorithm>)algorithm {
return MPAlgorithmForVersion( MIN( MPAlgorithmVersionCurrent, MAX( MPAlgorithmVersion0, [self.version_ unsignedIntegerValue] ) ) );
return MPAlgorithmForVersion(
MIN( MPAlgorithmVersionCurrent,
MAX( MPAlgorithmVersion0, (MPAlgorithmVersion)[self.version_ unsignedIntegerValue] ) ) );
}
- (void)setAlgorithm:(id<MPAlgorithm>)version {

View File

@ -26,6 +26,8 @@
@property(nonatomic) NSMutableArray *sites;
@property(nonatomic) NSString *masterPassword;
// TODO: For some reason, some builds, this will work; other builds, it will not. Behavior changes without code change.
@property(nonatomic) BOOL showVersionContainer;
@property(nonatomic) BOOL alternatePressed;
@property(nonatomic) BOOL locked;
@property(nonatomic) BOOL newUser;

View File

@ -117,6 +117,7 @@
BOOL alternatePressed = (theEvent.modifierFlags & NSAlternateKeyMask) != 0;
if (alternatePressed != self.alternatePressed) {
self.alternatePressed = alternatePressed;
self.showVersionContainer = self.alternatePressed || self.selectedSite.outdated;
[self.selectedSite updateContent];
if (self.locked) {
@ -587,6 +588,8 @@
(__bridge id)[NSColor whiteColor].CGColor,
(__bridge id)[NSColor colorWithDeviceWhite:1 alpha:gradientOpacity].CGColor
];
self.showVersionContainer = self.alternatePressed || self.selectedSite.outdated;
}
- (void)createNewSite:(NSString *)siteName {

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPPasswordWindowController">
@ -24,7 +24,6 @@
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Master Password" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hasShadow="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MPPasswordWindow">
<windowCollectionBehavior key="collectionBehavior" transient="YES" ignoresCycle="YES" fullScreenAuxiliary="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="0.0" y="0.0" width="640" height="560"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
@ -151,6 +150,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="33" rowSizeStyle="automatic" viewBased="YES" floatsGroupRows="NO" id="xvJ-5c-vDp" customClass="MPSitesTableView">
<rect key="frame" x="0.0" y="0.0" width="515" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="1" alpha="0.0" colorSpace="deviceWhite"/>
@ -330,7 +330,7 @@
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
<binding destination="mcS-ik-b0n" name="hidden2" keyPath="selection.generated" previousBinding="1HU-QK-FXC" id="AyD-tq-Gqc">
<binding destination="mcS-ik-b0n" name="hidden2" keyPath="selection.generated" previousBinding="1HU-QK-FXC" id="MuW-Zk-XUD">
<dictionary key="options">
<integer key="NSMultipleValuesPlaceholder" value="-1"/>
<integer key="NSNoSelectionPlaceholder" value="-1"/>
@ -438,7 +438,7 @@
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
<binding destination="mcS-ik-b0n" name="value" keyPath="selection.displayedContent" id="djg-i5-pwt"/>
<binding destination="mcS-ik-b0n" name="value" keyPath="selection.displayedContent" id="Sdg-fb-kQK"/>
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ia6-7b-dFr">
@ -713,7 +713,7 @@
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uol-dE-I8H">
<rect key="frame" x="309" y="68" width="23" height="14"/>
<rect key="frame" x="389" y="48" width="23" height="14"/>
<shadow key="shadow" blurRadius="0.5">
<size key="offset" width="0.0" height="1"/>
<color key="color" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
@ -750,12 +750,12 @@
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UpZ-rb-NXd">
<rect key="frame" x="241" y="68" width="158" height="14"/>
<rect key="frame" x="254" y="68" width="132" height="14"/>
<shadow key="shadow" blurRadius="0.5">
<size key="offset" width="0.0" height="1"/>
<color key="color" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</shadow>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Click here to set a password:" id="gjc-Fw-xa1">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Click to set a password:" id="gjc-Fw-xa1">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@ -809,20 +809,95 @@
</binding>
</connections>
</textField>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Ul5-Al-s4J" userLabel="Version Container">
<rect key="frame" x="302" y="76" width="36" height="22"/>
<subviews>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="s85-Ce-y9W" userLabel="Version Stepper">
<rect key="frame" x="-3" y="-3" width="19" height="27"/>
<stepperCell key="cell" continuous="YES" alignment="left" minValue="1" maxValue="1000" doubleValue="1" id="oeb-hS-JIa"/>
<connections>
<binding destination="mcS-ik-b0n" name="value" keyPath="selection.algorithmVersion" id="pIE-Rt-gEn"/>
</connections>
</stepper>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="z39-o6-8ma" userLabel="Version Field">
<rect key="frame" x="19" y="2" width="19" height="19"/>
<shadow key="shadow" blurRadius="0.5">
<size key="offset" width="0.0" height="1"/>
<color key="color" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</shadow>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="V1" id="Noo-rx-Uaq">
<font key="font" size="12" name="HelveticaNeue-Medium"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="calibratedRGB"/>
</textFieldCell>
<connections>
<binding destination="mcS-ik-b0n" name="value" keyPath="selection.algorithm.description" id="mMx-c1-Ykb"/>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstItem="z39-o6-8ma" firstAttribute="leading" secondItem="s85-Ce-y9W" secondAttribute="trailing" constant="8" symbolic="YES" id="0Zj-Pu-ofN"/>
<constraint firstItem="s85-Ce-y9W" firstAttribute="leading" secondItem="Ul5-Al-s4J" secondAttribute="leading" id="1gR-pq-zVe"/>
<constraint firstAttribute="centerY" secondItem="s85-Ce-y9W" secondAttribute="centerY" id="Ik1-gj-RVH"/>
<constraint firstAttribute="centerY" secondItem="z39-o6-8ma" secondAttribute="centerY" id="M8y-Sk-FEu"/>
<constraint firstAttribute="height" priority="250" constant="10" id="UBO-Bn-DKp"/>
<constraint firstAttribute="trailing" secondItem="z39-o6-8ma" secondAttribute="trailing" id="l1L-fS-G7r"/>
<constraint firstItem="s85-Ce-y9W" firstAttribute="top" relation="greaterThanOrEqual" secondItem="Ul5-Al-s4J" secondAttribute="top" id="tdC-zE-Mtb"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="s85-Ce-y9W" secondAttribute="bottom" id="utH-zK-jrm"/>
</constraints>
<connections>
<binding destination="-2" name="hidden" keyPath="showVersionContainer" id="5Vl-bo-rdV">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
</connections>
</customView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dbM-ja-dKO">
<rect key="frame" x="152" y="106" width="336" height="14"/>
<shadow key="shadow" blurRadius="0.5">
<size key="offset" width="0.0" height="1"/>
<color key="color" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</shadow>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Upgrade your site's algorithm version for maximum protection:" id="3ds-qG-YNd">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="mcS-ik-b0n" name="hidden" keyPath="canRemove" id="Nk4-VN-Zp7">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
<binding destination="mcS-ik-b0n" name="hidden2" keyPath="selection.outdated" previousBinding="Nk4-VN-Zp7" id="5Kb-A6-1U8">
<dictionary key="options">
<integer key="NSMultipleValuesPlaceholder" value="-1"/>
<integer key="NSNoSelectionPlaceholder" value="-1"/>
<integer key="NSNotApplicablePlaceholder" value="-1"/>
<integer key="NSNullPlaceholder" value="-1"/>
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstItem="v80-wd-hUR" firstAttribute="top" secondItem="iGR-wo-ual" secondAttribute="top" id="1iV-OU-5Ay"/>
<constraint firstItem="brI-fg-Kav" firstAttribute="centerX" secondItem="vES-W5-m4x" secondAttribute="centerX" id="1tN-p4-2m4"/>
<constraint firstItem="Ido-NQ-3MY" firstAttribute="top" secondItem="1Qo-iG-CQt" secondAttribute="bottom" constant="4" id="3MM-M7-OKF"/>
<constraint firstAttribute="bottom" secondItem="Bwc-sd-6gm" secondAttribute="bottom" constant="-80" id="3fF-7g-c6C"/>
<constraint firstItem="dbM-ja-dKO" firstAttribute="centerX" secondItem="Ul5-Al-s4J" secondAttribute="centerX" id="4dP-Qu-TlT"/>
<constraint firstItem="XuF-Sp-6JD" firstAttribute="centerX" secondItem="qal-PP-YtO" secondAttribute="centerX" id="7mj-3B-j0X"/>
<constraint firstItem="NGk-Io-Buc" firstAttribute="top" secondItem="oSh-Ec-8Nf" secondAttribute="bottom" constant="8" symbolic="YES" id="8AC-MT-cz4"/>
<constraint firstItem="vES-W5-m4x" firstAttribute="centerX" secondItem="CnS-iI-dhr" secondAttribute="centerX" id="92S-HP-Vk7"/>
<constraint firstItem="d3u-Ze-9uf" firstAttribute="top" secondItem="Ul5-Al-s4J" secondAttribute="bottom" constant="8" symbolic="YES" id="98H-X6-7xw"/>
<constraint firstItem="Ido-NQ-3MY" firstAttribute="centerX" secondItem="1Qo-iG-CQt" secondAttribute="centerX" id="99M-8j-9Dt"/>
<constraint firstAttribute="trailing" secondItem="Aue-Zx-6Mf" secondAttribute="trailing" constant="20" symbolic="YES" id="9Pu-34-g2q"/>
<constraint firstItem="CnS-iI-dhr" firstAttribute="top" secondItem="OnR-s6-d4P" secondAttribute="bottom" constant="8" symbolic="YES" id="CGj-SL-Qhp"/>
<constraint firstAttribute="trailing" secondItem="NGk-Io-Buc" secondAttribute="trailing" constant="20" symbolic="YES" id="DK5-VZ-db2"/>
<constraint firstItem="vES-W5-m4x" firstAttribute="centerY" secondItem="XuF-Sp-6JD" secondAttribute="centerY" id="DPa-1n-QWJ"/>
<constraint firstItem="Ul5-Al-s4J" firstAttribute="top" secondItem="dbM-ja-dKO" secondAttribute="bottom" constant="8" symbolic="YES" id="GJu-YJ-hEV"/>
<constraint firstAttribute="centerY" secondItem="iGR-wo-ual" secondAttribute="centerY" id="GZE-mX-kjj"/>
<constraint firstAttribute="centerY" secondItem="CnS-iI-dhr" secondAttribute="centerY" id="HjG-vb-3Qg"/>
<constraint firstItem="iGR-wo-ual" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="KNz-B2-qfi"/>
@ -842,7 +917,6 @@
<constraint firstItem="brI-fg-Kav" firstAttribute="centerX" secondItem="UpZ-rb-NXd" secondAttribute="centerX" id="b9H-8D-b8a"/>
<constraint firstAttribute="centerX" secondItem="oSh-Ec-8Nf" secondAttribute="centerX" id="c28-5a-C45"/>
<constraint firstItem="oSh-Ec-8Nf" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" constant="20" symbolic="YES" id="cUB-xF-1Wr"/>
<constraint firstItem="brI-fg-Kav" firstAttribute="top" secondItem="uol-dE-I8H" secondAttribute="bottom" constant="4" id="czZ-ad-0sw"/>
<constraint firstItem="vES-W5-m4x" firstAttribute="top" secondItem="d3u-Ze-9uf" secondAttribute="bottom" constant="8" symbolic="YES" id="d3h-VT-ilM"/>
<constraint firstItem="XuF-Sp-6JD" firstAttribute="leading" secondItem="vES-W5-m4x" secondAttribute="trailing" constant="8" symbolic="YES" id="d43-2g-dap"/>
<constraint firstAttribute="bottom" secondItem="R46-fx-n14" secondAttribute="bottom" constant="20" symbolic="YES" id="djJ-T6-7Rr"/>
@ -855,15 +929,17 @@
<constraint firstItem="9b3-wy-KBb" firstAttribute="top" secondItem="vES-W5-m4x" secondAttribute="bottom" constant="4" id="hKa-2u-uL3"/>
<constraint firstAttribute="centerX" secondItem="R46-fx-n14" secondAttribute="centerX" id="hvb-7h-xDS"/>
<constraint firstItem="Bme-XK-MMc" firstAttribute="centerX" secondItem="CnS-iI-dhr" secondAttribute="centerX" id="i7B-jz-xgm"/>
<constraint firstItem="d3u-Ze-9uf" firstAttribute="centerX" secondItem="Ul5-Al-s4J" secondAttribute="centerX" id="iAv-c7-e2h"/>
<constraint firstItem="lW3-2z-cEa" firstAttribute="top" secondItem="iGR-wo-ual" secondAttribute="bottom" constant="8" symbolic="YES" id="jg5-h1-0Gn"/>
<constraint firstItem="vES-W5-m4x" firstAttribute="leading" secondItem="1Qo-iG-CQt" secondAttribute="trailing" constant="8" symbolic="YES" id="kTZ-lP-vnR"/>
<constraint firstAttribute="centerX" secondItem="iGR-wo-ual" secondAttribute="centerX" id="kXB-yZ-sur"/>
<constraint firstItem="9b3-wy-KBb" firstAttribute="centerX" secondItem="vES-W5-m4x" secondAttribute="centerX" id="leH-oh-7OJ"/>
<constraint firstItem="vES-W5-m4x" firstAttribute="top" secondItem="brI-fg-Kav" secondAttribute="bottom" constant="8" symbolic="YES" id="rCP-oh-rWr"/>
<constraint firstItem="v80-wd-hUR" firstAttribute="trailing" secondItem="iGR-wo-ual" secondAttribute="trailing" id="rIx-cQ-PNt"/>
<constraint firstItem="brI-fg-Kav" firstAttribute="centerX" secondItem="uol-dE-I8H" secondAttribute="centerX" id="s5w-Nc-YJY"/>
<constraint firstItem="Bwc-sd-6gm" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="-80" id="tea-fv-b1S"/>
<constraint firstItem="uol-dE-I8H" firstAttribute="centerY" secondItem="brI-fg-Kav" secondAttribute="centerY" id="u7f-S8-wNq"/>
<constraint firstItem="lW3-2z-cEa" firstAttribute="centerX" secondItem="iGR-wo-ual" secondAttribute="centerX" id="vML-2u-shw"/>
<constraint firstItem="uol-dE-I8H" firstAttribute="leading" secondItem="brI-fg-Kav" secondAttribute="trailing" constant="8" symbolic="YES" id="wjM-05-gD1"/>
<constraint firstItem="v80-wd-hUR" firstAttribute="bottom" secondItem="iGR-wo-ual" secondAttribute="bottom" id="xiX-8e-pNR"/>
<constraint firstItem="v80-wd-hUR" firstAttribute="leading" secondItem="iGR-wo-ual" secondAttribute="leading" id="yVZ-Ar-5ov"/>
<constraint firstItem="gAU-xs-aae" firstAttribute="centerX" secondItem="Aue-Zx-6Mf" secondAttribute="centerX" id="yxU-bl-dmQ"/>

View File

@ -36,6 +36,8 @@
@property (nonatomic) NSUInteger counter;
@property (nonatomic) NSDate *lastUsed;
@property (nonatomic) id<MPAlgorithm> algorithm;
@property (nonatomic) MPAlgorithmVersion algorithmVersion;
@property (nonatomic, readonly) BOOL outdated;
@property (nonatomic, readonly) BOOL generated;
@property (nonatomic, readonly) BOOL stored;
@property (nonatomic, readonly) BOOL transient;

View File

@ -143,6 +143,36 @@
[self updateContent];
}
- (MPAlgorithmVersion)algorithmVersion {
return self.algorithm.version;
}
- (void)setAlgorithmVersion:(MPAlgorithmVersion)algorithmVersion {
if (algorithmVersion == self.algorithm.version)
return;
[self willChangeValueForKey:@"outdated"];
self.algorithm = MPAlgorithmForVersion( algorithmVersion )?: self.algorithm;
[self didChangeValueForKey:@"outdated"];
if (_entityOID)
[MPMacAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
MPSiteEntity *entity = [self entityInContext:context];
entity.algorithm = self.algorithm;
[context saveToStore];
[self updateContent:entity];
}];
else
[self updateContent];
}
- (BOOL)outdated {
return self.algorithmVersion < MPAlgorithmVersionCurrent;
}
- (BOOL)generated {
return self.type & MPSiteTypeClassGenerated;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "AppStore-Mac"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "AppStore-Mac">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
@ -38,17 +38,21 @@
ReferencedContainer = "container:MasterPassword-Mac.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "AppStore-Mac"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "AppStore-Mac"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"
@ -61,12 +65,13 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "AppStore-Mac"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "AppStore-Mac"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug-Mac"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug-Mac">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
@ -38,17 +38,21 @@
ReferencedContainer = "container:MasterPassword-Mac.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug-Mac"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug-Mac"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"
@ -68,12 +72,13 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Debug-Mac"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug-Mac"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug-Mac"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug-Mac">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
@ -38,17 +38,21 @@
ReferencedContainer = "container:MasterPassword-Mac.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug-Mac"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug-Mac"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA67743A1A474A03004F356A"
@ -61,12 +65,13 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "AdHoc-Mac"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "AdHoc-Mac"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA67743A1A474A03004F356A"

View File

@ -2,8 +2,9 @@
// Prefix header for all source files of the 'MasterPassword' target in the 'MasterPassword' project
//
#import <Availability.h>
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
#warning "This project uses features only available in Mac OS X 10.8 and later."
#warning "This project uses features only available in Mac OS X 10.8 and later."
#endif
#import "Pearl-Prefix.pch"
@ -15,10 +16,54 @@
#import <CoreData/CoreData.h>
#ifdef CRASHLYTICS
#import <Crashlytics/Crashlytics.h>
#import <Crashlytics/Crashlytics.h>
#endif
#import "MPTypes.h"
#import "MPMacConfig.h"
#else
#import <libgen.h>
#import <CoreFoundation/CFString.h>
#import <objc/runtime.h>
#import <objc/message.h>
#define trc(format, ...) objc_msgSend( \
objc_msgSend( (id)objc_getClass("PearlLogger"), sel_getUid( "get" ) ), \
sel_getUid( "inFile:atLine:trc:" ), \
basename( (char *)__FILE__ ), __LINE__, \
CFStringCreateWithCString( NULL, format, kCFStringEncodingUTF8 ), \
##__VA_ARGS__)
#define dbg(format, ...) objc_msgSend( \
objc_msgSend( (id)objc_getClass("PearlLogger"), sel_getUid( "get" ) ), \
sel_getUid( "inFile:atLine:dbg:" ), \
basename( (char *)__FILE__ ), __LINE__, \
CFStringCreateWithCString( NULL, format, kCFStringEncodingUTF8 ), \
##__VA_ARGS__)
#define inf(format, ...) objc_msgSend( \
objc_msgSend( (id)objc_getClass("PearlLogger"), sel_getUid( "get" ) ), \
sel_getUid( "inFile:atLine:inf:" ), \
basename( (char *)__FILE__ ), __LINE__, \
CFStringCreateWithCString( NULL, format, kCFStringEncodingUTF8 ), \
##__VA_ARGS__)
#define wrn(format, ...) objc_msgSend( \
objc_msgSend( (id)objc_getClass("PearlLogger"), sel_getUid( "get" ) ), \
sel_getUid( "inFile:atLine:wrn:" ), \
basename( (char *)__FILE__ ), __LINE__, \
CFStringCreateWithCString( NULL, format, kCFStringEncodingUTF8 ), \
##__VA_ARGS__)
#define err(format, ...) objc_msgSend( \
objc_msgSend( (id)objc_getClass("PearlLogger"), sel_getUid( "get" ) ), \
sel_getUid( "inFile:atLine:err:" ), \
basename( (char *)__FILE__ ), __LINE__, \
CFStringCreateWithCString( NULL, format, kCFStringEncodingUTF8 ), \
##__VA_ARGS__)
#define ftl(format, ...) do{objc_msgSend( \
objc_msgSend( (id)objc_getClass("PearlLogger"), sel_getUid( "get" ) ), \
sel_getUid( "inFile:atLine:ftl:" ), \
basename( (char *)__FILE__ ), __LINE__, \
CFStringCreateWithCString( NULL, format, kCFStringEncodingUTF8 ), \
##__VA_ARGS__); abort(); } while (0)
#endif

View File

@ -30,7 +30,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.lyndir.lhunath.MasterPassword</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@ -3,7 +3,6 @@
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
@ -17,10 +16,54 @@
#import <CoreData/CoreData.h>
#ifdef CRASHLYTICS
#import <Crashlytics/Crashlytics.h>
#import <Crashlytics/Crashlytics.h>
#endif
#import "MPTypes.h"
#import "MPiOSConfig.h"
#else
#import <libgen.h>
#import <CoreFoundation/CFString.h>
#import <objc/runtime.h>
#import <objc/message.h>
#define trc(format, ...) objc_msgSend( \
objc_msgSend( (id)objc_getClass("PearlLogger"), sel_getUid( "get" ) ), \
sel_getUid( "inFile:atLine:trc:" ), \
basename( (char *)__FILE__ ), __LINE__, \
CFStringCreateWithCString( NULL, format, kCFStringEncodingUTF8 ), \
##__VA_ARGS__)
#define dbg(format, ...) objc_msgSend( \
objc_msgSend( (id)objc_getClass("PearlLogger"), sel_getUid( "get" ) ), \
sel_getUid( "inFile:atLine:dbg:" ), \
basename( (char *)__FILE__ ), __LINE__, \
CFStringCreateWithCString( NULL, format, kCFStringEncodingUTF8 ), \
##__VA_ARGS__)
#define inf(format, ...) objc_msgSend( \
objc_msgSend( (id)objc_getClass("PearlLogger"), sel_getUid( "get" ) ), \
sel_getUid( "inFile:atLine:inf:" ), \
basename( (char *)__FILE__ ), __LINE__, \
CFStringCreateWithCString( NULL, format, kCFStringEncodingUTF8 ), \
##__VA_ARGS__)
#define wrn(format, ...) objc_msgSend( \
objc_msgSend( (id)objc_getClass("PearlLogger"), sel_getUid( "get" ) ), \
sel_getUid( "inFile:atLine:wrn:" ), \
basename( (char *)__FILE__ ), __LINE__, \
CFStringCreateWithCString( NULL, format, kCFStringEncodingUTF8 ), \
##__VA_ARGS__)
#define err(format, ...) objc_msgSend( \
objc_msgSend( (id)objc_getClass("PearlLogger"), sel_getUid( "get" ) ), \
sel_getUid( "inFile:atLine:err:" ), \
basename( (char *)__FILE__ ), __LINE__, \
CFStringCreateWithCString( NULL, format, kCFStringEncodingUTF8 ), \
##__VA_ARGS__)
#define ftl(format, ...) do{objc_msgSend( \
objc_msgSend( (id)objc_getClass("PearlLogger"), sel_getUid( "get" ) ), \
sel_getUid( "inFile:atLine:ftl:" ), \
basename( (char *)__FILE__ ), __LINE__, \
CFStringCreateWithCString( NULL, format, kCFStringEncodingUTF8 ), \
##__VA_ARGS__); abort(); } while (0)
#endif

View File

@ -3225,7 +3225,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = MP;
LastUpgradeCheck = 0610;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = Lyndir;
TargetAttributes = {
DA32D01F19D111C6004F3F0E = {
@ -3873,6 +3873,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DSTROOT = "/tmp/${PRODUCT_NAME}.dst";
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@ -4029,6 +4030,7 @@
"-framework",
Reveal,
);
PRODUCT_BUNDLE_IDENTIFIER = com.lyndir.lhunath.MasterPassword;
PROVISIONING_PROFILE = "";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "3251b7d3-04df-4c8e-a410-d020ffc92d10";
SKIP_INSTALL = NO;
@ -4063,6 +4065,7 @@
"$(inherited)",
"-lscryptenc-ios-sim",
);
PRODUCT_BUNDLE_IDENTIFIER = com.lyndir.lhunath.MasterPassword;
PROVISIONING_PROFILE = "";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "59b587d0-3ef3-4691-9f12-c48f7f283002";
SKIP_INSTALL = NO;
@ -4178,6 +4181,7 @@
"$(inherited)",
"-lscryptenc-ios-sim",
);
PRODUCT_BUNDLE_IDENTIFIER = com.lyndir.lhunath.MasterPassword;
PROVISIONING_PROFILE = "";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "a1d8cfc8-b8db-4544-af34-28cc75e46c40";
SKIP_INSTALL = NO;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug-iOS"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug-iOS">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
@ -38,17 +38,21 @@
ReferencedContainer = "container:MasterPassword-iOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug-iOS"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug-iOS"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"
@ -61,12 +65,13 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Debug-iOS"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug-iOS"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug-iOS"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug-iOS">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
@ -38,17 +38,21 @@
ReferencedContainer = "container:MasterPassword-iOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug-iOS"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug-iOS"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"
@ -71,12 +75,13 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Debug-iOS"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug-iOS"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA5BFA43147E415C00F98B1E"