From 351f468c24d0e42f168232528b59f2a4ad47919f Mon Sep 17 00:00:00 2001 From: Jonathan Willing Date: Mon, 8 Apr 2013 14:31:23 -0500 Subject: add preliminary iOS example --- example/common/FXKeychain.h | 54 +++ example/common/FXKeychain.m | 197 ++++++++ example/common/FXKeychain_LICENCE.md | 21 + .../iOS UI Test.xcodeproj/project.pbxproj | 471 ++++++++++++++++++++ example/ios/iOS UI Test/iOS UI Test/AppDelegate.h | 15 + example/ios/iOS UI Test/iOS UI Test/AppDelegate.m | 46 ++ .../iOS UI Test/iOS UI Test/Default-568h@2x.png | Bin 0 -> 18594 bytes example/ios/iOS UI Test/iOS UI Test/Default.png | Bin 0 -> 6540 bytes example/ios/iOS UI Test/iOS UI Test/Default@2x.png | Bin 0 -> 16107 bytes .../iOS UI Test/iOS UI Test/DetailViewController.h | 16 + .../iOS UI Test/iOS UI Test/DetailViewController.m | 51 +++ .../iOS UI Test/iOS UI Test/MasterViewController.h | 18 + .../iOS UI Test/iOS UI Test/MasterViewController.m | 102 +++++ .../iOS UI Test/SettingsViewController.h | 28 ++ .../iOS UI Test/SettingsViewController.m | 51 +++ .../iOS UI Test/SettingsViewController.xib | 495 +++++++++++++++++++++ .../iOS UI Test/en.lproj/InfoPlist.strings | 2 + .../iOS UI Test/en.lproj/MainStoryboard.storyboard | 109 +++++ .../iOS UI Test/iOS UI Test/iOS UI Test-Info.plist | 50 +++ .../iOS UI Test/iOS UI Test/iOS UI Test-Prefix.pch | 14 + example/ios/iOS UI Test/iOS UI Test/main.m | 18 + 21 files changed, 1758 insertions(+) create mode 100755 example/common/FXKeychain.h create mode 100755 example/common/FXKeychain.m create mode 100755 example/common/FXKeychain_LICENCE.md create mode 100644 example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj create mode 100644 example/ios/iOS UI Test/iOS UI Test/AppDelegate.h create mode 100644 example/ios/iOS UI Test/iOS UI Test/AppDelegate.m create mode 100644 example/ios/iOS UI Test/iOS UI Test/Default-568h@2x.png create mode 100644 example/ios/iOS UI Test/iOS UI Test/Default.png create mode 100644 example/ios/iOS UI Test/iOS UI Test/Default@2x.png create mode 100644 example/ios/iOS UI Test/iOS UI Test/DetailViewController.h create mode 100644 example/ios/iOS UI Test/iOS UI Test/DetailViewController.m create mode 100644 example/ios/iOS UI Test/iOS UI Test/MasterViewController.h create mode 100644 example/ios/iOS UI Test/iOS UI Test/MasterViewController.m create mode 100644 example/ios/iOS UI Test/iOS UI Test/SettingsViewController.h create mode 100644 example/ios/iOS UI Test/iOS UI Test/SettingsViewController.m create mode 100644 example/ios/iOS UI Test/iOS UI Test/SettingsViewController.xib create mode 100644 example/ios/iOS UI Test/iOS UI Test/en.lproj/InfoPlist.strings create mode 100644 example/ios/iOS UI Test/iOS UI Test/en.lproj/MainStoryboard.storyboard create mode 100644 example/ios/iOS UI Test/iOS UI Test/iOS UI Test-Info.plist create mode 100644 example/ios/iOS UI Test/iOS UI Test/iOS UI Test-Prefix.pch create mode 100644 example/ios/iOS UI Test/iOS UI Test/main.m (limited to 'example') diff --git a/example/common/FXKeychain.h b/example/common/FXKeychain.h new file mode 100755 index 00000000..3e80c817 --- /dev/null +++ b/example/common/FXKeychain.h @@ -0,0 +1,54 @@ +// +// FXKeychain.h +// +// Version 1.3.1 +// +// Created by Nick Lockwood on 29/12/2012. +// Copyright 2012 Charcoal Design +// +// Distributed under the permissive zlib License +// Get the latest version from here: +// +// https://github.com/nicklockwood/FXKeychain +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// + + +#import +#import + + +@interface FXKeychain : NSObject + ++ (instancetype)defaultKeychain; + +@property (nonatomic, copy, readonly) NSString *service; +@property (nonatomic, copy, readonly) NSString *accessGroup; + +- (id)initWithService:(NSString *)service + accessGroup:(NSString *)accessGroup; + +- (BOOL)setObject:(id)object forKey:(id)key; +- (BOOL)setObject:(id)object forKeyedSubscript:(id)key; +- (BOOL)removeObjectForKey:(id)key; +- (id)objectForKey:(id)key; +- (id)objectForKeyedSubscript:(id)key; + +@end diff --git a/example/common/FXKeychain.m b/example/common/FXKeychain.m new file mode 100755 index 00000000..f4cb4388 --- /dev/null +++ b/example/common/FXKeychain.m @@ -0,0 +1,197 @@ +// +// FXKeychain.m +// +// Version 1.3.2 +// +// Created by Nick Lockwood on 29/12/2012. +// Copyright 2012 Charcoal Design +// +// Distributed under the permissive zlib License +// Get the latest version from here: +// +// https://github.com/nicklockwood/FXKeychain +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// + + +#import "FXKeychain.h" + + +#import +#if !__has_feature(objc_arc) +#error This class requires automatic reference counting +#endif + + +@implementation FXKeychain + ++ (instancetype)defaultKeychain +{ + static id sharedInstance = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + + NSString *bundleID = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleIdentifierKey]; + sharedInstance = [[FXKeychain alloc] initWithService:bundleID + accessGroup:nil]; + }); + + return sharedInstance; +} + +- (id)init +{ + return [self initWithService:nil accessGroup:nil]; +} + +- (id)initWithService:(NSString *)service + accessGroup:(NSString *)accessGroup +{ + if ((self = [super init])) + { + _service = [service copy]; + _accessGroup = [accessGroup copy]; + } + return self; +} + +- (BOOL)setObject:(id)object forKey:(id)key +{ + NSParameterAssert(key); + + //generate query + NSMutableDictionary *query = [NSMutableDictionary dictionary]; + if ([_service length]) query[(__bridge NSString *)kSecAttrService] = _service; + query[(__bridge NSString *)kSecClass] = (__bridge id)kSecClassGenericPassword; + query[(__bridge NSString *)kSecAttrAccount] = [key description]; + +#if defined __IPHONE_OS_VERSION_MAX_ALLOWED && !TARGET_IPHONE_SIMULATOR + if ([_accessGroup length]) query[(__bridge NSString *)kSecAttrAccessGroup] = _accessGroup; +#endif + + //encode object + NSData *data = nil; + NSError *error = nil; + if ([(id)object isKindOfClass:[NSString class]]) + { + data = [(NSString *)object dataUsingEncoding:NSUTF8StringEncoding]; + } + else if (object) + { + data = [NSPropertyListSerialization dataWithPropertyList:object + format:NSPropertyListBinaryFormat_v1_0 + options:0 + error:&error]; + } + + //fail if object is invalid + NSAssert(!object || (object && data), @"FXKeychain failed to encode object for key '%@', error: %@", key, error); + + //delete existing data + OSStatus status = SecItemDelete((__bridge CFDictionaryRef)query); + + //write data + if (data) + { + query[(__bridge NSString *)kSecValueData] = data; + status = SecItemAdd ((__bridge CFDictionaryRef)query, NULL); + if (status != errSecSuccess) + { + NSLog(@"FXKeychain failed to store data for key '%@', error: %ld", key, (long)status); + return NO; + } + } + else if (status != errSecSuccess) + { + NSLog(@"FXKeychain failed to delete data for key '%@', error: %ld", key, (long)status); + return NO; + } + return YES; +} + +- (BOOL)setObject:(id)object forKeyedSubscript:(id)key +{ + return [self setObject:object forKey:key]; +} + +- (BOOL)removeObjectForKey:(id)key +{ + return [self setObject:nil forKey:key]; +} + +- (id)objectForKey:(id)key +{ + NSParameterAssert(key); + + //generate query + NSMutableDictionary *query = [NSMutableDictionary dictionary]; + if ([_service length]) query[(__bridge NSString *)kSecAttrService] = _service; + query[(__bridge NSString *)kSecClass] = (__bridge id)kSecClassGenericPassword; + query[(__bridge NSString *)kSecMatchLimit] = (__bridge id)kSecMatchLimitOne; + query[(__bridge NSString *)kSecReturnData] = (__bridge id)kCFBooleanTrue; + query[(__bridge NSString *)kSecAttrAccount] = [key description]; + +#if defined __IPHONE_OS_VERSION_MAX_ALLOWED && !TARGET_IPHONE_SIMULATOR + if ([_accessGroup length]) query[(__bridge NSString *)kSecAttrAccessGroup] = _accessGroup; +#endif + + //recover data + id object = nil; + NSError *error = nil; + CFDataRef data = nil; + OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, (CFTypeRef *)&data); + if (status == errSecSuccess && data) + { + //attempt to decode as a plist + object = [NSPropertyListSerialization propertyListWithData:(__bridge NSData *)data + options:NSPropertyListImmutable + format:NULL + error:&error]; + + if ([object respondsToSelector:@selector(objectForKey:)] && object[@"$archiver"]) + { + //data represents an NSCoded archive. don't trust it + object = nil; + } + else if (!object) + { + //may be a string + object = [[NSString alloc] initWithData:(__bridge NSData *)data encoding:NSUTF8StringEncoding]; + } + if (!object) + { + NSLog(@"FXKeychain failed to decode data for key '%@', error: %@", key, error); + } + CFRelease(data); + return object; + } + else + { + //no value found + return nil; + } +} + +- (id)objectForKeyedSubscript:(id)key +{ + return [self objectForKey:key]; +} + +@end diff --git a/example/common/FXKeychain_LICENCE.md b/example/common/FXKeychain_LICENCE.md new file mode 100755 index 00000000..68a5f4f5 --- /dev/null +++ b/example/common/FXKeychain_LICENCE.md @@ -0,0 +1,21 @@ +FXKeychain + +Version 1.3.2, April 4th, 2013 + +Copyright (C) 2012 Charcoal Design + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. \ No newline at end of file diff --git a/example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj b/example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj new file mode 100644 index 00000000..5aeb271c --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj @@ -0,0 +1,471 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + AB665BC817134319007F2151 /* libMailCore-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AB665BBD171342C1007F2151 /* libMailCore-ios.a */; }; + AB665BCD17134336007F2151 /* FXKeychain.m in Sources */ = {isa = PBXBuildFile; fileRef = AB665BCB17134336007F2151 /* FXKeychain.m */; }; + AB9EAE06170368F000D750C7 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB9EAE05170368F000D750C7 /* UIKit.framework */; }; + AB9EAE08170368F000D750C7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB9EAE07170368F000D750C7 /* Foundation.framework */; }; + AB9EAE0A170368F000D750C7 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB9EAE09170368F000D750C7 /* CoreGraphics.framework */; }; + AB9EAE10170368F000D750C7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = AB9EAE0E170368F000D750C7 /* InfoPlist.strings */; }; + AB9EAE12170368F000D750C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AB9EAE11170368F000D750C7 /* main.m */; }; + AB9EAE16170368F000D750C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AB9EAE15170368F000D750C7 /* AppDelegate.m */; }; + AB9EAE18170368F000D750C7 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = AB9EAE17170368F000D750C7 /* Default.png */; }; + AB9EAE1A170368F000D750C7 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AB9EAE19170368F000D750C7 /* Default@2x.png */; }; + AB9EAE1C170368F000D750C7 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AB9EAE1B170368F000D750C7 /* Default-568h@2x.png */; }; + AB9EAE1F170368F000D750C7 /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB9EAE1D170368F000D750C7 /* MainStoryboard.storyboard */; }; + AB9EAE22170368F000D750C7 /* MasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB9EAE21170368F000D750C7 /* MasterViewController.m */; }; + AB9EAE25170368F000D750C7 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB9EAE24170368F000D750C7 /* DetailViewController.m */; }; + AB9EAE3617036FD700D750C7 /* SettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB9EAE3417036FD600D750C7 /* SettingsViewController.m */; }; + AB9EAE3717036FD700D750C7 /* SettingsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB9EAE3517036FD700D750C7 /* SettingsViewController.xib */; }; + AB9EAE40170374D900D750C7 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB9EAE3F170374D900D750C7 /* Security.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + AB665BBA171342C1007F2151 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AB665BB2171342C0007F2151 /* mailcore2.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C64EA537169E772200778456; + remoteInfo = "static mailcore2 osx"; + }; + AB665BBC171342C1007F2151 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AB665BB2171342C0007F2151 /* mailcore2.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C6BA2C191705F4E6003F0E9E; + remoteInfo = "static mailcore2 ios"; + }; + AB665BBE171342C1007F2151 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AB665BB2171342C0007F2151 /* mailcore2.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C64EA78C169F259200778456; + remoteInfo = tests; + }; + AB665BC0171342C1007F2151 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AB665BB2171342C0007F2151 /* mailcore2.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C6A81B911706840C00882C15; + remoteInfo = "test-ios"; + }; + AB665BC2171342C1007F2151 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AB665BB2171342C0007F2151 /* mailcore2.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C6BD288D170BD71100A91AC1; + remoteInfo = "mailcore osx"; + }; + AB665BC6171342FF007F2151 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AB665BB2171342C0007F2151 /* mailcore2.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = C6BA2B091705F4E6003F0E9E; + remoteInfo = "static mailcore2 ios"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + AB665BB2171342C0007F2151 /* mailcore2.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = mailcore2.xcodeproj; path = "../../../../build-mac/mailcore2.xcodeproj"; sourceTree = ""; }; + AB665BCA17134336007F2151 /* FXKeychain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FXKeychain.h; sourceTree = ""; }; + AB665BCB17134336007F2151 /* FXKeychain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FXKeychain.m; sourceTree = ""; }; + AB665BCC17134336007F2151 /* FXKeychain_LICENCE.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FXKeychain_LICENCE.md; sourceTree = ""; }; + AB9EAE02170368F000D750C7 /* iOS UI Test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS UI Test.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + AB9EAE05170368F000D750C7 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + AB9EAE07170368F000D750C7 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + AB9EAE09170368F000D750C7 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + AB9EAE0D170368F000D750C7 /* iOS UI Test-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iOS UI Test-Info.plist"; sourceTree = ""; }; + AB9EAE0F170368F000D750C7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + AB9EAE11170368F000D750C7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + AB9EAE13170368F000D750C7 /* iOS UI Test-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iOS UI Test-Prefix.pch"; sourceTree = ""; }; + AB9EAE14170368F000D750C7 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + AB9EAE15170368F000D750C7 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + AB9EAE17170368F000D750C7 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; + AB9EAE19170368F000D750C7 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; + AB9EAE1B170368F000D750C7 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; + AB9EAE1E170368F000D750C7 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = ""; }; + AB9EAE20170368F000D750C7 /* MasterViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MasterViewController.h; sourceTree = ""; }; + AB9EAE21170368F000D750C7 /* MasterViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MasterViewController.m; sourceTree = ""; }; + AB9EAE23170368F000D750C7 /* DetailViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = ""; }; + AB9EAE24170368F000D750C7 /* DetailViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = ""; }; + AB9EAE3317036FD600D750C7 /* SettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsViewController.h; sourceTree = ""; }; + AB9EAE3417036FD600D750C7 /* SettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingsViewController.m; sourceTree = ""; }; + AB9EAE3517036FD700D750C7 /* SettingsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SettingsViewController.xib; sourceTree = ""; }; + AB9EAE3F170374D900D750C7 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + AB9EADFF170368F000D750C7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + AB665BC817134319007F2151 /* libMailCore-ios.a in Frameworks */, + AB9EAE40170374D900D750C7 /* Security.framework in Frameworks */, + AB9EAE06170368F000D750C7 /* UIKit.framework in Frameworks */, + AB9EAE08170368F000D750C7 /* Foundation.framework in Frameworks */, + AB9EAE0A170368F000D750C7 /* CoreGraphics.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + AB665BB3171342C0007F2151 /* Products */ = { + isa = PBXGroup; + children = ( + AB665BBB171342C1007F2151 /* libMailCore.a */, + AB665BBD171342C1007F2151 /* libMailCore-ios.a */, + AB665BBF171342C1007F2151 /* tests */, + AB665BC1171342C1007F2151 /* test-ios.app */, + AB665BC3171342C1007F2151 /* MailCore.framework */, + ); + name = Products; + sourceTree = ""; + }; + AB665BC917134336007F2151 /* common */ = { + isa = PBXGroup; + children = ( + AB665BCA17134336007F2151 /* FXKeychain.h */, + AB665BCB17134336007F2151 /* FXKeychain.m */, + AB665BCC17134336007F2151 /* FXKeychain_LICENCE.md */, + ); + name = common; + path = ../../../common; + sourceTree = ""; + }; + AB9EADF9170368F000D750C7 = { + isa = PBXGroup; + children = ( + AB9EAE0B170368F000D750C7 /* iOS UI Test */, + AB9EAE04170368F000D750C7 /* Frameworks */, + AB9EAE03170368F000D750C7 /* Products */, + ); + sourceTree = ""; + }; + AB9EAE03170368F000D750C7 /* Products */ = { + isa = PBXGroup; + children = ( + AB9EAE02170368F000D750C7 /* iOS UI Test.app */, + ); + name = Products; + sourceTree = ""; + }; + AB9EAE04170368F000D750C7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + AB9EAE3F170374D900D750C7 /* Security.framework */, + AB9EAE05170368F000D750C7 /* UIKit.framework */, + AB9EAE07170368F000D750C7 /* Foundation.framework */, + AB9EAE09170368F000D750C7 /* CoreGraphics.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + AB9EAE0B170368F000D750C7 /* iOS UI Test */ = { + isa = PBXGroup; + children = ( + AB665BB2171342C0007F2151 /* mailcore2.xcodeproj */, + AB9EAE14170368F000D750C7 /* AppDelegate.h */, + AB9EAE15170368F000D750C7 /* AppDelegate.m */, + AB9EAE1D170368F000D750C7 /* MainStoryboard.storyboard */, + AB9EAE20170368F000D750C7 /* MasterViewController.h */, + AB9EAE21170368F000D750C7 /* MasterViewController.m */, + AB9EAE23170368F000D750C7 /* DetailViewController.h */, + AB9EAE24170368F000D750C7 /* DetailViewController.m */, + AB9EAE0C170368F000D750C7 /* Supporting Files */, + AB9EAE3317036FD600D750C7 /* SettingsViewController.h */, + AB9EAE3417036FD600D750C7 /* SettingsViewController.m */, + AB9EAE3517036FD700D750C7 /* SettingsViewController.xib */, + AB665BC917134336007F2151 /* common */, + ); + path = "iOS UI Test"; + sourceTree = ""; + }; + AB9EAE0C170368F000D750C7 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + AB9EAE0D170368F000D750C7 /* iOS UI Test-Info.plist */, + AB9EAE0E170368F000D750C7 /* InfoPlist.strings */, + AB9EAE11170368F000D750C7 /* main.m */, + AB9EAE13170368F000D750C7 /* iOS UI Test-Prefix.pch */, + AB9EAE17170368F000D750C7 /* Default.png */, + AB9EAE19170368F000D750C7 /* Default@2x.png */, + AB9EAE1B170368F000D750C7 /* Default-568h@2x.png */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + AB9EAE01170368F000D750C7 /* iOS UI Test */ = { + isa = PBXNativeTarget; + buildConfigurationList = AB9EAE28170368F000D750C7 /* Build configuration list for PBXNativeTarget "iOS UI Test" */; + buildPhases = ( + AB9EADFE170368F000D750C7 /* Sources */, + AB9EADFF170368F000D750C7 /* Frameworks */, + AB9EAE00170368F000D750C7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + AB665BC7171342FF007F2151 /* PBXTargetDependency */, + ); + name = "iOS UI Test"; + productName = "iOS UI Test"; + productReference = AB9EAE02170368F000D750C7 /* iOS UI Test.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + AB9EADFA170368F000D750C7 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0460; + ORGANIZATIONNAME = AppJon; + }; + buildConfigurationList = AB9EADFD170368F000D750C7 /* Build configuration list for PBXProject "iOS UI Test" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = AB9EADF9170368F000D750C7; + productRefGroup = AB9EAE03170368F000D750C7 /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = AB665BB3171342C0007F2151 /* Products */; + ProjectRef = AB665BB2171342C0007F2151 /* mailcore2.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + AB9EAE01170368F000D750C7 /* iOS UI Test */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + AB665BBB171342C1007F2151 /* libMailCore.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libMailCore.a; + remoteRef = AB665BBA171342C1007F2151 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + AB665BBD171342C1007F2151 /* libMailCore-ios.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libMailCore-ios.a"; + remoteRef = AB665BBC171342C1007F2151 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + AB665BBF171342C1007F2151 /* tests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = tests; + remoteRef = AB665BBE171342C1007F2151 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + AB665BC1171342C1007F2151 /* test-ios.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = "test-ios.app"; + remoteRef = AB665BC0171342C1007F2151 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + AB665BC3171342C1007F2151 /* MailCore.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = MailCore.framework; + remoteRef = AB665BC2171342C1007F2151 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + AB9EAE00170368F000D750C7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + AB9EAE10170368F000D750C7 /* InfoPlist.strings in Resources */, + AB9EAE18170368F000D750C7 /* Default.png in Resources */, + AB9EAE1A170368F000D750C7 /* Default@2x.png in Resources */, + AB9EAE1C170368F000D750C7 /* Default-568h@2x.png in Resources */, + AB9EAE1F170368F000D750C7 /* MainStoryboard.storyboard in Resources */, + AB9EAE3717036FD700D750C7 /* SettingsViewController.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + AB9EADFE170368F000D750C7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + AB9EAE12170368F000D750C7 /* main.m in Sources */, + AB9EAE16170368F000D750C7 /* AppDelegate.m in Sources */, + AB9EAE22170368F000D750C7 /* MasterViewController.m in Sources */, + AB9EAE25170368F000D750C7 /* DetailViewController.m in Sources */, + AB9EAE3617036FD700D750C7 /* SettingsViewController.m in Sources */, + AB665BCD17134336007F2151 /* FXKeychain.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + AB665BC7171342FF007F2151 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "static mailcore2 ios"; + targetProxy = AB665BC6171342FF007F2151 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + AB9EAE0E170368F000D750C7 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + AB9EAE0F170368F000D750C7 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + AB9EAE1D170368F000D750C7 /* MainStoryboard.storyboard */ = { + isa = PBXVariantGroup; + children = ( + AB9EAE1E170368F000D750C7 /* en */, + ); + name = MainStoryboard.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + AB9EAE26170368F000D750C7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 6.1; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + AB9EAE27170368F000D750C7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 6.1; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + AB9EAE29170368F000D750C7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "iOS UI Test/iOS UI Test-Prefix.pch"; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../Externals/libetpan/include", + "$(SRCROOT)/../../Externals/icu4c/include", + "$(SRCROOT)/../../Externals/ctemplate/include", + "$(SRCROOT)/../../src", + ); + INFOPLIST_FILE = "iOS UI Test/iOS UI Test-Info.plist"; + OTHER_LDFLAGS = "-Objc"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + AB9EAE2A170368F000D750C7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "iOS UI Test/iOS UI Test-Prefix.pch"; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../Externals/libetpan/include", + "$(SRCROOT)/../../Externals/icu4c/include", + "$(SRCROOT)/../../Externals/ctemplate/include", + "$(SRCROOT)/../../src", + ); + INFOPLIST_FILE = "iOS UI Test/iOS UI Test-Info.plist"; + OTHER_LDFLAGS = "-Objc"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + AB9EADFD170368F000D750C7 /* Build configuration list for PBXProject "iOS UI Test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + AB9EAE26170368F000D750C7 /* Debug */, + AB9EAE27170368F000D750C7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + AB9EAE28170368F000D750C7 /* Build configuration list for PBXNativeTarget "iOS UI Test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + AB9EAE29170368F000D750C7 /* Debug */, + AB9EAE2A170368F000D750C7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = AB9EADFA170368F000D750C7 /* Project object */; +} diff --git a/example/ios/iOS UI Test/iOS UI Test/AppDelegate.h b/example/ios/iOS UI Test/iOS UI Test/AppDelegate.h new file mode 100644 index 00000000..524e3102 --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/AppDelegate.h @@ -0,0 +1,15 @@ +// +// AppDelegate.h +// iOS UI Test +// +// Created by Jonathan Willing on 4/8/13. +// Copyright (c) 2013 AppJon. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/example/ios/iOS UI Test/iOS UI Test/AppDelegate.m b/example/ios/iOS UI Test/iOS UI Test/AppDelegate.m new file mode 100644 index 00000000..557653f7 --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/AppDelegate.m @@ -0,0 +1,46 @@ +// +// AppDelegate.m +// iOS UI Test +// +// Created by Jonathan Willing on 4/8/13. +// Copyright (c) 2013 AppJon. All rights reserved. +// + +#import "AppDelegate.h" + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + // Override point for customization after application launch. + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application +{ + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application +{ + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application +{ + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application +{ + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application +{ + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/example/ios/iOS UI Test/iOS UI Test/Default-568h@2x.png b/example/ios/iOS UI Test/iOS UI Test/Default-568h@2x.png new file mode 100644 index 00000000..0891b7aa Binary files /dev/null and b/example/ios/iOS UI Test/iOS UI Test/Default-568h@2x.png differ diff --git a/example/ios/iOS UI Test/iOS UI Test/Default.png b/example/ios/iOS UI Test/iOS UI Test/Default.png new file mode 100644 index 00000000..4c8ca6f6 Binary files /dev/null and b/example/ios/iOS UI Test/iOS UI Test/Default.png differ diff --git a/example/ios/iOS UI Test/iOS UI Test/Default@2x.png b/example/ios/iOS UI Test/iOS UI Test/Default@2x.png new file mode 100644 index 00000000..35b84cff Binary files /dev/null and b/example/ios/iOS UI Test/iOS UI Test/Default@2x.png differ diff --git a/example/ios/iOS UI Test/iOS UI Test/DetailViewController.h b/example/ios/iOS UI Test/iOS UI Test/DetailViewController.h new file mode 100644 index 00000000..fe50ad58 --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/DetailViewController.h @@ -0,0 +1,16 @@ +// +// DetailViewController.h +// iOS UI Test +// +// Created by Jonathan Willing on 4/8/13. +// Copyright (c) 2013 AppJon. All rights reserved. +// + +#import + +@interface DetailViewController : UIViewController + +@property (strong, nonatomic) id detailItem; + +@property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel; +@end diff --git a/example/ios/iOS UI Test/iOS UI Test/DetailViewController.m b/example/ios/iOS UI Test/iOS UI Test/DetailViewController.m new file mode 100644 index 00000000..16100698 --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/DetailViewController.m @@ -0,0 +1,51 @@ +// +// DetailViewController.m +// iOS UI Test +// +// Created by Jonathan Willing on 4/8/13. +// Copyright (c) 2013 AppJon. All rights reserved. +// + +#import "DetailViewController.h" + +@interface DetailViewController () +- (void)configureView; +@end + +@implementation DetailViewController + +#pragma mark - Managing the detail item + +- (void)setDetailItem:(id)newDetailItem +{ + if (_detailItem != newDetailItem) { + _detailItem = newDetailItem; + + // Update the view. + [self configureView]; + } +} + +- (void)configureView +{ + // Update the user interface for the detail item. + + if (self.detailItem) { + self.detailDescriptionLabel.text = [self.detailItem description]; + } +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. + [self configureView]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/example/ios/iOS UI Test/iOS UI Test/MasterViewController.h b/example/ios/iOS UI Test/iOS UI Test/MasterViewController.h new file mode 100644 index 00000000..da63eb60 --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/MasterViewController.h @@ -0,0 +1,18 @@ +// +// MasterViewController.h +// iOS UI Test +// +// Created by Jonathan Willing on 4/8/13. +// Copyright (c) 2013 AppJon. All rights reserved. +// + +#import +#import "SettingsViewController.h" +//#import + + +@interface MasterViewController : UITableViewController + +- (IBAction)showSettingsViewController:(id)sender; + +@end diff --git a/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m b/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m new file mode 100644 index 00000000..7a76efa7 --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m @@ -0,0 +1,102 @@ +// +// MasterViewController.m +// iOS UI Test +// +// Created by Jonathan Willing on 4/8/13. +// Copyright (c) 2013 AppJon. All rights reserved. +// + +#import "MasterViewController.h" +#import "DetailViewController.h" +#import +#import "FXKeychain.h" + +@interface MasterViewController () { + NSMutableArray *_objects; +} +@property (nonatomic, strong) MCOIMAPOperation *imapCheckOp; +@property (nonatomic, strong) MCOIMAPSession *imapSession; +@end + +@implementation MasterViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.navigationItem.leftBarButtonItem = self.editButtonItem; + + NSString *username = [[NSUserDefaults standardUserDefaults] objectForKey:UsernameKey]; + NSString *password = [FXKeychain defaultKeychain][PasswordKey]; + + self.imapSession = [[MCOIMAPSession alloc] init]; + self.imapSession.hostname = @"imap.gmail.com"; + self.imapSession.port = 993; + self.imapSession.username = username; + self.imapSession.password = password; + self.imapSession.connectionType = MCOConnectionTypeTLS; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + NSLog(@"%s",__PRETTY_FUNCTION__); +} + +- (void)insertNewObject:(id)sender { + if (!_objects) { + _objects = [[NSMutableArray alloc] init]; + } + [_objects insertObject:[NSDate date] atIndex:0]; + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; + [self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; +} + +#pragma mark - Table View + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return _objects.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; + + NSDate *object = _objects[indexPath.row]; + cell.textLabel.text = [object description]; + return cell; +} + +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the specified item to be editable. + return YES; +} + +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + if (editingStyle == UITableViewCellEditingStyleDelete) { + [_objects removeObjectAtIndex:indexPath.row]; + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. + } +} + +- (void)showSettingsViewController:(id)sender { + SettingsViewController *settingsViewController = [[SettingsViewController alloc] initWithNibName:nil bundle:nil]; + settingsViewController.delegate = self; + [self presentViewController:settingsViewController animated:YES completion:nil]; +} + +- (void)settingsViewControllerFinished:(SettingsViewController *)viewController { + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + if ([[segue identifier] isEqualToString:@"showDetail"]) { + NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; + NSDate *object = _objects[indexPath.row]; + [[segue destinationViewController] setDetailItem:object]; + } +} + +@end diff --git a/example/ios/iOS UI Test/iOS UI Test/SettingsViewController.h b/example/ios/iOS UI Test/iOS UI Test/SettingsViewController.h new file mode 100644 index 00000000..37fd2af4 --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/SettingsViewController.h @@ -0,0 +1,28 @@ +// +// SettingsViewController.h +// iOS UI Test +// +// Created by Jonathan Willing on 4/8/13. +// Copyright (c) 2013 AppJon. All rights reserved. +// + +#import +#import + +extern NSString * const UsernameKey; +extern NSString * const PasswordKey; + +@protocol SettingsViewControllerDelegate; + +@interface SettingsViewController : UIViewController + +@property (weak, nonatomic) IBOutlet UITextField *emailTextField; +@property (weak, nonatomic) IBOutlet UITextField *passwordTextField; +@property (nonatomic, weak) id delegate; +- (IBAction)done:(id)sender; + +@end + +@protocol SettingsViewControllerDelegate +- (void)settingsViewControllerFinished:(SettingsViewController *)viewController; +@end \ No newline at end of file diff --git a/example/ios/iOS UI Test/iOS UI Test/SettingsViewController.m b/example/ios/iOS UI Test/iOS UI Test/SettingsViewController.m new file mode 100644 index 00000000..d7621dd0 --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/SettingsViewController.m @@ -0,0 +1,51 @@ +// +// SettingsViewController.m +// iOS UI Test +// +// Created by Jonathan Willing on 4/8/13. +// Copyright (c) 2013 AppJon. All rights reserved. +// + +#import "SettingsViewController.h" +#import "FXKeychain.h" + +NSString * const UsernameKey = @"username"; +NSString * const PasswordKey = @"password"; + +@interface SettingsViewController () + +@end + +@implementation SettingsViewController + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)done:(id)sender { + [[NSUserDefaults standardUserDefaults] setObject:self.emailTextField.text forKey:UsernameKey]; + [FXKeychain defaultKeychain][PasswordKey] = self.passwordTextField.text; + + [self.delegate settingsViewControllerFinished:self]; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.view.backgroundColor = [UIColor underPageBackgroundColor]; + self.emailTextField.text = [[NSUserDefaults standardUserDefaults] stringForKey:UsernameKey]; + self.passwordTextField.text = [FXKeychain defaultKeychain][PasswordKey]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/example/ios/iOS UI Test/iOS UI Test/SettingsViewController.xib b/example/ios/iOS UI Test/iOS UI Test/SettingsViewController.xib new file mode 100644 index 00000000..6e788970 --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/SettingsViewController.xib @@ -0,0 +1,495 @@ + + + + 1552 + 12D78 + 3084 + 1187.37 + 626.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 2083 + + + IBNSLayoutConstraint + IBProxyObject + IBUIBarButtonItem + IBUINavigationBar + IBUINavigationItem + IBUITextField + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + + + 290 + {320, 44} + + + _NS:9 + IBCocoaTouchFramework + + + + Settings + + IBCocoaTouchFramework + 1 + + 0 + + IBCocoaTouchFramework + + + + + + 292 + {{20, 66}, {280, 30}} + + + _NS:9 + NO + YES + IBCocoaTouchFramework + 0 + + 3 + email + + 3 + MAA + + 2 + + + YES + 17 + + IBCocoaTouchFramework + + 1 + + 1 + 14 + + + Helvetica + 14 + 16 + + + + + 292 + {{20, 104}, {280, 30}} + + + _NS:9 + NO + YES + IBCocoaTouchFramework + 0 + + 3 + password + + 3 + MAA + + + YES + 17 + + YES + IBCocoaTouchFramework + + 1 + + + + + {{0, 20}, {320, 548}} + + + + 1 + MC43MDI5NDc0NDMyIDAuNzAyOTQ3NDQzMiAwLjcwMjk0NzQ0MzIAA + + + + IBUIScreenMetrics + + YES + + + + + + {320, 568} + {568, 320} + + + IBCocoaTouchFramework + Retina 4 Full Screen + 2 + + IBCocoaTouchFramework + + + + + + + view + + + + 3 + + + + emailTextField + + + + 49 + + + + passwordTextField + + + + 50 + + + + done: + + + + 16 + + + + + + 0 + + + + + + 1 + + + + + 3 + 0 + + 4 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 3 + 0 + + 3 + 1 + + 66 + + 1000 + + 3 + 9 + 3 + + + + 5 + 0 + + 5 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + + + + 6 + 0 + + 6 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + 3 + 0 + + 3 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 4 + + + + + + + + 5 + + + + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 15 + + + + + 39 + + + + + + 40 + + + + + 41 + + + + + 44 + + + + + 45 + + + + + 46 + + + + + 47 + + + + + 48 + + + + + + + SettingsViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + + + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 50 + + + 0 + IBCocoaTouchFramework + YES + 3 + YES + 2083 + + diff --git a/example/ios/iOS UI Test/iOS UI Test/en.lproj/InfoPlist.strings b/example/ios/iOS UI Test/iOS UI Test/en.lproj/InfoPlist.strings new file mode 100644 index 00000000..477b28ff --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/example/ios/iOS UI Test/iOS UI Test/en.lproj/MainStoryboard.storyboard b/example/ios/iOS UI Test/iOS UI Test/en.lproj/MainStoryboard.storyboard new file mode 100644 index 00000000..f28d0b06 --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/en.lproj/MainStoryboard.storyboard @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/example/ios/iOS UI Test/iOS UI Test/iOS UI Test-Info.plist b/example/ios/iOS UI Test/iOS UI Test/iOS UI Test-Info.plist new file mode 100644 index 00000000..5459a9e0 --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/iOS UI Test-Info.plist @@ -0,0 +1,50 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.AppJon.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UIMainStoryboardFile + MainStoryboard + UIRequiredDeviceCapabilities + + armv7 + + UIStatusBarTintParameters + + UINavigationBar + + Style + UIBarStyleDefault + Translucent + + + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/example/ios/iOS UI Test/iOS UI Test/iOS UI Test-Prefix.pch b/example/ios/iOS UI Test/iOS UI Test/iOS UI Test-Prefix.pch new file mode 100644 index 00000000..084c93ad --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/iOS UI Test-Prefix.pch @@ -0,0 +1,14 @@ +// +// Prefix header for all source files of the 'iOS UI Test' target in the 'iOS UI Test' project +// + +#import + +#ifndef __IPHONE_5_0 +#warning "This project uses features only available in iOS SDK 5.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/example/ios/iOS UI Test/iOS UI Test/main.m b/example/ios/iOS UI Test/iOS UI Test/main.m new file mode 100644 index 00000000..479c71e4 --- /dev/null +++ b/example/ios/iOS UI Test/iOS UI Test/main.m @@ -0,0 +1,18 @@ +// +// main.m +// iOS UI Test +// +// Created by Jonathan Willing on 4/8/13. +// Copyright (c) 2013 AppJon. All rights reserved. +// + +#import + +#import "AppDelegate.h" + +int main(int argc, char *argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} -- cgit v1.2.3