Merge branch 'develop' into 'master'

Develop

Release 0.2.0

See merge request !1
This commit is contained in:
Giuseppe Nucifora 2016-01-26 11:27:37 +00:00
commit cfe3f77054
99 changed files with 8160 additions and 2041 deletions

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="whP-gf-Uak">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="whP-gf-Uak">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--View Controller-->
<!--Object View Controller-->
<scene sceneID="wQg-tq-qST">
<objects>
<viewController id="whP-gf-Uak" customClass="PNObjectViewController" sceneMemberID="viewController">

View File

@ -1,47 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>giuseppenucifora.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
</dict>
</plist>

View File

@ -8,16 +8,67 @@
#import "PNObjectAppDelegate.h"
#import "PNObject.h"
#import "PNUser.h"
#import "PNAddress.h"
@implementation PNObjectAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[PNObjectConfig sharedInstanceForEnvironments:@{ EnvironmentDevelopment : @"https://development.it/api/v1",
EnvironmentStage : @"https://stage.it/api/v1",
//EnvironmentProduction : @"https://production.it/api/v1"
}];
[PNObjectConfig initSharedInstanceForEnvironments:@{ EnvironmentDevelopment : @"https://development.it/api/v1",
EnvironmentStage : @"https://stage.it/api/v1",
EnvironmentProduction : @"http://pnobjectdemo.giuseppenucifora.com/"
}];
[[PNObjectConfig sharedInstance] setEnvironment:Production];
[[[PNObjectConfig sharedInstance] manager] setSecurityPolicy:[AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]];
[[PNObjectConfig sharedInstance] manager].securityPolicy.allowInvalidCertificates = YES;
//[PNObject get];*/
PNUser *user = [PNUser currentUser];
NSLog(@"user : %@",[user getJSONObject]);
//[user autoRemoveLocally];
/*[user setFirstName:@"Giuseppe2"];
[user setLastName:@"Nucifora2"];
[user setEmail:@"giuseppe.nucifora@giuseppenucifora.com"];
[user setSex:@"M"];
[user setHasAcceptedNewsletter:NO];
[user setHasAcceptedPrivacy:YES];
[user setUsername:@"giuseppe.nucifora"];
[user setPassword:@"giuseppe.nucifora.password"];
[user setPhone:@"+393485904995"];
[user setUserId:@"blablabla"];
[user saveLocally];
*/
//NSLog(@"%@",[user getObject]);
/*
PNAddress *address1 = [[PNAddress alloc] init];
[address1 setZip:@"95014"];
[address1 setCountry:@"Italy"];
[address1 setCity:@"Giarre"];
[address1 setProvince:@"Catania"];
NSLog(@"%@",[address1 saveLocally]);
PNAddress *address2 = [[PNAddress alloc] init];
[address2 setZip:@"95014"];
[address2 setCountry:@"Italy"];
[address2 setCity:@"Giarre"];
[address2 setProvince:@"Catania"];
NSLog(@"%@",[address2 saveLocally]);*/
return YES;
}

View File

@ -7,7 +7,6 @@
//
#import "PNObjectViewController.h"
//#import "PNObject.h"
@interface PNObjectViewController ()

View File

@ -4,18 +4,22 @@ use_frameworks!
target 'PNObject_Example' do
pod "PNObject", :path => "../"
pod 'PEAR-FileManager-iOS'
pod 'NSDate_Utils'
pod 'UIDevice-Utils'
pod 'AFNetworking',
pod "PNObject", :path => "../"
pod 'PEAR-FileManager-iOS'
pod 'NSDate_Utils'
pod 'UIDevice-Utils'
pod 'AFNetworking'
pod 'nv-ios-http-status'
pod 'NSString-Helper'
pod 'CodFis-Helper'
pod 'StrongestPasswordValidator'
end
target 'PNObject_Tests' do
pod "PNObject", :path => "../"
pod 'Specta'
pod 'Expecta'
pod 'FBSnapshotTestCase'
pod 'Expecta+Snapshots'
pod "PNObject", :path => "../"
pod 'Specta'
pod 'Expecta'
pod 'FBSnapshotTestCase'
pod 'Expecta+Snapshots'
end

View File

@ -14,6 +14,7 @@ PODS:
- AFNetworking/Serialization (3.0.4)
- AFNetworking/UIKit (3.0.4):
- AFNetworking/NSURLSession
- CodFis-Helper (0.1.2)
- Expecta (1.0.5)
- Expecta+Snapshots (2.0.0):
- Expecta (~> 1.0)
@ -24,20 +25,34 @@ PODS:
- FBSnapshotTestCase/SwiftSupport (2.0.7):
- FBSnapshotTestCase/Core
- NSDate_Utils (0.1.0)
- NSString-Helper (1.0.2)
- nv-ios-http-status (0.0.1)
- PEAR-FileManager-iOS (1.3.1)
- PNObject (0.1.0)
- PNObject (0.1.0):
- AFNetworking
- CodFis-Helper
- NSDate_Utils
- NSString-Helper
- nv-ios-http-status
- PEAR-FileManager-iOS
- UIDevice-Utils
- Specta (1.0.5)
- UIDevice-Utils (0.1.2)
- StrongestPasswordValidator (0.1.1)
- UIDevice-Utils (0.1.4)
DEPENDENCIES:
- AFNetworking
- CodFis-Helper
- Expecta
- Expecta+Snapshots
- FBSnapshotTestCase
- NSDate_Utils
- NSString-Helper
- nv-ios-http-status
- PEAR-FileManager-iOS
- PNObject (from `../`)
- Specta
- StrongestPasswordValidator
- UIDevice-Utils
EXTERNAL SOURCES:
@ -46,15 +61,19 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AFNetworking: a0075feb321559dc78d9d85b55d11caa19eabb93
CodFis-Helper: f303810699f22dbcba8fb8c600545ac91fc3ec42
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
Expecta+Snapshots: 29b38dd695bc72a0ed2bea833937d78df41943ba
FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547
NSDate_Utils: 4a57f91094123d5b7600c7de8c9ad9e1d43306a3
NSString-Helper: 0ee74919829a332f9838fa87b28cb2d1d991e92c
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
PNObject: c76ad7edcc1e09717e48eb9554f6d6eb422ea70e
PNObject: b71ba455c15aedd1233cdf02bcf65d348d96da72
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
UIDevice-Utils: 14362004e88f8cc05d8ec68369724a5972faadec
StrongestPasswordValidator: 554de9038705e18904f0337903dfd3b85a6b271b
UIDevice-Utils: 0beb5f9d2bd256a3efe05c1e43a2a8b8702199c4
PODFILE CHECKSUM: 6a156edc70605054ee3ec9b0a6d6af416e100bf0
PODFILE CHECKSUM: 3d7d9ec922a37131d59224a7700af30168ea90b1
COCOAPODS: 1.0.0.beta.2

View File

@ -0,0 +1,45 @@
//
// CodFis+Helper.h
// Pods
//
// Created by Giuseppe Nucifora on 08/07/15.
//
//
#import <Foundation/Foundation.h>
#import "CodFisResponse.h"
@interface CodFis_Helper : NSObject
typedef enum {
Italy,
OtherCountries
} State;
typedef enum {
Gender_Woman,
Gender_Man
} Gender;
@property (nonatomic, strong) NSString *surname;
@property (nonatomic, strong) NSString *name;
@property (nonatomic) NSInteger birthDay;
@property (nonatomic) NSInteger birthMonth;
@property (nonatomic) NSInteger birthYear;
@property (nonatomic, assign) Gender gender;
@property (nonatomic, assign) State state;
@property (nonatomic, strong) NSString *place;
@property (nonatomic) BOOL collision;
+ (CodFisResponse*) calculateFromSurname:(NSString*) surname name:(NSString*) name birthDay:(NSInteger) birthDay birthMonth:(NSInteger) birthMonth birthYear:(NSInteger) birthYear gender:(Gender) gender state:(State) state place:(NSString*) place collision:(BOOL) collision;
+ (BOOL) checkCodFisFromSurname:(NSString*) surname name:(NSString*) name birthDay:(NSInteger) birthDay birthMonth:(NSInteger) birthMonth birthYear:(NSInteger) birthYear gender:(Gender) gender state:(State) state place:(NSString*) place collision:(BOOL) collision andCodFis:(NSString*) codFis;
- (instancetype) initFromSurname:(NSString*) surname name:(NSString*) name birthDay:(NSInteger) birthDay birthMonth:(NSInteger) birthMonth birthYear:(NSInteger) birthYear gender:(Gender) gender state:(State) state place:(NSString*) place collision:(BOOL) collision;
- (CodFisResponse*) calculate;
- (BOOL) check:(NSString*) codFis;
@end

View File

@ -0,0 +1,458 @@
//
// CodFis+self.m
// Pods
//
// Created by Giuseppe Nucifora on 08/07/15.
//
//
#import "CodFis+Helper.h"
#define DEF_SURNAME_COD_LENGHT 3
#define DEF_NAME_COD_LENGHT 3
@interface CodFis_Helper() {
NSNumberFormatter* numberFormatter;
}
@property (nonatomic, strong) NSString *codFis;
@end
@implementation CodFis_Helper
+ (CodFisResponse*) calculateFromSurname:(NSString*) surname name:(NSString*) name birthDay:(NSInteger) birthDay birthMonth:(NSInteger) birthMonth birthYear:(NSInteger) birthYear gender:(Gender) gender state:(State) state place:(NSString*) place collision:(BOOL) collision {
return [[[self alloc] initFromSurname:surname name:name birthDay:birthDay birthMonth:birthMonth birthYear:birthYear gender:gender state:state place:place collision:collision] calculate];
}
+ (BOOL) checkCodFisFromSurname:(NSString*) surname name:(NSString*) name birthDay:(NSInteger) birthDay birthMonth:(NSInteger) birthMonth birthYear:(NSInteger) birthYear gender:(Gender) gender state:(State) state place:(NSString*) place collision:(BOOL) collision andCodFis:(NSString*) codFis {
return [[[self alloc] initFromSurname:surname name:name birthDay:birthDay birthMonth:birthMonth birthYear:birthYear gender:gender state:state place:place collision:collision] check:codFis];
}
- (instancetype) initFromSurname:(NSString*) surname name:(NSString*) name birthDay:(NSInteger) birthDay birthMonth:(NSInteger) birthMonth birthYear:(NSInteger) birthYear gender:(Gender) gender state:(State) state place:(NSString*) place collision:(BOOL) collision {
self = [super init];
if (self) {
[self setSurname:surname];
[self setName:name];
[self setBirthDay:birthDay];
[self setBirthMonth:birthMonth];
[self setBirthYear:birthYear];
[self setGender:gender];
[self setState:state];
[self setPlace:place];
}
return self;
}
- (CodFisResponse*) calculate {
NSMutableArray *errors = [[NSMutableArray alloc] init];
NSMutableString *resposeString = [[NSMutableString alloc] init];
NSString *tempResponse = [self getCodFisSurname];
if (!tempResponse) {
[errors addObject:[NSError errorWithDomain:NSLocalizedString(@"Bad Request in Surname", @"") code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",NSLocalizedString(@"Bad Request in Surname", @""),@"Message", nil],@"Meta", nil]]];
}
else {
[resposeString appendString:tempResponse];
}
tempResponse = [self getCodFisName];
if (!tempResponse) {
[errors addObject:[NSError errorWithDomain:NSLocalizedString(@"Bad Request in Surname", @"") code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",NSLocalizedString(@"Bad Request in Surname", @""),@"Message", nil],@"Meta", nil]]];
}
else {
[resposeString appendString:tempResponse];
}
tempResponse = [self getCodFisYear];
if (!tempResponse) {
[errors addObject:[NSError errorWithDomain:NSLocalizedString(@"Bad Request in Surname", @"") code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",NSLocalizedString(@"Bad Request in Surname", @""),@"Message", nil],@"Meta", nil]]];
}
else {
[resposeString appendString:tempResponse];
}
tempResponse = [self getCodFisMonth];
if (!tempResponse) {
[errors addObject:[NSError errorWithDomain:NSLocalizedString(@"Bad Request in Surname", @"") code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",NSLocalizedString(@"Bad Request in Surname", @""),@"Message", nil],@"Meta", nil]]];
}
else {
[resposeString appendString:tempResponse];
}
tempResponse = [self getCodFisDay];
if (!tempResponse) {
[errors addObject:[NSError errorWithDomain:NSLocalizedString(@"Bad Request in Surname", @"") code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",NSLocalizedString(@"Bad Request in Surname", @""),@"Message", nil],@"Meta", nil]]];
}
else {
[resposeString appendString:tempResponse];
}
tempResponse = [self getCodFisPlace];
if (!tempResponse) {
[errors addObject:[NSError errorWithDomain:NSLocalizedString(@"Bad Request in Surname", @"") code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",NSLocalizedString(@"Bad Request in Surname", @""),@"Message", nil],@"Meta", nil]]];
}
else {
[resposeString appendString:tempResponse];
}
_codFis = [resposeString stringByReplacingOccurrencesOfString:@" " withString:@""];;
[resposeString appendString:[self getCodFisControlCode]];
NSString *checkString = [self ControllaCF:[resposeString UTF8String]];
if ([checkString isEqualToString:@""]) {
}
else {
[errors addObject:[NSError errorWithDomain:checkString code:ResponseStatusBadRequest userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:ResponseStatusBadRequest],@"Code",checkString,@"Message", nil],@"Meta", nil]]];
}
return [[CodFisResponse alloc] initWithResponse:resposeString andErrors:errors];
}
- (BOOL) check:(NSString*) codFis {
return [[[self calculate] response] isEqualToString:[codFis uppercaseString]];
}
- (NSString *) getCodFisSurname {
NSMutableString *resultString = [[NSMutableString alloc] init];
NSMutableArray *consonantsArray = [NSMutableArray arrayWithArray:[self getConsonantArray:_surname]];
NSMutableArray *vowelArray = [NSMutableArray arrayWithArray:[self getVowelsArray:_surname]];
for (NSString *chr in consonantsArray) {
if (![chr isEqualToString:@""]) {
[resultString appendString:chr];
}
}
if ([resultString length] > DEF_SURNAME_COD_LENGHT) {
return [[resultString substringToIndex:DEF_SURNAME_COD_LENGHT] uppercaseString];
}
for (NSString *chr in vowelArray) {
if (![chr isEqualToString:@""]) {
[resultString appendString:chr];
}
}
if ([resultString length] > DEF_SURNAME_COD_LENGHT) {
[resultString setString:[resultString substringToIndex:DEF_SURNAME_COD_LENGHT]];
}
else {
for(NSUInteger i = [resultString length]; i< DEF_SURNAME_COD_LENGHT;i++){
[resultString appendString:@"x"];
}
}
return [resultString uppercaseString];
}
- (NSString *) getCodFisName {
NSMutableString *resultString = [[NSMutableString alloc] init];
NSMutableArray *consonantsArray = [NSMutableArray arrayWithArray:[self getConsonantArray:_name]];
NSMutableArray *vowelArray = [NSMutableArray arrayWithArray:[self getVowelsArray:_name]];
for (NSString *chr in [consonantsArray mutableCopy]) {
if ([chr isEqualToString:@""]) {
[consonantsArray removeObject:chr];
}
}
if ([consonantsArray count] > DEF_NAME_COD_LENGHT) {
[resultString appendString:[consonantsArray objectAtIndex:0]];
[resultString appendString:[consonantsArray objectAtIndex:2]];
[resultString appendString:[consonantsArray objectAtIndex:3]];
}
else {
for (NSString *chr in consonantsArray) {
if (![chr isEqualToString:@""]) {
[resultString appendString:chr];
}
}
if ([resultString length] > DEF_SURNAME_COD_LENGHT) {
return [[resultString substringToIndex:DEF_SURNAME_COD_LENGHT] uppercaseString];
}
for (NSString *chr in vowelArray) {
if (![chr isEqualToString:@""]) {
[resultString appendString:chr];
}
}
if ([resultString length] > DEF_SURNAME_COD_LENGHT) {
[resultString setString:[resultString substringToIndex:DEF_SURNAME_COD_LENGHT]];
}
else {
for(NSUInteger i = [resultString length]; i< DEF_SURNAME_COD_LENGHT;i++){
[resultString appendString:@"x"];
}
}
}
return [resultString uppercaseString];
}
- (NSString *) getCodFisYear {
if (_birthYear < 100) {
return [NSString stringWithFormat:@"%ld",(long)_birthYear];
}
else {
NSString * allDigits = [NSString stringWithFormat:@"%ld",(long)_birthYear];
return [allDigits substringWithRange:NSMakeRange(allDigits.length -2, 2)];
}
return nil;
}
- (NSString *) getCodFisMonth {
NSArray *mounths = @[@"A",@"B",@"C",@"D",@"E",@"H",@"L",@"M",@"P",@"R",@"S",@"T"];
if (_birthMonth <= 12) {
return [mounths objectAtIndex:_birthMonth-1];
}
return nil;
}
- (NSString *) getCodFisDay {
NSInteger increment = 0;
switch (_gender) {
case Gender_Woman:
increment = 40;
break;
case Gender_Man:
default: {
increment = 0;
}
break;
}
BOOL checkMonth = NO;
switch (_birthMonth) {
case 2:{
if(_birthDay < 29) {
checkMonth = YES;
}
}
break;
case 4:
case 6:
case 9:
case 11:{
if(_birthDay < 30) {
checkMonth = YES;
}
}
break;
default:{
if(_birthDay < 31) {
checkMonth = YES;
}
}
break;
}
if (checkMonth) {
return [NSString stringWithFormat:@"%02ld",(long)_birthDay + increment];
}
return nil;
}
- (NSArray*) getConsonantArray:(NSString*) string {
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"([A,Á,Ã,E,É,Ê,I,Í,O,Ô,Ó,Õ,U,Û,Ü,Ú]?)" options:NSRegularExpressionCaseInsensitive error:nil];
string = [[string uppercaseString] stringByReplacingOccurrencesOfString:@" " withString:@""];
NSString *resultString = [regex stringByReplacingMatchesInString:string options:0 range:NSMakeRange(0, [string length]) withTemplate:@""];
NSMutableArray *responseArray = [[NSMutableArray alloc] init];
for (int i = 0; i < [resultString length]; i++) {
[responseArray addObject:[resultString substringWithRange:NSMakeRange(i, 1)]];
}
return responseArray;
}
- (NSArray*) getVowelsArray:(NSString *) string {
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"([Q,W,R,T,Y,P,S,D,F,G,H,J,K,L,Z,X,C,V,B,N,M]?)" options:NSRegularExpressionCaseInsensitive error:nil];
string = [[string uppercaseString] stringByReplacingOccurrencesOfString:@" " withString:@""];
NSString *resultString = [regex stringByReplacingMatchesInString:string options:0 range:NSMakeRange(0, [string length]) withTemplate:@""];
NSMutableArray *responseArray = [[NSMutableArray alloc] init];
for (int i = 0; i < [resultString length]; i++) {
[responseArray addObject:[resultString substringWithRange:NSMakeRange(i, 1)]];
}
return responseArray;
}
- (NSString *) getCodFisPlace {
NSString *responseString;
NSError *error = nil;
NSData *data = [[NSData alloc] initWithContentsOfFile:[self getCodFisPlaceListFile] options:NSDataReadingMappedAlways error:&error];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
@try {
responseString = [json objectForKey:[_place uppercaseString]];
}
@catch (NSException *exception) {
}
@finally {
if (responseString) {
return responseString;
}
}
return nil;
}
- (NSString *) getCodFisControlCode {
NSArray *contributeCode = @[@"1",@"0",@"5",@"7",@"9",@"13",@"15",@"17",@"19",@"21",@"2",@"4",@"18",@"20",@"11",@"3",@"6",@"8",@"12",@"14",@"16",@"10",@"22",@"25",@"24",@"23"];
NSArray *reponseCode = @[@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",@"M",@"N",@"O",@"P",@"Q",@"R",@"S",@"T",@"U",@"V",@"W",@"X",@"Y",@"Z"];
NSInteger tempIndex = 0;
NSInteger index = 1;
for (NSString *chr in [self getcodFisArray]) {
if ([self isNumeric:chr]) {
if (index%2 == 0) {
tempIndex += [chr integerValue]; }
else {
tempIndex += [[contributeCode objectAtIndex:[chr integerValue]] integerValue];
}
}
else {
if (index%2 == 0) {
tempIndex += [self getAlphabetContributeCode:chr];
}
else {
tempIndex += [[contributeCode objectAtIndex:[self getAlphabetContributeCode:chr]] integerValue];
}
}
index++;
}
return [reponseCode objectAtIndex:ceil((int)tempIndex%26)];
}
- (NSInteger) getAlphabetContributeCode:(NSString *) chr {
unichar c = [chr characterAtIndex:0];
return (NSInteger)(((short)c)-65);
}
- (NSString*) getCodFisPlaceListFile {
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"codFisCodes" ofType:@"json"];
return filePath;
}
- (NSArray *) getcodFisArray
{
NSMutableArray *arr = [[NSMutableArray alloc]init];
for (int i=0; i < _codFis.length; i++) {
NSString *tmp_str = [_codFis substringWithRange:NSMakeRange(i, 1)];
[arr addObject:[tmp_str stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
}
return arr;
}
-(BOOL) isNumeric:(NSString*) hexText
{
if (!numberFormatter) {
numberFormatter = [[NSNumberFormatter alloc] init];
}
NSNumber* number = [numberFormatter numberFromString:hexText];
if (number != nil) {
return true;
}
return false;
}
- (NSString *) ControllaCF:(const char *) cf {
int s, i, c;
int setdisp[] = { 1, 0, 5, 7, 9, 13, 15, 17, 19, 21, 2, 4, 18, 20,
11, 3, 6, 8, 12, 14, 16, 10, 22, 25, 24, 23 };
if( cf[0] == 0 ) return @"";
if( strlen(cf) != 16 )
return NSLocalizedString(@"La lunghezza del codice fiscale non &egrave;\n"
"corretta: il codice fiscale dovrebbe essere lungo\n"
"esattamente 16 caratteri.", @"");
for( i=0; i<16; i++ ){
c = toupper( cf[i] );
if( ! isdigit(c) && !( 'A'<=c && c<='Z' ) )
return NSLocalizedString(@"Il codice fiscale contiene dei caratteri non validi:\n"
"i soli caratteri validi sono le lettere e le cifre.",@"");
}
s = 0;
for( i=1; i<=13; i+=2 ){
c = toupper( cf[i] );
if( isdigit(c) )
s += c - '0';
else
s += c - 'A';
}
for( i=0; i<=14; i+=2 ){
c = toupper( cf[i] );
if( isdigit(c) ) c = c - '0' + 'A';
s += setdisp[c - 'A'];
}
if( s%26 + 'A' != toupper( cf[15] ) )
return NSLocalizedString(@"Il codice fiscale non &egrave; corretto:\n"
"il codice di controllo non corrisponde.",@"");
return @"";
}
@end

View File

@ -0,0 +1,19 @@
//
// CodFisResponse.h
// CodFis-Helper
//
// Created by Giuseppe Nucifora on 09/07/15.
// Copyright (c) 2015 Giuseppe Nucifora. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ResponseConstants.h"
@interface CodFisResponse : NSObject
@property (nonatomic, strong, readonly) NSArray *responseErrors;
@property (nonatomic, strong, readonly) NSString *response;
- (instancetype) initWithResponse:(NSString*) response andErrors:(NSArray*) responseErrors;
@end

View File

@ -0,0 +1,22 @@
//
// CodFisResponse.m
// CodFis-Helper
//
// Created by Giuseppe Nucifora on 09/07/15.
// Copyright (c) 2015 Giuseppe Nucifora. All rights reserved.
//
#import "CodFisResponse.h"
@implementation CodFisResponse
- (instancetype) initWithResponse:(NSString*) response andErrors:(NSArray*) responseErrors {
self = [super init];
if (self) {
_responseErrors = [NSArray arrayWithArray:responseErrors];
_response = response;
}
return self;
}
@end

View File

@ -0,0 +1,64 @@
//
// ResponseConstants.h
// cinecitta
//
// Created by Giuseppe Nucifora on 30/06/14.
// Copyright (c) 2014 meedori. All rights reserved.
//
typedef enum {
// Informational
ResponseStatusContinue = 100,
ResponseStatusSwitchingProtocols = 101,
// Successful
ResponseStatusOK = 200,
ResponseStatusCreated = 201,
ResponseStatusAccepted = 202,
ResponseStatusNonAuthoritativeInformation = 203,
ResponseStatusNoContent = 204,
ResponseStatusResetContent = 205,
ResponseStatusPartialContent = 206,
// Redirection
ResponseStatusMutltipleChoices = 300,
ResponseStatusMovedPermanently = 301,
ResponseStatusFound = 302,
ResponseStatusSeeOther = 303,
ResponseStatusNotModified = 304,
ResponseStatusUseProxy = 305,
ResponseStatusSwitchProxy = 306,
ResponseStatusTemporaryRedirect = 307,
// Client Errors
ResponseStatusBadRequest = 400,
ResponseStatusUnauthorized = 401,
ResponseStatusPaymentRequired = 402,
ResponseStatusForbidden = 403,
ResponseStatusNotFound = 404,
ResponseStatusMethodNotAllowed = 405,
ResponseStatusNotAcceptable = 406,
ResponseStatusProxyAuthenticationRequired = 407,
ResponseStatusRequestTimeout = 408,
ResponseStatusConflict = 409,
ResponseStatusGone = 410,
ResponseStatusLengthRequired = 411,
ResponseStatusPreconditionFailed = 412,
ResponseStatusRequestEntityTooLarge = 413,
ResponseStatusRequestURITooLong = 414,
ResponseStatusUnsupportedMediaType = 415,
ResponseStatusRequestedRangeNotSatisfiable = 416,
ResponseStatusExpectationFailed = 417,
// Server Errors
ResponseStatusInternalServerError = 500,
ResponseStatusNotImpemented = 501,
ResponseStatusBadGateway = 502,
ResponseStatusServiceUnavailable = 503,
ResponseStatusGatewayTimeout = 504,
ResponseStatusVersionNotSupported = 505
} ResponseStatus;

View File

@ -0,0 +1,15 @@
//
// VatNumber+Helper.h
// Pods
//
// Created by Giuseppe Nucifora on 13/07/15.
//
//
#import <Foundation/Foundation.h>
@interface VatNumber_Helper : NSObject
+ (NSString *) evaluate:(NSString*) vatNum;
@end

View File

@ -0,0 +1,44 @@
//
// VatNumber+Helper.m
// Pods
//
// Created by Giuseppe Nucifora on 13/07/15.
//
//
#import "VatNumber+Helper.h"
@implementation VatNumber_Helper
+ (NSString *) evaluate:(NSString*) vatNum {
vatNum = [vatNum stringByReplacingOccurrencesOfString:@" " withString:@""];
const char * vatNumC = [vatNum UTF8String];
int i, c, s;
if( vatNumC[0] == 0 ) return @"";
if( strlen(vatNumC) != 11 )
return @"La lunghezza della partita IVA non &egrave;\n"
"corretta: la partita IVA dovrebbe essere lunga\n"
"esattamente 11 caratteri.\n";
for( i=0; i<11; i++ ){
if( ! isdigit(vatNumC[i]) )
return @"La partita IVA contiene dei caratteri non ammessi:\n"
"la partita IVA dovrebbe contenere solo cifre.\n";
}
s = 0;
for( i=0; i<=9; i+=2 )
s += vatNumC[i] - '0';
for( i=1; i<=9; i+=2 ){
c = 2*( vatNumC[i] - '0' );
if( c > 9 ) c = c - 9;
s += c;
}
if( ( 10 - s%10 )%10 != vatNumC[10] - '0' )
return @"La partita IVA non &egrave; valida:\n"
"il codice di controllo non corrisponde.";
return @"";
}
@end

19
Example/Pods/CodFis-Helper/LICENSE generated Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

61
Example/Pods/CodFis-Helper/README.md generated Normal file
View File

@ -0,0 +1,61 @@
# CodFis-Helper
[![CI Status](http://img.shields.io/travis/Giuseppe Nucifora/CodFis-Helper.svg?style=flat)](https://travis-ci.org/Giuseppe Nucifora/CodFis-Helper)
[![Version](https://img.shields.io/cocoapods/v/CodFis-Helper.svg?style=flat)](http://cocoapods.org/pods/CodFis-Helper)
[![License](https://img.shields.io/cocoapods/l/CodFis-Helper.svg?style=flat)](http://cocoapods.org/pods/CodFis-Helper)
[![Platform](https://img.shields.io/cocoapods/p/CodFis-Helper.svg?style=flat)](http://cocoapods.org/pods/CodFis-Helper)
## Usage
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
## Installation
CodFis-Helper is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'CodFis-Helper' , :git => 'https://github.com/giuseppenucifora/CodFis-Helper.git'
OR
pod 'CodFis-Helper'
```
##Usage
```ruby
CodFis_Helper *helper = [[CodFis_Helper alloc] init];
[helper setSurname:@"Rossi"];
[helper setName:@"Mario"];
[helper setBirthDay:15];
[helper setBirthMonth:11];
[helper setBirthYear:83];
[helper setGender:Gender_Man];
[helper setState:Italy];
[helper setPlace:@"Milano"];
CodFisResponse *response = [helper calculate];
NSLog(@"%@",[response responseError]);
NSLog(@"%@",[response response]);
```
## Author
Giuseppe Nucifora, me@giuseppenucifora.com
## License
CodFis-Helper is available under the MIT license. See the LICENSE file for more info.

View File

@ -1,14 +1,14 @@
{
"name": "PNObject",
"version": "0.1.0",
"summary": "A short description of PNObject.",
"homepage": "https://github.com/<GITHUB_USERNAME>/PNObject",
"summary": "PNObject.",
"homepage": "https://github.com/giuseppenucifora/PNObject",
"license": "MIT",
"authors": {
"Giuseppe Nucifora": "me@giuseppenucifora.com"
},
"source": {
"git": "https://github.com/<GITHUB_USERNAME>/PNObject.git",
"git": "https://github.com/giuseppenucifora/PNObject.git",
"tag": "0.1.0"
},
"platforms": {
@ -20,5 +20,28 @@
"PNObject": [
"Pod/Assets/*.png"
]
},
"dependencies": {
"AFNetworking": [
],
"PEAR-FileManager-iOS": [
],
"NSDate_Utils": [
],
"UIDevice-Utils": [
],
"nv-ios-http-status": [
],
"NSString-Helper": [
],
"CodFis-Helper": [
]
}
}

View File

@ -14,6 +14,7 @@ PODS:
- AFNetworking/Serialization (3.0.4)
- AFNetworking/UIKit (3.0.4):
- AFNetworking/NSURLSession
- CodFis-Helper (0.1.2)
- Expecta (1.0.5)
- Expecta+Snapshots (2.0.0):
- Expecta (~> 1.0)
@ -24,20 +25,34 @@ PODS:
- FBSnapshotTestCase/SwiftSupport (2.0.7):
- FBSnapshotTestCase/Core
- NSDate_Utils (0.1.0)
- NSString-Helper (1.0.2)
- nv-ios-http-status (0.0.1)
- PEAR-FileManager-iOS (1.3.1)
- PNObject (0.1.0)
- PNObject (0.1.0):
- AFNetworking
- CodFis-Helper
- NSDate_Utils
- NSString-Helper
- nv-ios-http-status
- PEAR-FileManager-iOS
- UIDevice-Utils
- Specta (1.0.5)
- UIDevice-Utils (0.1.2)
- StrongestPasswordValidator (0.1.1)
- UIDevice-Utils (0.1.4)
DEPENDENCIES:
- AFNetworking
- CodFis-Helper
- Expecta
- Expecta+Snapshots
- FBSnapshotTestCase
- NSDate_Utils
- NSString-Helper
- nv-ios-http-status
- PEAR-FileManager-iOS
- PNObject (from `../`)
- Specta
- StrongestPasswordValidator
- UIDevice-Utils
EXTERNAL SOURCES:
@ -46,15 +61,19 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AFNetworking: a0075feb321559dc78d9d85b55d11caa19eabb93
CodFis-Helper: f303810699f22dbcba8fb8c600545ac91fc3ec42
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
Expecta+Snapshots: 29b38dd695bc72a0ed2bea833937d78df41943ba
FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547
NSDate_Utils: 4a57f91094123d5b7600c7de8c9ad9e1d43306a3
NSString-Helper: 0ee74919829a332f9838fa87b28cb2d1d991e92c
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
PNObject: c76ad7edcc1e09717e48eb9554f6d6eb422ea70e
PNObject: b71ba455c15aedd1233cdf02bcf65d348d96da72
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
UIDevice-Utils: 14362004e88f8cc05d8ec68369724a5972faadec
StrongestPasswordValidator: 554de9038705e18904f0337903dfd3b85a6b271b
UIDevice-Utils: 0beb5f9d2bd256a3efe05c1e43a2a8b8702199c4
PODFILE CHECKSUM: 6a156edc70605054ee3ec9b0a6d6af416e100bf0
PODFILE CHECKSUM: 3d7d9ec922a37131d59224a7700af30168ea90b1
COCOAPODS: 1.0.0.beta.2

19
Example/Pods/NSString-Helper/LICENSE generated Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,23 @@
//
// NSString+Helper.h
//
//
// Created by Giuseppe Nucifora on 02/07/15.
// Copyright (c) 2015 Giuseppe Nucifora All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSString (Helper)
- (BOOL) isValidEmail;
- (BOOL) isNumeric;
- (BOOL) isValidPhoneNumber;
- (BOOL) isValidUrl;
- (BOOL) isValidTaxCode;
@end

View File

@ -0,0 +1,61 @@
//
// NSString+Helper.m
//
//
// Created by Giuseppe Nucifora on 02/07/15.
// Copyright (c) 2015 Giuseppe Nucifora All rights reserved.
//
#import "NSString+Helper.h"
@implementation NSString (Helper)
- (BOOL) isValidEmail
{
BOOL stricterFilter = YES;
NSString *stricterFilterString = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSString *laxString = @".+@.+\\.[A-Za-z]{2}[A-Za-z]*";
NSString *emailRegex = stricterFilter ? stricterFilterString : laxString;
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:self];
}
- (BOOL)isNumeric {
BOOL isValid = NO;
NSCharacterSet *alphaNumbersSet = [NSCharacterSet decimalDigitCharacterSet];
NSCharacterSet *stringSet = [NSCharacterSet characterSetWithCharactersInString:self];
isValid = [alphaNumbersSet isSupersetOfSet:stringSet];
return isValid;
}
- (BOOL) isValidPhoneNumber {
NSError *error = NULL;
NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypePhoneNumber error:&error];
NSArray *matches = [detector matchesInString:self options:0 range:NSMakeRange(0, [self length])];
if (matches != nil) {
for (NSTextCheckingResult *match in matches) {
if ([match resultType] == NSTextCheckingTypePhoneNumber) {
return YES;
}
}
}
return NO;
}
- (BOOL) isValidUrl {
NSString *urlRegEx =
@"(http|https)://((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+";
NSPredicate *urlTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", urlRegEx];
return [urlTest evaluateWithObject:self];
}
- (BOOL) isValidTaxCode {
NSString *urlRegEx = @"^[A-Z]{6}[A-Z0-9]{2}[A-Z][A-Z0-9]{2}[A-Z][A-Z0-9]{3}[A-Z]$";
NSPredicate *urlTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", urlRegEx];
return [urlTest evaluateWithObject:self];
}
@end

49
Example/Pods/NSString-Helper/README.md generated Normal file
View File

@ -0,0 +1,49 @@
# NSString-Helper
[![CI Status](http://img.shields.io/travis/Giuseppe Nucifora/NSString-Helper.svg?style=flat)](https://travis-ci.org/Giuseppe Nucifora/NSString-Helper)
[![Version](https://img.shields.io/cocoapods/v/NSString-Helper.svg?style=flat)](http://cocoapods.org/pods/NSString-Helper)
[![License](https://img.shields.io/cocoapods/l/NSString-Helper.svg?style=flat)](http://cocoapods.org/pods/NSString-Helper)
[![Platform](https://img.shields.io/cocoapods/p/NSString-Helper.svg?style=flat)](http://cocoapods.org/pods/NSString-Helper)
## Usage
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
## Installation
NSString-Helper is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'NSString-Helper'
```
##Usage
```ruby
#import <NSString-Helper/NSString+Helper.h>
NSString *str = @"testCode";
NSLog(@"%@",[NSNumber numberWithBool:[str isNumeric]]);
NSLog(@"%@",[NSNumber numberWithBool:[str isValidPhoneNumber]]);
NSLog(@"%@",[NSNumber numberWithBool:[str isValidEmail]]);
NSLog(@"%@",[NSNumber numberWithBool:[str isValidUrl]]);
NSLog(@"%@",[NSNumber numberWithBool:[str isValidTaxCode]]);
```
## Author
Giuseppe Nucifora, me@giuseppenucifora.com
## License
NSString-Helper is available under the MIT license. See the LICENSE file for more info.

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@
buildForArchiving = "YES">
<BuildableReference
BuildableIdentifier = 'primary'
BlueprintIdentifier = 'B9CEE2C8E8D9960342F45DDE'
BlueprintIdentifier = '4FB4437C636DCECA1396EC4C'
BlueprintName = 'PNObject'
ReferencedContainer = 'container:Pods.xcodeproj'
BuildableName = 'PNObject.framework'>

View File

@ -0,0 +1,19 @@
Copyright (c) 2016 Giuseppe Nucifora <me@giuseppenucifora.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,27 @@
//
// StrongestPasswordValidator.h
//
// Created by Giuseppe Nucifora on 03/01/13.
// Copyright (c) 2013 Giuseppe Nucifora. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface StrongestPasswordValidator : NSObject
typedef NS_ENUM(NSInteger, PasswordStrengthType) {
PasswordStrengthTypeWeak,
PasswordStrengthTypeModerate,
PasswordStrengthTypeStrong
};
+ (instancetype _Nonnull) sharedInstance;
- (void) setColor:(UIColor * _Nonnull) color forPasswordStrenghtType:(PasswordStrengthType) strenghtType;
- (void)checkPasswordStrength:(NSString * _Nonnull )password withBlock:(nullable void (^)(UIColor * _Nonnull color, PasswordStrengthType strenghtType)) responseBlock;
- (PasswordStrengthType)checkPasswordStrength:(NSString * _Nonnull)password;
@end

View File

@ -0,0 +1,171 @@
#import "StrongestPasswordValidator.h"
#define REGEX_PASSWORD_ONE_UPPERCASE @"^(?=.*[A-Z]).*$" //Should contains one or more uppercase letters
#define REGEX_PASSWORD_ONE_LOWERCASE @"^(?=.*[a-z]).*$" //Should contains one or more lowercase letters
#define REGEX_PASSWORD_ONE_NUMBER @"^(?=.*[0-9]).*$" //Should contains one or more number
#define REGEX_PASSWORD_ONE_SYMBOL @"^(?=.*[!@#$%&_]).*$" //Should contains one or more symbol
@interface StrongestPasswordValidator()
@property (nonatomic, strong) UIColor *weakColor;
@property (nonatomic, strong) UIColor *moderateColor;
@property (nonatomic, strong) UIColor *strongColor;
@end
@implementation StrongestPasswordValidator
static StrongestPasswordValidator *SINGLETON = nil;
static bool isFirstAccess = YES;
+ (instancetype)sharedInstance
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
isFirstAccess = NO;
SINGLETON = [[super allocWithZone:NULL] init];
});
return SINGLETON;
}
- (void) setColor:(UIColor *)color forPasswordStrenghtType:(PasswordStrengthType)strenghtType {
switch (strenghtType) {
case PasswordStrengthTypeWeak: {
_weakColor = color;
break;
}
case PasswordStrengthTypeModerate: {
_moderateColor = color;
break;
}
case PasswordStrengthTypeStrong: {
_strongColor = color;
break;
}
}
}
#pragma mark - Life Cycle
+ (instancetype) allocWithZone:(NSZone *)zone
{
return [self sharedInstance];
}
+ (instancetype)copyWithZone:(struct _NSZone *)zone
{
return [self sharedInstance];
}
+ (instancetype)mutableCopyWithZone:(struct _NSZone *)zone
{
return [self sharedInstance];
}
- (instancetype)copy
{
return [[StrongestPasswordValidator alloc] init];
}
- (instancetype)mutableCopy
{
return [[StrongestPasswordValidator alloc] init];
}
- (id) init
{
if(SINGLETON){
return SINGLETON;
}
if (isFirstAccess) {
[self doesNotRecognizeSelector:_cmd];
}
self = [super init];
if (self) {
_weakColor = [UIColor redColor];
_moderateColor = [UIColor yellowColor];
_strongColor = [UIColor greenColor];
}
return self;
}
- (void)checkPasswordStrength:(NSString * _Nonnull )password withBlock:(nullable void (^)(UIColor * _Nonnull color, PasswordStrengthType strenghtType)) responseBlock; {
if (responseBlock) {
PasswordStrengthType strenght = [self checkPasswordStrength:password];
switch (strenght) {
case PasswordStrengthTypeWeak: {
responseBlock(_weakColor,strenght);
break;
}
case PasswordStrengthTypeModerate: {
responseBlock(_moderateColor,strenght);
break;
}
case PasswordStrengthTypeStrong: {
responseBlock(_strongColor,strenght);
break;
}
default:
break;
}
}
}
- (PasswordStrengthType)checkPasswordStrength:(NSString *)password {
NSInteger len = (long)password.length;
//will contains password strength
int strength = 0;
if (len == 0) {
return PasswordStrengthTypeWeak;
} else if (len <= 5) {
strength++;
} else if (len <= 10) {
strength += 2;
} else{
strength += 3;
}
strength += [self validateString:password withPattern:REGEX_PASSWORD_ONE_UPPERCASE caseSensitive:YES];
strength += [self validateString:password withPattern:REGEX_PASSWORD_ONE_LOWERCASE caseSensitive:YES];
strength += [self validateString:password withPattern:REGEX_PASSWORD_ONE_NUMBER caseSensitive:YES];
strength += [self validateString:password withPattern:REGEX_PASSWORD_ONE_SYMBOL caseSensitive:YES];
if(strength <= 3){
return PasswordStrengthTypeWeak;
}else if(3 < strength && strength < 6){
return PasswordStrengthTypeModerate;
}else{
return PasswordStrengthTypeStrong;
}
}
// Validate the input string with the given pattern and
// return the result as a boolean
- (int)validateString:(NSString *)string withPattern:(NSString *)pattern caseSensitive:(BOOL)caseSensitive
{
NSError *error = nil;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern options:((caseSensitive) ? 0 : NSRegularExpressionCaseInsensitive) error:&error];
NSAssert(regex, @"Unable to create regular expression");
NSRange textRange = NSMakeRange(0, string.length);
NSRange matchRange = [regex rangeOfFirstMatchInString:string options:NSMatchingReportProgress range:textRange];
BOOL didValidate = 0;
// Did we find a matching range
if (matchRange.location != NSNotFound)
didValidate = 1;
return didValidate;
}
@end

View File

@ -0,0 +1,29 @@
# StrongestPasswordValidator
[![CI Status](http://img.shields.io/travis/Giuseppe Nucifora/StrongestPasswordValidator.svg?style=flat)](https://travis-ci.org/Giuseppe Nucifora/StrongestPasswordValidator)
[![Version](https://img.shields.io/cocoapods/v/StrongestPasswordValidator.svg?style=flat)](http://cocoapods.org/pods/StrongestPasswordValidator)
[![License](https://img.shields.io/cocoapods/l/StrongestPasswordValidator.svg?style=flat)](http://cocoapods.org/pods/StrongestPasswordValidator)
[![Platform](https://img.shields.io/cocoapods/p/StrongestPasswordValidator.svg?style=flat)](http://cocoapods.org/pods/StrongestPasswordValidator)
## Usage
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
## Installation
StrongestPasswordValidator is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod "StrongestPasswordValidator"
```
## Author
Giuseppe Nucifora, me@giuseppenucifora.com
## License
StrongestPasswordValidator is available under the MIT license. See the LICENSE file for more info.

View File

@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_CodFis_Helper : NSObject
@end
@implementation PodsDummy_CodFis_Helper
@end

View File

@ -0,0 +1,4 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif

View File

@ -0,0 +1,10 @@
#import <UIKit/UIKit.h>
#import "CodFis+Helper.h"
#import "CodFisResponse.h"
#import "ResponseConstants.h"
#import "VatNumber+Helper.h"
FOUNDATION_EXPORT double CodFis_HelperVersionNumber;
FOUNDATION_EXPORT const unsigned char CodFis_HelperVersionString[];

View File

@ -0,0 +1,6 @@
framework module CodFis_Helper {
umbrella header "CodFis-Helper-umbrella.h"
export *
module * { export * }
}

View File

@ -0,0 +1,5 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_NSString_Helper : NSObject
@end
@implementation PodsDummy_NSString_Helper
@end

View File

@ -0,0 +1,4 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif

View File

@ -0,0 +1,7 @@
#import <UIKit/UIKit.h>
#import "NSString+Helper.h"
FOUNDATION_EXPORT double NSString_HelperVersionNumber;
FOUNDATION_EXPORT const unsigned char NSString_HelperVersionString[];

View File

@ -0,0 +1,6 @@
framework module NSString_Helper {
umbrella header "NSString-Helper-umbrella.h"
export *
module * { export * }
}

View File

@ -0,0 +1,5 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -1,7 +1,15 @@
#import <UIKit/UIKit.h>
#import "PNObject+PNObjectConnection.h"
#import "PNObject+Protected.h"
#import "PNObject.h"
#import "PNObjectConfig.h"
#import "PNObjectConstants.h"
#import "PNObjectModel.h"
#import "PNObjectProperty.h"
#import "PNAddress.h"
#import "PNLocation.h"
#import "PNUser.h"
FOUNDATION_EXPORT double PNObjectVersionNumber;
FOUNDATION_EXPORT const unsigned char PNObjectVersionString[];

View File

@ -24,6 +24,29 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## CodFis-Helper
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## NSDate_Utils
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
@ -47,6 +70,29 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## NSString-Helper
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## PEAR-FileManager-iOS
Copyright (c) <2015> Hiroki Umatani PEAR
@ -94,6 +140,29 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## StrongestPasswordValidator
Copyright (c) 2016 Giuseppe Nucifora <me@giuseppenucifora.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## UIDevice-Utils
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
@ -116,4 +185,210 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## nv-ios-http-status
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Generated by CocoaPods - https://cocoapods.org

View File

@ -53,6 +53,33 @@ furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</string>
<key>Title</key>
<string>CodFis-Helper</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015 Giuseppe Nucifora &lt;me@giuseppenucifora.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -66,6 +93,33 @@ THE SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015 Giuseppe Nucifora &lt;me@giuseppenucifora.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</string>
<key>Title</key>
<string>NSString-Helper</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) &lt;2015&gt; Hiroki Umatani PEAR
@ -121,6 +175,33 @@ THE SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2016 Giuseppe Nucifora &lt;me@giuseppenucifora.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</string>
<key>Title</key>
<string>StrongestPasswordValidator</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015 Giuseppe Nucifora &lt;me@giuseppenucifora.com&gt;
@ -148,6 +229,216 @@ THE SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</string>
<key>Title</key>
<string>nv-ios-http-status</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - https://cocoapods.org</string>

View File

@ -85,15 +85,23 @@ strip_invalid_archs() {
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "Pods-PNObject_Example/AFNetworking.framework"
install_framework "Pods-PNObject_Example/CodFis_Helper.framework"
install_framework "Pods-PNObject_Example/NSDate_Utils.framework"
install_framework "Pods-PNObject_Example/NSString_Helper.framework"
install_framework "Pods-PNObject_Example/PEAR_FileManager_iOS.framework"
install_framework "Pods-PNObject_Example/PNObject.framework"
install_framework "Pods-PNObject_Example/StrongestPasswordValidator.framework"
install_framework "Pods-PNObject_Example/UIDevice_Utils.framework"
install_framework "Pods-PNObject_Example/nv_ios_http_status.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "Pods-PNObject_Example/AFNetworking.framework"
install_framework "Pods-PNObject_Example/CodFis_Helper.framework"
install_framework "Pods-PNObject_Example/NSDate_Utils.framework"
install_framework "Pods-PNObject_Example/NSString_Helper.framework"
install_framework "Pods-PNObject_Example/PEAR_FileManager_iOS.framework"
install_framework "Pods-PNObject_Example/PNObject.framework"
install_framework "Pods-PNObject_Example/StrongestPasswordValidator.framework"
install_framework "Pods-PNObject_Example/UIDevice_Utils.framework"
install_framework "Pods-PNObject_Example/nv_ios_http_status.framework"
fi

View File

@ -1,6 +1,6 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice_Utils.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "NSDate_Utils" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "UIDevice_Utils"
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv_ios_http_status.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "CodFis_Helper" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNObject_Example
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,6 +1,6 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice_Utils.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "NSDate_Utils" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "UIDevice_Utils"
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv_ios_http_status.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "CodFis_Helper" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNObject_Example
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,6 +1,122 @@
# Acknowledgements
This application makes use of the following third party libraries:
## AFNetworking
Copyright (c) 20112015 Alamofire Software Foundation (http://alamofire.org/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## CodFis-Helper
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## NSDate_Utils
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## NSString-Helper
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## PEAR-FileManager-iOS
Copyright (c) <2015> Hiroki Umatani PEAR
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## PNObject
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
@ -24,6 +140,235 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## UIDevice-Utils
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## nv-ios-http-status
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
## Expecta
Copyright (c) 2011-2015 Specta Team - https://github.com/specta

View File

@ -12,6 +12,142 @@
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2011&#8211;2015 Alamofire Software Foundation (http://alamofire.org/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</string>
<key>Title</key>
<string>AFNetworking</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015 Giuseppe Nucifora &lt;me@giuseppenucifora.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</string>
<key>Title</key>
<string>CodFis-Helper</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015 Giuseppe Nucifora &lt;me@giuseppenucifora.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</string>
<key>Title</key>
<string>NSDate_Utils</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015 Giuseppe Nucifora &lt;me@giuseppenucifora.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</string>
<key>Title</key>
<string>NSString-Helper</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) &lt;2015&gt; Hiroki Umatani PEAR
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</string>
<key>Title</key>
<string>PEAR-FileManager-iOS</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015 Giuseppe Nucifora &lt;me@giuseppenucifora.com&gt;
@ -39,6 +175,243 @@ THE SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015 Giuseppe Nucifora &lt;me@giuseppenucifora.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</string>
<key>Title</key>
<string>UIDevice-Utils</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</string>
<key>Title</key>
<string>nv-ios-http-status</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2011-2015 Specta Team - https://github.com/specta

View File

@ -84,14 +84,28 @@ strip_invalid_archs() {
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "Pods-PNObject_Tests/AFNetworking.framework"
install_framework "Pods-PNObject_Tests/CodFis_Helper.framework"
install_framework "Pods-PNObject_Tests/NSDate_Utils.framework"
install_framework "Pods-PNObject_Tests/NSString_Helper.framework"
install_framework "Pods-PNObject_Tests/PEAR_FileManager_iOS.framework"
install_framework "Pods-PNObject_Tests/PNObject.framework"
install_framework "Pods-PNObject_Tests/UIDevice_Utils.framework"
install_framework "Pods-PNObject_Tests/nv_ios_http_status.framework"
install_framework "Pods-PNObject_Tests/Expecta.framework"
install_framework "Pods-PNObject_Tests/Expecta_Snapshots.framework"
install_framework "Pods-PNObject_Tests/FBSnapshotTestCase.framework"
install_framework "Pods-PNObject_Tests/Specta.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "Pods-PNObject_Tests/AFNetworking.framework"
install_framework "Pods-PNObject_Tests/CodFis_Helper.framework"
install_framework "Pods-PNObject_Tests/NSDate_Utils.framework"
install_framework "Pods-PNObject_Tests/NSString_Helper.framework"
install_framework "Pods-PNObject_Tests/PEAR_FileManager_iOS.framework"
install_framework "Pods-PNObject_Tests/PNObject.framework"
install_framework "Pods-PNObject_Tests/UIDevice_Utils.framework"
install_framework "Pods-PNObject_Tests/nv_ios_http_status.framework"
install_framework "Pods-PNObject_Tests/Expecta.framework"
install_framework "Pods-PNObject_Tests/Expecta_Snapshots.framework"
install_framework "Pods-PNObject_Tests/FBSnapshotTestCase.framework"

View File

@ -1,8 +1,8 @@
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "PNObject" -framework "Specta"
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv_ios_http_status.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "CodFis_Helper" -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "Specta" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNObject_Tests
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,8 +1,8 @@
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "PNObject" -framework "Specta"
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv_ios_http_status.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "CodFis_Helper" -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "Specta" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PNObject_Tests
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_StrongestPasswordValidator : NSObject
@end
@implementation PodsDummy_StrongestPasswordValidator
@end

View File

@ -0,0 +1,4 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif

View File

@ -0,0 +1,7 @@
#import <UIKit/UIKit.h>
#import "StrongestPasswordValidator.h"
FOUNDATION_EXPORT double StrongestPasswordValidatorVersionNumber;
FOUNDATION_EXPORT const unsigned char StrongestPasswordValidatorVersionString[];

View File

@ -0,0 +1,6 @@
framework module StrongestPasswordValidator {
umbrella header "StrongestPasswordValidator-umbrella.h"
export *
module * { export * }
}

View File

@ -0,0 +1,6 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
OTHER_LDFLAGS = -framework "UIKit"
PODS_ROOT = ${SRCROOT}
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.2</string>
<string>0.1.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -13,7 +13,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.2</string>
<string>0.1.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_nv_ios_http_status : NSObject
@end
@implementation PodsDummy_nv_ios_http_status
@end

View File

@ -0,0 +1,4 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif

View File

@ -0,0 +1,8 @@
#import <UIKit/UIKit.h>
#import "HTTPStatusCodes.h"
#import "nv_ios_http_status.h"
FOUNDATION_EXPORT double nv_ios_http_statusVersionNumber;
FOUNDATION_EXPORT const unsigned char nv_ios_http_statusVersionString[];

View File

@ -0,0 +1,6 @@
framework module nv_ios_http_status {
umbrella header "nv-ios-http-status-umbrella.h"
export *
module * { export * }
}

View File

@ -0,0 +1,5 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -73,6 +73,13 @@ typedef NS_ENUM(NSUInteger, UIDeviceModelInches) {
UIDeviceModelInches79,
UIDeviceModelInches97,
UIDeviceModelInches129,
UIDeviceSimulatorModelInches35 = UIDeviceModelInches35,
UIDeviceSimulatorModelInches4 = UIDeviceModelInches4,
UIDeviceSimulatorModelInches47 = UIDeviceModelInches47,
UIDeviceSimulatorModelInches55 = UIDeviceModelInches55,
UIDeviceSimulatorModelInches79 = UIDeviceModelInches79,
UIDeviceSimulatorModelInches97 = UIDeviceModelInches97,
UIDeviceSimulatorModelInches129 = UIDeviceModelInches129,
UIDeviceModelInchesUnKnown
};

View File

@ -171,6 +171,8 @@
if ([modelIdentifier isEqualToString:@"iPad4,2"]) return UIDeviceGenerationModeliPadAir;
if ([modelIdentifier isEqualToString:@"iPad5,3"]) return UIDeviceGenerationModeliPadAir2;
if ([modelIdentifier isEqualToString:@"iPad5,4"]) return UIDeviceGenerationModeliPadAir2;
if ([modelIdentifier isEqualToString:@"iPad6,7"]) return UIDeviceGenerationModeliPadPro;
if ([modelIdentifier isEqualToString:@"iPad6,8"]) return UIDeviceGenerationModeliPadPro;
// iPad Mini http://theiphonewiki.com/wiki/IPad_mini
@ -203,8 +205,14 @@
if ([modelIdentifier hasSuffix:@"86"] || [modelIdentifier isEqual:@"x86_64"])
{
BOOL smallerScreen = ([[UIScreen mainScreen] bounds].size.width < 768.0);
return (smallerScreen ? UIDeviceGenerationModeliPhoneSimulator : UIDeviceGenerationModeliPadSimulator);
BOOL iPhoneScreen = ([[UIScreen mainScreen] bounds].size.width < 768.0);
BOOL iPadScreen = !iPhoneScreen;
if (iPadScreen) {
return UIDeviceGenerationModeliPadSimulator;
}
else {
return UIDeviceGenerationModeliPhoneSimulator;
}
}
return UIDeviceGenerationModelUnknown;
}
@ -250,6 +258,9 @@
if ([modelIdentifier isEqualToString:@"iPad5,3"]) return @"iPad Air 2 (Wi-Fi)";
if ([modelIdentifier isEqualToString:@"iPad5,4"]) return @"iPad Air 2 (Cellular)";
if ([modelIdentifier isEqualToString:@"iPad6,7"]) return @"iPad Pro (Wi-Fi)";
if ([modelIdentifier isEqualToString:@"iPad6,8"]) return @"iPad Pro (Cellular)";
// iPad Mini http://theiphonewiki.com/wiki/IPad_mini
if ([modelIdentifier isEqualToString:@"iPad2,5"]) return @"iPad mini 1G (Wi-Fi)";
@ -320,23 +331,62 @@
case UIDeviceGenerationModeliPad4:
case UIDeviceGenerationModeliPadAir:
case UIDeviceGenerationModeliPadAir2:{
return UIDeviceModelInches97;
}
break;
case UIDeviceGenerationModeliPadMini1:
case UIDeviceGenerationModeliPadMini2:
case UIDeviceGenerationModeliPadMini3:
case UIDeviceGenerationModeliPadMini4:
{
case UIDeviceGenerationModeliPadMini4:{
return UIDeviceModelInches79;
}
break;
case UIDeviceGenerationModeliPadPro:{
return UIDeviceModelInches129;
}
default:
break;
}
case UIDeviceGenerationModeliPadSimulator:
case UIDeviceGenerationModeliPhoneSimulator:{
CGRect screenRect = [[UIScreen mainScreen] bounds];
NSInteger screenHeight = ((NSInteger)screenRect.size.height > (NSInteger)screenRect.size.width) ? (NSInteger)screenRect.size.height : (NSInteger)screenRect.size.width;
switch (screenHeight) {
case 480:{
return UIDeviceSimulatorModelInches35;
}
break;
case 568:{
return UIDeviceSimulatorModelInches4;
break;
}
case 667:{
return UIDeviceSimulatorModelInches47;
break;
}
case 736:{
return UIDeviceSimulatorModelInches55;
break;
}
case 1024:{
return UIDeviceModelInches97;
break;
}
case 1366:{
return UIDeviceSimulatorModelInches129;
break;
}
default:{
return UIDeviceModelInchesUnKnown;
break;
}
}
break;
}
default: {
return UIDeviceModelInchesUnKnown;
break;
}
}
return UIDeviceModelInchesUnKnown;
}

View File

@ -17,10 +17,6 @@ UIDevice-Utils is available through [CocoaPods](http://cocoapods.org). To instal
it, simply add the following line to your Podfile:
```ruby
pod "UIDevice-Utils" , :git => 'https://github.com/giuseppenucifora/UIDevice-Utils.git'
or
pod "UIDevice-Utils"
```

202
Example/Pods/nv-ios-http-status/LICENSE generated Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,57 @@
nv-ios-http-status
==================
Overview
--------
This project provides a header file that lists HTTP status codes,
mainly for iOS programming. A typedef enum, HTTPStatusCode, contains
entries whose name start with kHTTPStatusCode such as kHTTPStatusCodeOK.
The initial version of the list of HTTP status codes (HTTPStatusCodes.h)
was written based on the list at Wikipedia ([List of HTTP status codes]
(http://en.wikipedia.org/wiki/List_of_HTTP_status_codes)) on April 20,
2013.
Note that unofficial HTTP status codes are included and some of
such variants can be excluded by defining HTTP_STATUS_CODES_EXLUCE_xxx.
License
-------
Apache License, Version 2.0
Download
--------
git clone https://github.com/TakahikoKawasaki/nv-ios-http-status.git
Example
-------
#import "HTTPStatusCodes.h"
......
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
NSHTTPURLResponse *res = (NSHTTPURLResponse *)response;
switch ([res statusCode])
{
case kHTTPStatusCodeOK:
......;
}
......
}
Author
------
Takahiko Kawasaki, Neo Visionaries Inc.

View File

@ -0,0 +1,582 @@
/*
* Copyright (C) 2013 Neo Visionaries Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef HTTPStatusCodes_h
#define HTTPStatusCodes_h
//----------------------------------------------------------------------
// Typedef
//----------------------------------------------------------------------
/**
* HTTP status codes.
*
* The list here is based on the description at Wikipedia.
* The initial version of this list was written on April 20, 2013.
*
* @see <a href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes"
* >List of HTTP status codes</a>
*/
typedef enum
{
/*--------------------------------------------------
* 1xx Informational
*------------------------------------------------*/
/**
* 100 Continue.
*/
kHTTPStatusCodeContinue = 100,
/**
* 101 Switching Protocols.
*/
kHTTPStatusCodeSwitchingProtocols = 101,
#if !defined(HTTP_STATUS_CODES_EXCLUDE_WEBDAV) && !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_2518)
/**
* 103 Processing (WebDAV; RFC 2518).
*/
kHTTPStatusCodeProcessing = 102,
#endif
/*--------------------------------------------------
* 2xx Success
*------------------------------------------------*/
/**
* 200 OK.
*/
kHTTPStatusCodeOK = 200,
/**
* 201 Created.
*/
kHTTPStatusCodeCreated = 201,
/**
* 202 Accepted.
*/
kHTTPStatusCodeAccepted = 202,
/**
* 203 Non-Authoritative Information (since HTTP/1.1).
*/
kHTTPStatusCodeNonAuthoritativeInformation = 203,
/**
* 204 No Content.
*/
kHTTPStatusCodeNoContent = 204,
/**
* 205 Reset Content.
*/
kHTTPStatusCodeResetContent = 205,
/**
* 206 Partial Content.
*/
kHTTPStatusCodePartialContent = 206,
#if !defined(HTTP_STATUS_CODES_EXCLUDE_WEBDAV) && !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_4918)
/**
* 207 Multi-Status (WebDAV; RFC 4918).
*/
kHTTPStatusCodeMultiStatus = 207,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_WEBDAV) && !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_5842)
/**
* 208 Already Reported (WebDAV; RFC 5842).
*/
kHTTPStatusCodeAlreadyReported = 208,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_3229)
/**
* 226 IM Used (RFC 3229)
*/
kHTTPStatusCodeIMUsed = 226,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP) && !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_2326)
/**
* 250 Low on Storage Space (RTSP; RFC 2326).
*/
kHTTPStatusCodeLowOnStorageSpace = 250,
#endif
/*--------------------------------------------------
* 3xx Redirection
*------------------------------------------------*/
/**
* 300 Multiple Choices.
*/
kHTTPStatusCodeMultipleChoices = 300,
/**
* 301 Moved Permanently.
*/
kHTTPStatusCodeMovedPermanently = 301,
/**
* 302 Found.
*/
kHTTPStatusCodeFound = 302,
/**
* 303 See Other (since HTTP/1.1).
*/
kHTTPStatusCodeSeeOther = 303,
/**
* 304 Not Modified.
*/
kHTTPStatusCodeNotModified = 304,
/**
* 305 Use Proxy (since HTTP/1.1).
*/
kHTTPStatusCodeUseProxy = 305,
/**
* 306 Switch Proxy.
*/
kHTTPStatusCodeSwitchProxy = 306,
/**
* 307 Temporary Redirect (since HTTP/1.1).
*/
kHTTPStatusCodeTemporaryRedirect = 307,
/**
* 308 Permanent Redirect (approved as experimental RFC).
*/
kHTTPStatusCodePermanentRedirect = 308,
/*--------------------------------------------------
* 4xx Client Error
*------------------------------------------------*/
/**
* 400 Bad Request.
*/
kHTTPStatusCodeBadRequest = 400,
/**
* 401 Unauthorized.
*/
kHTTPStatusCodeUnauthorized = 401,
/**
* 402 Payment Required.
*/
kHTTPStatusCodePaymentRequired = 402,
/**
* 403 Forbidden.
*/
kHTTPStatusCodeForbidden = 403,
/**
* 404 Not Found.
*/
kHTTPStatusCodeNotFound = 404,
/**
* 405 Method Not Allowed.
*/
kHTTPStatusCodeMethodNotAllowed = 405,
/**
* 406 Not Acceptable.
*/
kHTTPStatusCodeNotAcceptable = 406,
/**
* 407 Proxy Authentication Required.
*/
kHTTPStatusCodeProxyAuthenticationRequired = 407,
/**
* 408 Request Timeout.
*/
kHTTPStatusCodeRequestTimeout = 408,
/**
* 409 Conflict.
*/
kHTTPStatusCodeConflict = 409,
/**
* 410 Gone.
*/
kHTTPStatusCodeGone = 410,
/**
* 411 Length Required.
*/
kHTTPStatusCodeLengthRequired = 411,
/**
* 412 Precondition Failed.
*/
kHTTPStatusCodePreconditionFailed = 412,
/**
* 413 Request Entity Too Large.
*/
kHTTPStatusCodeRequestEntityTooLarge = 413,
/**
* 414 Request-URI Too Long.
*/
kHTTPStatusCodeRequestURITooLong = 414,
/**
* 415 Unsupported Media Type.
*/
kHTTPStatusCodeUnsupportedMediaType = 415,
/**
* 416 Requested Range Not Satisfiable.
*/
kHTTPStatusCodeRequestedRangeNotSatisfiable = 416,
/**
* 417 Expectation Failed.
*/
kHTTPStatusCodeExpectationFailed = 417,
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_2324)
/**
* 418 I'm a teapot (RFC 2324).
*/
kHTTPStatusCodeImATeapot = 418,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_TWITTER)
/**
* 420 Enhance Your Calm (Twitter).
*/
kHTTPStatusCodeEnhanceYourCalm = 420,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_WEBDAV) && !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_4918)
/**
* 422 Unprocessable Entity (WebDAV; RFC 4918).
*/
kHTTPStatusCodeUnprocessableEntity = 422,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_WEBDAV) && !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_4918)
/**
* 423 Locked (WebDAV; RFC 4918).
*/
kHTTPStatusCodeLocked = 423,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_WEBDAV) && !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_4918)
/**
* 424 Failed Dependency (WebDAV; RFC 4918).
*/
kHTTPStatusCodeFailedDependency = 424,
#endif
/**
* 425 Unordered Collection (Internet draft).
*/
kHTTPStatusCodeUnorderedCollection = 425,
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_2817)
/**
* 426 Upgrade Required (RFC 2817).
*/
kHTTPStatusCodeUpgradeRequired = 426,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_6585)
/**
* 428 Precondition Required (RFC 6585).
*/
kHTTPStatusCodePreconditionRequired = 428,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_6585)
/**
* 429 Too Many Requests (RFC 6585).
*/
kHTTPStatusCodeTooManyRequests = 429,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_6585)
/**
* 431 Request Header Fields Too Large (RFC 6585).
*/
kHTTPStatusCodeRequestHeaderFieldsTooLarge = 431,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_NGINX)
/**
* 444 No Response (Nginx).
*/
kHTTPStatusCodeNoResponse = 444,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_MICROSOFT)
/**
* 449 Retry With (Microsoft).
*/
kHTTPStatusCodeRetryWith = 449,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_MICROSOFT)
/**
* 450 Blocked by Windows Parental Controls (Microsoft).
*/
kHTTPStatusCodeBlockedByWindowsParentalControls = 450,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 451 Parameter Not Understood (RTSP).
*/
kHTTPStatusCodeParameterNotUnderstood = 451,
#endif
/**
* 451 Unavailable For Legal Reasons (Internet draft).
*/
kHTTPStatusCodeUnavailableForLegalReasons = 451,
#if !defined(HTTP_STATUS_CODES_EXCLUDE_MICROSOFT)
/**
* 451 Redirect (Microsoft).
*/
kHTTPStatusCodeRedirect = 451,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 452 Conference Not Found (RTSP).
*/
kHTTPStatusCodeConferenceNotFound = 452,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 453 Not Enough Bandwidth (RTSP).
*/
kHTTPStatusCodeNotEnoughBandwidth = 453,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 454 Session Not Found (RTSP).
*/
kHTTPStatusCodeSessionNotFound = 454,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 455 Method Not Valid in This State (RTSP).
*/
kHTTPStatusCodeMethodNotValidInThisState = 455,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 456 Header Field Not Valid for Resource (RTSP).
*/
kHTTPStatusCodeHeaderFieldNotValidForResource = 456,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 457 Invalid Range (RTSP).
*/
kHTTPStatusCodeInvalidRange = 457,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 458 Parameter Is Read-Only (RTSP).
*/
kHTTPStatusCodeParameterIsReadOnly = 458,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 459 Aggregate Operation Not Allowed (RTSP).
*/
kHTTPStatusCodeAggregateOperationNotAllowed = 459,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 460 Only Aggregate Operation Allowed (RTSP).
*/
kHTTPStatusCodeOnlyAggregateOperationAllowed = 460,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 461 Unsupported Transport (RTSP).
*/
kHTTPStatusCodeUnsupportedTransport = 461,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 462 Destination Unreachable (RTSP).
*/
kHTTPStatusCodeDestinationUnreachable = 462,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_NGINX)
/**
* 494 Request Header Too Large (Nginx).
*/
kHTTPStatusCodeRequestHeaderTooLarge = 494,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_NGINX)
/**
* 495 Cert Error (Nginx).
*/
kHTTPStatusCodeCertError = 495,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_NGINX)
/**
* 496 No Cert (Nginx).
*/
kHTTPStatusCodeNoCert = 496,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_NGINX)
/**
* 497 HTTP to HTTPS (Nginx).
*/
kHTTPStatusCodeHTTPToHTTPS = 497,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_NGINX)
/**
* 499 Client Closed Request (Nginx).
*/
kHTTPStatusCodeClientClosedRequest = 499,
#endif
/*--------------------------------------------------
* 5xx Server Error
*------------------------------------------------*/
/**
* 500 Internal Server Error.
*/
kHTTPStatusCodeInternalServerError = 500,
/**
* 501 Not Implemented
*/
kHTTPStatusCodeNotImplemented = 501,
/**
* 502 Bad Gateway.
*/
kHTTPStatusCodeBadGateway = 502,
/**
* 503 Service Unavailable.
*/
kHTTPStatusCodeServiceUnavailable = 503,
/**
* 504 Gateway Timeout.
*/
kHTTPStatusCodeGatewayTimeout = 504,
/**
* 505 HTTP Version Not Supported.
*/
kHTTPStatusCodeHTTPVersionNotSupported = 505,
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_2295)
/**
* 506 Variant Also Negotiates (RFC 2295).
*/
kHTTPStatusCodeVariantAlsoNegotiates = 506,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_WEBDAV) && !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_4918)
/**
* 507 Insufficient Storage (WebDAV; RFC 4918).
*/
kHTTPStatusCodeInsufficientStorage = 507,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_WEBDAV) && !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_5842)
/**
* 508 Loop Detected (WebDAV; RFC 5842).
*/
kHTTPStatusCodeLoopDetected = 508,
#endif
/**
* 509 Bandwidth Limit Exceeded (Apache bw/limited extension).
*/
kHTTPStatusCodeBandwidthLimitExceeded = 509,
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_2774)
/**
* 510 Not Extended (RFC 2774).
*/
kHTTPStatusCodeNotExtended = 510,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RFC_6585)
/**
* 511 Network Authentication Required (RFC 6585).
*/
kHTTPStatusCodeNetworkAuthenticationRequired = 511,
#endif
#if !defined(HTTP_STATUS_CODES_EXCLUDE_RTSP)
/**
* 551 Option not supported (RTSP).
*/
kHTTPStatusCodeOptionNotSupported = 551,
#endif
/**
* 598 Network read timeout error (Unknown).
*/
kHTTPStatusCodeNetworkReadTimeoutError = 598,
/**
* 599 Network connect timeout error (Unknown).
*/
kHTTPStatusCodeNetworkConnectTimeoutError = 599
}
HTTPStatusCode;
#endif

View File

@ -0,0 +1,22 @@
/*
* Copyright (C) 2013 Neo Visionaries Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <Foundation/Foundation.h>
@interface nv_ios_http_status : NSObject
@end

View File

@ -0,0 +1,22 @@
/*
* Copyright (C) 2013 Neo Visionaries Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import "nv_ios_http_status.h"
@implementation nv_ios_http_status
@end

View File

@ -7,9 +7,9 @@
#
Pod::Spec.new do |s|
s.name = "PNObject"
s.version = "0.1.0"
s.summary = "A short description of PNObject."
s.name = "PNObject"
s.version = "0.2.0"
s.summary = "PNObject is a simple replica of the more complex ParseObject"
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
@ -18,22 +18,29 @@ Pod::Spec.new do |s|
# * Finally, don't worry about the indent, CocoaPods strips it!
# s.description = <<-DESC DESC
s.homepage = "https://github.com/giuseppenucifora/PNObject"
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT'
s.author = { "Giuseppe Nucifora" => "me@giuseppenucifora.com" }
s.source = { :git => "https://github.com/giuseppenucifora/PNObject.git", :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.homepage = "https://github.com/giuseppenucifora/PNObject"
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT'
s.author = { "Giuseppe Nucifora" => "me@giuseppenucifora.com" }
s.source = { :git => "https://github.com/giuseppenucifora/PNObject.git", :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.platform = :ios, '7.0'
s.requires_arc = true
s.platform = :ios, '7.0'
s.requires_arc = true
s.source_files = 'Pod/Classes/**/*'
s.resource_bundles = {
'PNObject' => ['Pod/Assets/*.png']
}
s.source_files = 'Pod/Classes/**/*'
s.resource_bundles = {
'PNObject' => ['Pod/Assets/*.png']
}
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
s.dependency 'AFNetworking'
s.dependency 'PEAR-FileManager-iOS'
s.dependency 'NSDate_Utils'
s.dependency 'UIDevice-Utils'
s.dependency 'nv-ios-http-status'
s.dependency 'NSString-Helper'
s.dependency 'CodFis-Helper'
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end

View File

@ -0,0 +1,17 @@
//
// PNObjectConnection.h
// Pods
//
// Created by Giuseppe Nucifora on 18/01/16.
//
//
#import "PNObject.h"
@interface PNObject (PNObjectConnection)
- (NSURLSessionDataTask * _Nonnull)GETWithProgress:(void (^ _Nullable)(NSProgress * _Nonnull))downloadProgress
success:(void (^ _Nullable)(NSURLSessionDataTask * _Nonnull, id _Nullable))success
failure:(void (^ _Nullable)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure;
@end

View File

@ -0,0 +1,97 @@
//
// PNObjectConnection.m
// Pods
//
// Created by Giuseppe Nucifora on 18/01/16.
//
//
#import "PNObject+PNObjectConnection.h"
#import "PNObjectConstants.h"
#import <NSDate_Utils/NSDate+NSDate_Util.h>
#import "PNObjectConfig.h"
#import "PNObjectModel.h"
#import <AFNetworking/AFNetworking.h>
#import "PNObject+Protected.h"
@implementation PNObject (PNObjectConnection)
- (NSURLSessionDataTask * _Nonnull)GETWithProgress:(void (^ _Nullable)(NSProgress * _Nonnull))downloadProgress
success:(void (^ _Nullable)(NSURLSessionDataTask * _Nonnull, id _Nullable))success
failure:(void (^ _Nullable)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure {
return [[[PNObjectConfig sharedInstance] manager] GET:[[[PNObjectConfig sharedInstance] PNObjEndpoint] stringByAppendingFormat:@"%@",[[self class] objectClassName]] parameters:nil progress:nil success:^(NSURLSessionTask *task, id responseObject) {
NSLogDebug(@"JSON: %@", responseObject);
NSLogDebug(@"JSON: %@", [responseObject class]);
self.JSON = [[NSDictionary alloc] initWithDictionary:responseObject];
[self populateObjectFromJSON:responseObject];
} failure:^(NSURLSessionTask *operation, NSError *error) {
NSLogDebug(@"Error: %@", error);
}];
}
- (NSURLSessionDataTask *)POSTWithProgress:(nullable void (^)(NSProgress * _Nonnull)) uploadProgress
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure {
return [[[PNObjectConfig sharedInstance] manager] POST:[[[PNObjectConfig sharedInstance] PNObjEndpoint] stringByAppendingFormat:@"%@",[[self class] objectClassName]]
parameters:[self getJSONObject] constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
} progress:^(NSProgress * _Nonnull _uploadProgress) {
if (uploadProgress) {
uploadProgress(_uploadProgress);
}
} success:^(NSURLSessionDataTask * _Nonnull _task, id _Nullable _responseObject) {
if (success) {
success(_task,_responseObject);
}
} failure:^(NSURLSessionDataTask * _Nullable _task, NSError * _Nonnull _error) {
if (failure) {
failure(_task,_error);
}
}];
}
- (NSURLSessionDataTask *)PUTWithSuccess:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure {
return [[[PNObjectConfig sharedInstance] manager] PUT:[[[PNObjectConfig sharedInstance] PNObjEndpoint] stringByAppendingFormat:@"%@",[[self class] objectClassName]]
parameters:[self getJSONObject]
success:^(NSURLSessionDataTask * _Nonnull _task, id _Nullable _responseObject) {
if (success) {
success(_task,_responseObject);
}
} failure:^(NSURLSessionDataTask * _Nullable _task, NSError * _Nonnull _error) {
if (failure) {
failure(_task,_error);
}
}];
}
- (NSURLSessionDataTask *)DELETEWithSuccess:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure {
return [[[PNObjectConfig sharedInstance] manager] DELETE:[[[PNObjectConfig sharedInstance] PNObjEndpoint] stringByAppendingFormat:@"%@",[[self class] objectClassName]]
parameters:[self getJSONObject]
success:^(NSURLSessionDataTask * _Nonnull _task, id _Nullable _responseObject) {
if (success) {
success(_task,_responseObject);
}
} failure:^(NSURLSessionDataTask * _Nullable _task, NSError * _Nonnull _error) {
if (failure) {
failure(_task,_error);
}
}];
}
@end

View File

@ -0,0 +1,30 @@
//
// PNObject+Protected.h
// Pods
//
// Created by Giuseppe Nucifora on 25/01/16.
//
//
#import <PNObject/PNObject.h>
#import <objc/runtime.h>
@interface PNObject (Protected)
@property (nonatomic, strong) PNObjectModel * _Nonnull objectModel;
@property (nonatomic, strong) NSDictionary * _Nonnull JSON;
@property (nonatomic, strong) NSString * _Nonnull endPoint;
@property (nonatomic) BOOL singleInstance;
- (void)populateObjectFromJSON:(id _Nullable)JSON;
- (BOOL)isStringNull:(NSString * _Nullable)str;
- (BOOL)isObjNull:(id _Nullable)obj;
+ (NSArray * _Nonnull) protectedProperties;
@end

View File

@ -0,0 +1,147 @@
//
// PNObject+Protected.m
// Pods
//
// Created by Giuseppe Nucifora on 25/01/16.
//
//
#import "PNObject+Protected.h"
#import <PNObjectProperty.h>
#import "PNObjectConstants.h"
#import <NSDate_Utils/NSDate+NSDate_Util.h>
@implementation PNObject (Protected)
@dynamic endPoint;
@dynamic objectModel;
@dynamic JSON;
@dynamic singleInstance;
+ (PNObjectModel* _Nonnull) objectModel {
}
+ (NSArray * _Nonnull) protectedProperties {
return @[@"JSON",@"subClassDelegate",@"objectModel",@"objectMapping",@"singleInstance"];
}
- (void)populateObjectFromJSON:(id _Nullable)JSON
{
NSDictionary *properties = [PNObjectProperty propertiesForClass:self.class];
for(NSString *propertyName in properties) {
if([propertyName isEqualToString:@"mappingError"])
continue;
NSString *mappedJSONKey;
NSString *mappedJSONType;
NSString *propertyType = [properties valueForKey:propertyName];
id mappingValue = [self.objectMapping valueForKey:propertyName];
if([mappingValue isKindOfClass:NSDictionary.class]) {
mappedJSONKey = [mappingValue valueForKey:@"key"];
mappedJSONType = [mappingValue valueForKey:@"type"];
} else {
mappedJSONKey = mappingValue;
}
if ([[PNObject protectedProperties] containsObject:propertyName]) {
continue;
}
// Get JSON value for the mapped key
id value = [JSON valueForKeyPath:propertyName];
((void (^)())@{
@"c" : ^{
char val = [value charValue];
[self setValue:@(val) forKey:propertyName];
},
@"d" : ^{
double val = [value doubleValue];
[self setValue:@(val) forKey:propertyName];
},
@"f" : ^{
float val = [value floatValue];
[self setValue:@(val) forKey:propertyName];
},
@"i" : ^{
int val = [value intValue];
[self setValue:@(val) forKey:propertyName];
},
@"l" : ^{
long val = [value longValue];
[self setValue:@(val) forKey:propertyName];
},
@"s" : ^{
short val = [value shortValue];
[self setValue:@(val) forKey:propertyName];
},
@"B" : ^{
BOOL val = [value boolValue];
[self setValue:@(val) forKey:propertyName];
},
@"NSString" : ^{
if (![self isObjNull:value]) {
[self setValue:value forKey:propertyName];
}
},
@"NSNumber" : ^{
NSInteger val = [value integerValue];
[self setValue:@(val) forKey:propertyName];
},
@"NSDate" : ^{
NSString *str = [NSString stringWithFormat:@"%@", value];
NSDate *val = [[NSDate dateFromString:str withFormat:kNSDateHelperFormatSQLDateWithTime] toLocalTime];
if (![self isObjNull:val]) {
[self setValue:val forKey:propertyName];
}
},
@"NSArray" : ^{
NSMutableArray *arr = [NSMutableArray array];
for(id JSONObject in value) {
PNObject *val = [[NSClassFromString(mappedJSONType) alloc] initWithJSON:JSONObject];
[arr addObject:val];
}
[self setValue:arr forKey:propertyName];
},
@"NSMutableArray" : ^{
NSMutableArray *arr = [NSMutableArray array];
for(id JSONObject in value) {
PNObject *val = [[NSClassFromString(mappedJSONType) alloc] initWithJSON:JSONObject];
[arr addObject:val];
}
[self setValue:arr forKey:propertyName];
}
}[propertyType] ?: ^{
BOOL isPNObjectSubclass = [NSClassFromString(propertyType) isSubclassOfClass:[PNObject class]];
if(isPNObjectSubclass) {
PNObject *val = [[NSClassFromString(propertyType) alloc] initWithJSON:value];
[self setValue:val forKey:propertyName];
}
else {
NSString *errorStr = [NSString stringWithFormat:@"Property '%@' could not be assigned any value.", propertyName];
NSLogDebug(@"%@",errorStr);
}
})();
}
}
- (BOOL)isObjNull:(id _Nullable)obj
{
if(!obj || nil == obj || NSNull.null == obj || ([obj isKindOfClass:[NSString class]] && [obj isEqualToString:@"(null)"]) || [obj isEqual:[NSNull null]])
return YES;
else
return NO;
}
@end

View File

@ -7,17 +7,34 @@
//
#import <Foundation/Foundation.h>
#import "PNObjectSubclassing.h"
#import "PNObjectConfig.h"
#import "PNObjectModel.h"
@interface PNObject : NSObject <PNObjectSubclassing>
@property (nonatomic, strong) NSString *objID;
@property (nonatomic, strong) NSDate *createdDate;
@property (nonatomic, strong) NSDictionary *objectMapping;
@protocol PNObjectSubclassing <NSObject>
- (instancetype) initWithJSON:(NSDictionary*) JSON;
@required
+ (NSString * _Nonnull ) objectClassName;
+ (NSDictionary * _Nonnull) objcetMapping;
+ (BOOL) singleInstance;
@end
@interface PNObject : NSObject
@property (nonatomic, strong) NSString * _Nonnull objID;
@property (nonatomic, strong) NSDate * _Nonnull createdAt;
@property (nonatomic, strong, getter=getJSONObject) NSDictionary * _Nonnull objectMapping;
@property (nonatomic, assign) id<PNObjectSubclassing> _Nonnull subClassDelegate;
- (_Nullable instancetype) initWithJSON:( NSDictionary * _Nonnull) JSON;
- (id _Nonnull) saveLocally;
- (BOOL) autoRemoveLocally;
@end

View File

@ -10,55 +10,96 @@
#import <PNObjectProperty.h>
#import <NSDate_Utils/NSDate+NSDate_Util.h>
#import <AFNetworking/AFNetworking.h>
#import "PNObject/PNUser.h"
#import "PNObjectConstants.h"
#import "PNObject+Protected.h"
@interface PNObject()
#define PNOBJECT_DIR @"PNObjects"
@property (nonatomic, strong) NSDictionary *JSON;
@property (nonatomic, strong) NSString *endPoint;
@interface PNObject() <PNObjectPersistency>
@property (nonatomic, strong) PNObjectModel * _Nonnull objectModel;
@property (nonatomic, strong) NSMutableDictionary * _Nonnull JSON;
@property (nonatomic, strong) NSString * _Nonnull endPoint;
@property (nonatomic) BOOL singleInstance;
@end
@implementation PNObject
- (instancetype) init {
- (NSDictionary *) PNObjectMapping {
NSDictionary *mapping = @{@"objID":@"objID",
@"createdAt":@"created_at",
};
return mapping;
}
- (_Nullable instancetype) init {
self = [super init];
if (self) {
if ([[self class] isSubclassOfClass:[PNObject class]]) {
NSAssert([[self class] conformsToProtocol:@protocol(PNObjectSubclassing)], @"Subclass object must conform to PNObjectSubclassing");
_objID = [[NSProcessInfo processInfo] globallyUniqueString];
_objectModel = [PNObjectModel sharedInstance];
[_objectModel setPersistencyDelegate:self];
NSMutableDictionary * objectDict = [[NSMutableDictionary alloc] initWithDictionary:[[self class] objcetMapping]];
[objectDict addEntriesFromDictionary:[self PNObjectMapping]];
_objectMapping = objectDict;
NSAssert(_objectMapping, @"You must create objectMapping");
_singleInstance = [[self class] singleInstance];
_createdAt = [[NSDate date] toLocalTime];
}
}
return self;
}
- (instancetype) initWithJSON:(NSDictionary*) JSON {
self = [self init];
- (_Nullable instancetype) initWithJSON:( NSDictionary * _Nonnull) JSON {
self = [super init];
if (self) {
NSAssert(_objectMapping, @"You must create objectMapping");
_JSON = [[NSDictionary alloc] initWithDictionary:JSON];
if ([[self class] isSubclassOfClass:[PNObject class]]) {
NSAssert([[self class] conformsToProtocol:@protocol(PNObjectSubclassing)], @"Subclass object must conform to PNObjectSubclassing");
_objID = [[NSProcessInfo processInfo] globallyUniqueString];
_objectModel = [PNObjectModel sharedInstance];
[_objectModel setPersistencyDelegate:self];
NSMutableDictionary * objectDict = [[NSMutableDictionary alloc] initWithDictionary:[[self class] objcetMapping]];
[objectDict addEntriesFromDictionary:[self PNObjectMapping]];
_objectMapping = objectDict;
NSAssert(_objectMapping, @"You must create objectMapping");
_singleInstance = [[self class] singleInstance];
_createdAt = [[NSDate date] toLocalTime];
}
[self populateObjectFromJSON:JSON];
NSAssert(_objectMapping, @"You must create objectMapping");
_JSON = [[NSMutableDictionary alloc] initWithDictionary:JSON];
[self populateObjectFromJSON:_JSON];
}
return self;
}
- (BOOL)isStringNull:(NSString *)str
{
if(nil == str || NSNull.null == (id)str)
return YES;
else
return NO;
}
- (BOOL)isObjNull:(id)obj
{
if(nil == obj || NSNull.null == obj)
return YES;
else
return NO;
}
- (NSDictionary *)reverseMapping
- (NSDictionary * _Nonnull)reverseMapping
{
NSMutableDictionary *JSON = [NSMutableDictionary dictionary];
@ -81,27 +122,72 @@
id value = [self valueForKey:propertyName];
// NSDate
if([propertyType isEqualToString:@"NSDate"]) {
value = [NSDate stringFromDate:value];
}
// NSURL
else if([propertyType isEqualToString:@"NSURL"]) {
NSLog(@"PropertyName PropertyType Value: %@ - %@ - %@",propertyName,propertyType,value);
((void (^)())@{
@"c" : ^{
char val = [value charValue];
[JSON setValue:@(val) forKey:propertyName];
},
@"d" : ^{
double val = [value doubleValue];
[JSON setValue:@(val) forKey:propertyName];
},
@"f" : ^{
float val = [value floatValue];
[JSON setValue:@(val) forKey:propertyName];
},
@"i" : ^{
int val = [value intValue];
[JSON setValue:@(val) forKey:propertyName];
},
@"l" : ^{
long val = [value longValue];
[JSON setValue:@(val) forKey:propertyName];
},
@"s" : ^{
short val = [value shortValue];
[JSON setValue:@(val) forKey:propertyName];
},
@"B" : ^{
BOOL val = [value boolValue];
[JSON setValue:@(val) forKey:propertyName];
},
@"UIImage" : ^{
UIImage *image = [UIImage imageWithData:value];
[JSON setValue:image forKey:propertyName];
},
@"NSURL" : ^{
NSURL *url = value;
value = [url absoluteString];
}
// NSArray, NSMutableArray
else if([propertyType isEqualToString:@"NSArray"] ||
[propertyType isEqualToString:@"NSMutableArray"]) {
if (![self isObjNull:url]) {
[JSON setValue:[url absoluteString] forKey:propertyName];
}
},
@"NSString" : ^{
NSString *val = [NSString stringWithFormat:@"%@", value];
if (![self isObjNull:val]) {
[JSON setValue:val forKey:propertyName];
}
},
@"NSNumber" : ^{
NSInteger val = [value integerValue];
[JSON setValue:@(val) forKey:propertyName];
},
@"NSDate" : ^{
NSDate *val = [value toLocalTime];
if (![self isObjNull:val]) {
[JSON setValue:val forKey:propertyName];
}
},
@"NSArray" : ^{
NSMutableArray *arr = [NSMutableArray array];
for(id LLObject in value) {
SEL selector = NSSelectorFromString(@"reverseMapping");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:
[[PNObject class] instanceMethodSignatureForSelector:selector]];
for(id PNObject in value) {
SEL selector = NSSelectorFromString(@"getJSONObject");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature: [[PNObject class] instanceMethodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:LLObject];
[invocation setTarget:PNObject];
[invocation invoke];
NSDictionary *returnValue;
[invocation getReturnValue:&returnValue];
@ -109,32 +195,46 @@
[arr addObject:returnValue];
}
value = arr;
}
// Other LLModel or an unidentified value
else {
BOOL isPNObjectSubclass = [NSClassFromString(propertyType) isSubclassOfClass:[PNObject class]];
if(isPNObjectSubclass) {
SEL selector = NSSelectorFromString(@"reverseMapping");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:
[[PNObject class] instanceMethodSignatureForSelector:selector]];
[JSON setValue:arr forKey:propertyName];
},
@"NSMutableArray" : ^{
NSMutableArray *arr = [NSMutableArray array];
for(id JSONObject in value) {
PNObject *val = [[NSClassFromString(mappedJSONType) alloc] initWithJSON:JSONObject];
[arr addObject:val];
SEL selector = NSSelectorFromString(@"getJSONObject");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:value];
[invocation invoke];
NSDictionary *returnValue;
[invocation getReturnValue:&returnValue];
value = returnValue;
}
else {
// do nothing
}
[JSON setValue:arr forKey:propertyName];
}
}[propertyType] ?: ^{
BOOL isPNObjectSubclass = [NSClassFromString(propertyType) isSubclassOfClass:[PNObject class]];
if(isPNObjectSubclass) {
SEL selector = NSSelectorFromString(@"getJSONObject");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:value];
[invocation invoke];
NSDictionary *returnValue;
[invocation getReturnValue:&returnValue];
[JSON setValue:returnValue forKey:propertyName];
}
else {
// do nothing
}
})();
[JSON setValue:value forKey:propertyName];
}
_JSON = JSON;
@ -142,125 +242,51 @@
return _JSON;
}
- (void)populateObjectFromJSON:(id)JSON
{
- (NSDictionary* _Nonnull) getJSONObject {
return [self reverseMapping];
}
- (NSString* _Nonnull) description {
return [_JSON description];
}
- (void) setSingleInstance:(BOOL)singleInstance {
_singleInstance = singleInstance;
}
#pragma mark PNObjectPersistency protocol
- (BOOL) initObjectPersistency {
NSDictionary *properties = [PNObjectProperty propertiesForClass:self.class];
BOOL isDir=YES;
NSError *error;
for(NSString *propertyName in properties) {
NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSFileManager *fileManager= [NSFileManager defaultManager];
if(![fileManager fileExistsAtPath:[docDir stringByAppendingFormat:@"/%@",PNOBJECT_DIR] isDirectory:&isDir]) {
if([propertyName isEqualToString:@"mappingError"])
continue;
NSString *mappedJSONKey;
NSString *mappedJSONType;
NSString *propertyType = [properties valueForKey:propertyName];
id mappingValue = [_objectMapping valueForKey:propertyName];
if([mappingValue isKindOfClass:NSDictionary.class]) {
mappedJSONKey = [mappingValue valueForKey:@"key"];
mappedJSONType = [mappingValue valueForKey:@"type"];
} else {
mappedJSONKey = mappingValue;
if (![[NSFileManager defaultManager] createDirectoryAtPath:[docDir stringByAppendingFormat:@"/%@",PNOBJECT_DIR] withIntermediateDirectories:NO attributes:nil error:&error]) {
#ifdef DEBUG
NSLogDebug(@"Create directory error: %@", error);
#endif
return NO;
}
// Check if there is mapping for the property
if([self isStringNull:mappedJSONKey]) {
// No mapping so just continue
continue;
}
// Get JSON value for the mapped key
id value = [JSON valueForKeyPath:mappedJSONKey];
if([self isObjNull:value]) {
continue;
}
//NSLog(@"Looking for : %@ -- %@ -- %@", propertyType, mappedJSONKey, value);
((void (^)())@{
@"c" : ^{
char val = [value charValue];
[self setValue:@(val) forKey:propertyName];
},
@"d" : ^{
double val = [value doubleValue];
[self setValue:@(val) forKey:propertyName];
},
@"f" : ^{
float val = [value floatValue];
[self setValue:@(val) forKey:propertyName];
},
@"i" : ^{
int val = [value intValue];
[self setValue:@(val) forKey:propertyName];
},
@"l" : ^{
long val = [value longValue];
[self setValue:@(val) forKey:propertyName];
},
@"s" : ^{
short val = [value shortValue];
[self setValue:@(val) forKey:propertyName];
},
@"NSString" : ^{
NSString *val = [NSString stringWithFormat:@"%@", value];
[self setValue:val forKey:propertyName];
},
@"NSNumber" : ^{
NSInteger val = [value integerValue];
[self setValue:@(val) forKey:propertyName];
},
@"NSDate" : ^{
NSString *str = [NSString stringWithFormat:@"%@", value];
NSDate *val = [NSDate dateFromString:str];
[self setValue:val forKey:propertyName];
},
@"NSArray" : ^{
NSMutableArray *arr = [NSMutableArray array];
for(id JSONObject in value) {
PNObject *val = [[NSClassFromString(mappedJSONType) alloc] initWithJSON:JSONObject];
[arr addObject:val];
}
[self setValue:arr forKey:propertyName];
},
@"NSMutableArray" : ^{
NSMutableArray *arr = [NSMutableArray array];
for(id JSONObject in value) {
PNObject *val = [[NSClassFromString(mappedJSONType) alloc] initWithJSON:JSONObject];
[arr addObject:val];
}
[self setValue:arr forKey:propertyName];
}
}[propertyType] ?: ^{
BOOL isPNObjectSubclass = [NSClassFromString(propertyType) isSubclassOfClass:[PNObject class]];
if(isPNObjectSubclass) {
PNObject *val = [[NSClassFromString(propertyType) alloc] initWithJSON:value];
[self setValue:val forKey:propertyName];
}
else {
NSString *errorStr = [NSString stringWithFormat:@"Property '%@' could not be assigned any value.", propertyName];
NSLog(@"%@",errorStr);
}
})();
}
#ifdef DEBUG
NSLogDebug(@"%@",[docDir stringByAppendingFormat:@"/%@",PNOBJECT_DIR]);
#endif
return YES;
}
#pragma mark PNObjectSubclassing
+ (NSString *) objectClassName {
- (id _Nonnull) saveLocally {
return [_objectModel saveLocally:self];
}
+ (NSDictionary *) objcetMapping {
- (BOOL) autoRemoveLocally {
return [_objectModel removeObjectLocally:self];
}
#pragma mark -

View File

@ -7,6 +7,7 @@
//
#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>
typedef NS_ENUM(NSInteger, Environment) {
Development,
@ -20,12 +21,15 @@ extern NSString* const EnvironmentDevelopment;
@interface PNObjectConfig : NSObject
@property (nonatomic, strong) AFHTTPSessionManager *manager;
@property (nonatomic) NSInteger minPasswordLenght;
/**
* gets singleton object.
* @return singleton
*/
+ (instancetype) sharedInstance;
/**
*
*
@ -38,10 +42,12 @@ extern NSString* const EnvironmentDevelopment;
*
* @return singleton
*/
+ (instancetype) sharedInstanceForEnvironments:(NSDictionary *) endpointUrlsForEnvironments;
+ (instancetype) initSharedInstanceForEnvironments:(NSDictionary *) endpointUrlsForEnvironments;
- (void) enableEnvironment:(Environment) env;
- (void) setEnvironment:(Environment) env;
- (NSString *) PNObjEndpoint;
- (void) setAcceptablePasswordLenght:(NSUInteger) passLenght;
@end

View File

@ -7,6 +7,9 @@
//
#import "PNObjectConfig.h"
#import "PNObjectConstants.h"
NSInteger const minPassLenght = 4;
NSString* const EnvironmentProduction = @"PNObjectConfigEnvProduction";
NSString* const EnvironmentStage = @"PNObjectConfigEnvStage";
@ -16,10 +19,12 @@ NSString* const EnvironmentDevelopment = @"PNObjectConfigDevelopment";
@interface PNObjectConfig()
@property (nonatomic, strong) NSMutableDictionary *configuration;
@property (nonatomic, strong) NSString *currentEnvironment;
@property (nonatomic) BOOL devEnabled;
@property (nonatomic) BOOL stageEnabled;
@property (nonatomic) BOOL productionEnabled;
@end
@implementation PNObjectConfig
@ -32,7 +37,7 @@ static bool isFirstAccess = YES;
#pragma mark - Public Method
+ (id)sharedInstance
+ (instancetype)sharedInstance
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
@ -45,7 +50,7 @@ static bool isFirstAccess = YES;
#pragma mark - Life Cycle
+ (instancetype) sharedInstanceForEnvironments:(NSDictionary *) endpointUrlsForEnvironments {
+ (instancetype) initSharedInstanceForEnvironments:(NSDictionary *) endpointUrlsForEnvironments {
SINGLETON = [self sharedInstance];
if (SINGLETON) {
@ -55,7 +60,7 @@ static bool isFirstAccess = YES;
EnvironmentDevelopment : ^{
NSURL * endpointUrl = [NSURL URLWithString:[endpointUrlsForEnvironments objectForKey:key]];
if (endpointUrl) {
[SINGLETON.configuration setValue:endpointUrl forKey:key];
[SINGLETON.configuration setValue:[endpointUrl absoluteString] forKey:key];
SINGLETON.devEnabled = YES;
}
@ -63,14 +68,14 @@ static bool isFirstAccess = YES;
EnvironmentStage : ^{
NSURL * endpointUrl = [NSURL URLWithString:[endpointUrlsForEnvironments objectForKey:key]];
if (endpointUrl) {
[SINGLETON.configuration setValue:endpointUrl forKey:key];
[SINGLETON.configuration setValue:[endpointUrl absoluteString] forKey:key];
SINGLETON.stageEnabled = YES;
}
},
EnvironmentProduction : ^{
NSURL * endpointUrl = [NSURL URLWithString:[endpointUrlsForEnvironments objectForKey:key]];
if (endpointUrl) {
[SINGLETON.configuration setValue:endpointUrl forKey:key];
[SINGLETON.configuration setValue:[endpointUrl absoluteString] forKey:key];
SINGLETON.productionEnabled = YES;
}
}
@ -79,8 +84,8 @@ static bool isFirstAccess = YES;
})();
}
NSAssert(SINGLETON.productionEnabled, @"EnvironmentProduction must be valid endpoint url");
SINGLETON.currentEnvironment = [[SINGLETON configuration] objectForKey:EnvironmentProduction];
NSLog(@"Config : %@",SINGLETON.configuration);
}
return SINGLETON;
}
@ -122,25 +127,46 @@ static bool isFirstAccess = YES;
if (self) {
_configuration = [[NSMutableDictionary alloc] init];
_minPasswordLenght = minPassLenght;
}
return self;
}
- (void) enableEnvironment:(Environment) env {
- (void) setEnvironment:(Environment) env {
_currentEnvironment = nil;
switch (env) {
case Development:{
if (_devEnabled) {
_currentEnvironment = [_configuration objectForKey:EnvironmentDevelopment];
}
}
break;
case Stage:{
if (_stageEnabled) {
_currentEnvironment = [_configuration objectForKey:EnvironmentStage];
}
}
break;
case Production:
default:
if (_productionEnabled) {
_currentEnvironment = [_configuration objectForKey:EnvironmentProduction];
}
break;
}
NSAssert(_currentEnvironment,@"Selected environment generate error. Please check configuration");
}
- (NSString *) PNObjEndpoint {
return _currentEnvironment;
}
- (void) setAcceptablePasswordLenght:(NSUInteger) passLenght {
_minPasswordLenght = passLenght;
}
@end

View File

@ -0,0 +1,32 @@
//
// PNObjectConstants.h
// Pods
//
// Created by Giuseppe Nucifora on 16/01/16.
//
//
#import "HTTPStatusCodes.h"
#ifndef PNObjectConstants_h
#define PNObjectConstants_h
#pragma mark Constants
#define DEF_DOCUMENT_ROOT @"Documents"
#pragma mark -
#pragma mark NSLogDebug Macro
#define FORCE_NO_LOG 0
#if defined(FORCE_NO_LOG) && FORCE_NO_LOG == 0
#define NSLogDebug(format, ...) NSLog(@"<%s:%d> %s, " format, strrchr("/" __FILE__, '/') + 1, __LINE__, __PRETTY_FUNCTION__, ## __VA_ARGS__)
#else
#define NSLogDebug(format, ...)
#endif
#endif

View File

@ -0,0 +1,46 @@
//
// PNObjectModel.h
// Pods
//
// Created by Giuseppe Nucifora on 16/01/16.
//
//
#import <Foundation/Foundation.h>
@protocol PNObjectPersistency <NSObject>
@required
- (BOOL) initObjectPersistency;
@end
@interface PNObjectModel : NSObject
@property (nonatomic, assign) id<PNObjectPersistency> _Nonnull persistencyDelegate;
+ (_Nonnull instancetype) sharedInstance;
/**
* <#Description#>
*
* @param object PNObject Subclass to save
*
* @return return It return the object if the save was successful.
* @return return NSError
*/
- (id _Nonnull) saveLocally:(id _Nonnull) object;
/**
* <#Description#>
*
* @param object PNObject Subclass add list objects and save the list
*
* @return <#return value description#>
*/
- (BOOL) removeObjectLocally:(id _Nonnull) object;
- (id _Nonnull) fetchObjectsWithClass:(Class _Nonnull) class;
@end

277
Pod/Classes/PNObjectModel.m Normal file
View File

@ -0,0 +1,277 @@
//
// PNObjectModel.m
// Pods
//
// Created by Giuseppe Nucifora on 16/01/16.
//
//
#import "PNObjectModel.h"
#import "PNObject+Protected.h"
#import "PEARFileManager.h"
#import "PNObjectConstants.h"
@interface PNObjectModel()
@property (nonatomic, strong) PEARFileManager *fileManager;
@end
@implementation PNObjectModel
static PNObjectModel *SINGLETON = nil;
static bool isFirstAccess = YES;
#pragma mark Public Method
+ (instancetype) sharedInstance
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
isFirstAccess = NO;
SINGLETON = [[super allocWithZone:NULL] init];
});
return SINGLETON;
}
- (NSString * _Nullable) objectName:(id _Nonnull) object {
BOOL isPNObjectSubclass = [[object class] isSubclassOfClass:[PNObject class]];
if(isPNObjectSubclass) {
if ([[object class] conformsToProtocol:@protocol(PNObjectSubclassing)]) {
NSString *className;
//if ([[object subClassDelegate] respondsToSelector:@selector(objectClassName)]) {
@try {
className = (NSString *)[[object class] performSelector:@selector(objectClassName)];
}
@catch (NSException *exception) {
return nil;
}
@finally {
return className;
}
//}
}
}
return nil;
}
- (BOOL) issetPNObjectModelForObject:(id _Nonnull) object {
NSString *className = [self objectName:object];
if (!className) {
return NO;
}
return [_fileManager checkPath:className];
}
#pragma mark -
+ (id) allocWithZone:(NSZone *)zone
{
return [self sharedInstance];
}
+ (id)copyWithZone:(struct _NSZone *)zone
{
return [self sharedInstance];
}
+ (id)mutableCopyWithZone:(struct _NSZone *)zone
{
return [self sharedInstance];
}
- (id)copy
{
return [[PNObjectModel alloc] init];
}
- (id)mutableCopy
{
return [[PNObjectModel alloc] init];
}
- (id) init
{
if(SINGLETON){
return SINGLETON;
}
if (isFirstAccess) {
[self doesNotRecognizeSelector:_cmd];
}
self = [super init];
if (self) {
_fileManager = [PEARFileManager sharedInstatnce];
[_fileManager setRootDirectory:k_ROOT_DIR_DOCUMENTS];
NSLogDebug(@"%@",[_fileManager getRootDirectoryPath]);
}
return self;
}
- (id _Nonnull) fetchObjectsWithClass:(Class _Nonnull) class {
BOOL isPNObjectSubclass = [class isSubclassOfClass:[PNObject class]];
if(isPNObjectSubclass) {
NSString *className;
@try {
className = (NSString *)[class performSelector:@selector(objectClassName)];
}
@catch (NSException *exception) {
}
@finally {
if ([_fileManager checkPath:className]) {
return [NSKeyedUnarchiver unarchiveObjectWithData:[_fileManager fetchFileDataWithPath:className]];
}
else
return nil;
}
}
}
- (id _Nonnull) saveLocally:(id _Nonnull) object {
BOOL isPNObjectSubclass = [[object class] isSubclassOfClass:[PNObject class]];
if(isPNObjectSubclass) {
if ([[object class] conformsToProtocol:@protocol(PNObjectSubclassing)]) {
if ([(PNObject*) object singleInstance]) {
SEL selector = NSSelectorFromString(@"getJSONObject");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:object];
[invocation invoke];
NSDictionary *objectDict;
[invocation getReturnValue:&objectDict];
NSLogDebug(@"%@",objectDict);
NSData *objectData = [NSKeyedArchiver archivedDataWithRootObject:objectDict];
if ([self issetPNObjectModelForObject:object]) {
if ([_fileManager updateFileWithData:objectData filePath:[self objectName:object] permisson:@(0755)]) {
return object;
}
else {
return [NSError errorWithDomain:NSLocalizedString(@"Object cannot be updated", @"") code:kHTTPStatusCodeBadRequest userInfo:nil];
}
}
else {
if ([_fileManager createFileWithData:objectData filePath:[self objectName:object] permisson:@(0755)]) {
return object;
}
else {
return [NSError errorWithDomain:NSLocalizedString(@"Object cannot be created", @"") code:kHTTPStatusCodeBadRequest userInfo:nil];
}
}
}
else {
if ([self issetPNObjectModelForObject:object]) {
NSData * data = [_fileManager fetchFileDataWithPath:[self objectName:object]];
NSMutableArray *objects = [[NSMutableArray alloc] initWithArray:[NSKeyedUnarchiver unarchiveObjectWithData:data]];
SEL selector = NSSelectorFromString(@"getJSONObject");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:object];
[invocation invoke];
NSDictionary *objectDict;
[invocation getReturnValue:&objectDict];
NSLogDebug(@"%@",objectDict);
[objects addObject:objectDict];
NSData *objectData = [NSKeyedArchiver archivedDataWithRootObject:objects];
if ([_fileManager updateFileWithData:objectData filePath:[self objectName:object] permisson:@(0755)]) {
return objects;
}
else {
return [NSError errorWithDomain:NSLocalizedString(@"Objects list cannot be updated", @"") code:kHTTPStatusCodeBadRequest userInfo:nil];
}
}
else {
NSMutableArray *objects = [[NSMutableArray alloc] init];
SEL selector = NSSelectorFromString(@"getJSONObject");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:object];
[invocation invoke];
NSDictionary *objectDict;
[invocation getReturnValue:&objectDict];
NSLogDebug(@"%@",objectDict);
[objects addObject:objectDict];
NSData *objectData = [NSKeyedArchiver archivedDataWithRootObject:objects];
if ([_fileManager createFileWithData:objectData filePath:[self objectName:object] permisson:@(0755)]) {
return object;
}
else {
return [NSError errorWithDomain:NSLocalizedString(@"Objects list cannot be created", @"") code:kHTTPStatusCodeBadRequest userInfo:nil];
}
}
}
}
else {
return [NSError errorWithDomain:NSLocalizedString(@"passed object is not conform to protocol PNObjectSubclassing", @"") code:kHTTPStatusCodeBadRequest userInfo:nil];
}
}
else {
return [NSError errorWithDomain:NSLocalizedString(@"passed object is not PNObject Subclass", @"") code:kHTTPStatusCodeBadRequest userInfo:nil];
}
}
- (BOOL) removeObjectLocally:(id _Nonnull) object {
BOOL isPNObjectSubclass = [[object class] isSubclassOfClass:[PNObject class]];
if(isPNObjectSubclass) {
if ([[object class] conformsToProtocol:@protocol(PNObjectSubclassing)]) {
if ([self issetPNObjectModelForObject:object]) {
return [_fileManager deletePath:[self objectName:object]];
}
}
}
return NO;
}
@end

View File

@ -7,6 +7,7 @@
//
#import <Foundation/Foundation.h>
#import "PNObject.h"
@interface PNObjectProperty : NSObject

View File

@ -8,23 +8,25 @@
#import "PNObjectProperty.h"
#import "objc/runtime.h"
#import "PNObjectConstants.h"
#import "PNObject+Protected.h"
@implementation PNObjectProperty
static BOOL property_getTypeString( objc_property_t property, char *buffer )
{
const char * attrs = property_getAttributes( property );
if ( attrs == NULL )
return NO;
const char * e = strchr( attrs, ',' );
if ( e == NULL )
return NO;
int len = (int)(e - attrs);
memcpy( buffer, attrs, len );
buffer[len] = '\0';
const char * attrs = property_getAttributes( property );
if ( attrs == NULL )
return NO;
const char * e = strchr( attrs, ',' );
if ( e == NULL )
return NO;
int len = (int)(e - attrs);
memcpy( buffer, attrs, len );
buffer[len] = '\0';
return YES;
}
@ -37,6 +39,9 @@ static BOOL property_getTypeString( objc_property_t property, char *buffer )
}
NSMutableDictionary *results = [NSMutableDictionary dictionary];
if ([PNObjClass isSubclassOfClass:[PNObject class]] && PNObjClass != [PNObject class]) {
[results addEntriesFromDictionary:[self propertiesForClass:[PNObject class]]];
}
unsigned int outCount, i;
objc_property_t *properties = class_copyPropertyList(PNObjClass, &outCount);
@ -63,9 +68,11 @@ static BOOL property_getTypeString( objc_property_t property, char *buffer )
propertyType = [propertyType substringWithRange:subStrRange];
}
//NSLog(@"Prop type & name: %@ -- %@", propertyType, propertyName);
//NSLogDebug(@"Prop type & name: %@ -- %@", propertyType, propertyName);
[results setObject:propertyType forKey:propertyName];
if (![[PNObject protectedProperties] containsObject:propertyName]) {
[results setObject:propertyType forKey:propertyName];
}
}
}
free(properties);

View File

@ -1,20 +0,0 @@
//
// PNObjectSubclassing.h
// Pods
//
// Created by Giuseppe Nucifora on 08/01/16.
//
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@protocol PNObjectSubclassing <NSObject>
@required
+ (NSString *) objectClassName;
+ (NSDictionary *) objcetMapping;
@end

View File

@ -0,0 +1,23 @@
//
// PNAddress.h
// Pods
//
// Created by Giuseppe Nucifora on 13/01/16.
//
//
#import "PNObject.h"
#import "PNLocation.h"
@interface PNAddress : PNObject <PNObjectSubclassing>
@property (nonatomic, strong) NSString * _Nullable country;
@property (nonatomic, strong) NSString * _Nullable province;
@property (nonatomic, strong) NSString * _Nullable city;
@property (nonatomic, strong) NSString * _Nullable street;
@property (nonatomic, strong) NSNumber * _Nullable number;
@property (nonatomic, strong) NSString * _Nullable zip;
@property (nonatomic, strong) NSString * _Nullable istruction;
@property (nonatomic, strong) PNLocation * _Nullable location;
@end

View File

@ -0,0 +1,33 @@
//
// PNAddress.m
// Pods
//
// Created by Giuseppe Nucifora on 13/01/16.
//
//
#import "PNAddress.h"
@implementation PNAddress
+ (NSString *) objectClassName {
return @"Address";
}
+ (NSDictionary *) objcetMapping {
NSDictionary *mapping = @{@"country":@"country",
@"province":@"province",
@"city":@"city",
@"street":@"street",
@"number":@"number",
@"zip":@"zip",
@"location":@{@"key":@"location",@"type":@"PNLocation"},
};
return mapping;
}
+ (BOOL)singleInstance {
return NO;
}
@end

View File

@ -0,0 +1,16 @@
//
// PNLocation.h
// Pods
//
// Created by Giuseppe Nucifora on 13/01/16.
//
//
#import "PNObject.h"
@interface PNLocation : PNObject <PNObjectSubclassing>
@property (nonatomic) CGFloat lat;
@property (nonatomic) CGFloat lng;
@end

View File

@ -0,0 +1,29 @@
//
// PNLocation.m
// Pods
//
// Created by Giuseppe Nucifora on 13/01/16.
//
//
#import "PNLocation.h"
@implementation PNLocation
+ (NSString *) objectClassName {
return @"Location";
}
+ (NSDictionary *) objcetMapping {
NSDictionary *mapping = @{@"lat":@"lat",
@"lng":@"lng",
};
return mapping;
}
+ (BOOL)singleInstance {
return NO;
}
@end

45
Pod/Classes/User/PNUser.h Normal file
View File

@ -0,0 +1,45 @@
//
// PNUser.h
// Pods
//
// Created by Giuseppe Nucifora on 15/01/16.
//
//
#import "PNObject.h"
@interface PNUser : PNObject
@property (strong, nonatomic) NSString * _Nonnull userId;
@property (strong, nonatomic) NSString * _Nonnull firstName;
@property (strong, nonatomic) NSString * _Nonnull lastName;
@property (nonatomic, strong) UIImage * _Nullable profileImage;
@property (nonatomic, strong) NSString * _Nullable sex;
@property (nonatomic, strong) NSDate * _Nullable birthDate;
@property (nonatomic, strong) NSString * _Nullable phone;
@property (nonatomic) BOOL hasAcceptedPrivacy;
@property (nonatomic) BOOL hasAcceptedNewsletter;
@property (nonatomic) BOOL hasVerifiedEmail;
@property (nonatomic, strong) NSDate * _Nullable emailVerifiedDate;
@property (nonatomic, strong) NSString * _Nonnull email;
@property (nonatomic, strong) NSString * _Nonnull username;
@property (nonatomic, strong) NSString * _Nonnull password;
@property (nonatomic) BOOL publicProfile;
@property (nonatomic, strong) NSNumber * _Nonnull loginCount;
@property (nonatomic, strong) NSString * _Nullable facebookId;
@property (nonatomic, strong) NSString * _Nullable facebookAccessToken;
/**
* gets singleton object of current user session.
*
* @return singleton
*/
+ (instancetype _Nonnull) currentUser;
- (BOOL) isValidPassword:(NSString* _Nonnull) password;
//- (void) setPassword:(NSString * _Nonnull)password inBackGroundWithBlock:(nullable void (^)(BOOL saveStatus, id _Nullable responseObject, NSError * _Nullable error)) responseBlock;
@end

161
Pod/Classes/User/PNUser.m Normal file
View File

@ -0,0 +1,161 @@
//
// PNUser.m
// Pods
//
// Created by Giuseppe Nucifora on 15/01/16.
//
//
#import "PNUser.h"
#import "NSString+Helper.h"
#import "PNObjectConstants.h"
#import "PNObject+Protected.h"
@interface PNUser() <PNObjectSubclassing>
@end
@implementation PNUser
@synthesize password = _password;
static PNUser *SINGLETON = nil;
static bool isFirstAccess = YES;
#pragma mark - Public Method
+ (instancetype)sharedInstance
{
return [self currentUser];
}
+ (instancetype) currentUser {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
isFirstAccess = NO;
SINGLETON = [[super allocWithZone:NULL] init];
});
return SINGLETON;
}
#pragma mark - Life Cycle
+ (instancetype) allocWithZone:(NSZone *)zone
{
return [self sharedInstance];
}
+ (instancetype)copyWithZone:(struct _NSZone *)zone
{
return [self sharedInstance];
}
+ (instancetype)mutableCopyWithZone:(struct _NSZone *)zone
{
return [self sharedInstance];
}
- (instancetype)copy
{
return [[PNUser alloc] init];
}
- (instancetype)mutableCopy
{
return [[PNUser alloc] init];
}
- (id) init
{
if(SINGLETON){
return SINGLETON;
}
if (isFirstAccess) {
[self doesNotRecognizeSelector:_cmd];
}
NSDictionary *savedUser = [[PNObjectModel sharedInstance] fetchObjectsWithClass:[self class]];
if (savedUser) {
self = [super initWithJSON:savedUser];
}
else {
self = [super init];
}
if (self) {
}
return self;
}
- (void) setEmail:(NSString *)email {
if ([email isValidEmail]) {
_email = email;
}
NSLogDebug(@"insertedEmail is not valid.");
}
- (void) setPassword:(NSString *)password {
if ([password length] >= [[PNObjectConfig sharedInstance] minPasswordLenght]) {
_password = password;
}
else {
NSLogDebug(@"Inserted Passord is not valid.Lenght must be >= %ld",(long)[[PNObjectConfig sharedInstance] minPasswordLenght]);
}
}
- (BOOL) isValidPassword:(NSString* _Nonnull) password {
if ([password length] >= [[PNObjectConfig sharedInstance] minPasswordLenght]) {
return YES;
}
return NO;
}
- (NSString *) password {
return @"password is not readble";
}
#pragma mark PNObjectSubclassing Protocol
+ (NSDictionary *)objcetMapping {
NSDictionary *mapping = @{
@"userId":@"id",
@"firstName":@"firstName",
@"lastName":@"lastName",
@"profileImage":@"profileImage",
@"sex":@"sex",
@"birthDate":@"birthDate",
@"phone":@"phone",
@"password":@"password",
@"hasAcceptedPrivacy":@"hasAcceptedPrivacy",
@"hasAcceptedNewsletter":@"hasAcceptedNewsletter",
@"hasVerifiedEmail":@"hasVerifiedEmail",
@"emailVerifiedDate":@"emailVerifiedDate",
@"email":@"email",
@"username":@"username",
@"publicProfile":@"public_profile",
@"loginCount":@"login_count",
@"facebookId":@"facebookId",
@"facebookAccessToken":@"facebookAccessToken",
};
return mapping;
}
+ (NSString *)objectClassName {
return @"User";
}
+ (BOOL) singleInstance {
return YES;
}
#pragma mark -
@end

View File

@ -1,13 +0,0 @@
//
// User.h
// Pods
//
// Created by Giuseppe Nucifora on 08/01/16.
//
//
#import <PNObject/PNObject.h>
@interface User : PNObject
@end

View File

@ -1,22 +0,0 @@
//
// User.m
// Pods
//
// Created by Giuseppe Nucifora on 08/01/16.
//
//
#import "User.h"
@implementation User
- (instancetype) initWithJSON:(NSDictionary *)JSON {
self = [super initWithJSON:JSON];
if (self) {
}
return self;
}
@end

View File

@ -20,6 +20,49 @@ it, simply add the following line to your Podfile:
pod "PNObject"
```
##Usage Example
PNObject Subclass
```ruby
Customer.h
#import <PNObject/PNObject.h>
@interface Customer : PNObject <PNObjectSubclassing>
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *lastName;
@property (nonatomic, strong) NSString *email;
@property (nonatomic, strong) NSDate *birthDate;
@property (nonatomic, strong) PNAddress *address;
@end
```
```ruby
#import "Customer.h"
@implementation Customer
+ (NSString *) objectClassName {
return @"Customer";
}
+ (NSDictionary *) objcetMapping {
NSDictionary *mapping = @{
@"name":@"first_name",
@"surname":@"last_name",
@"email":@"email",
@"birthDate":@"birth_date",
@"address":@{@"key":@"address",@"type":@"PNAddress"},
};
return mapping;
}
```
## Author
Giuseppe Nucifora, me@giuseppenucifora.com