Skip to content

Commit

Permalink
Removed dependenc ObjectiveSugary
Browse files Browse the repository at this point in the history
  • Loading branch information
hzalaz committed Mar 30, 2015
1 parent b221312 commit c597ec0
Show file tree
Hide file tree
Showing 21 changed files with 128 additions and 119 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'cocoapods', '~> 0.36.0'
gem 'cocoapods', '0.36.0'
gem 'cocoapods-packager'
gem 'cocoapods-deintegrate'
gem 'cocoapods-dependencies'
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PLATFORMS
ruby

DEPENDENCIES
cocoapods (~> 0.36.0)
cocoapods (= 0.36.0)
cocoapods-deintegrate
cocoapods-dependencies
cocoapods-packager
1 change: 0 additions & 1 deletion Lock.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Auth0 is a SaaS that helps you with Authentication and Authorization. You can us

s.dependency 'libextobjc', '~> 0.4'
s.dependency 'CocoaLumberjack', '~> 2.0.0-rc'
s.dependency 'ObjectiveSugar', '~> 1.1'
s.default_subspecs = 'UI', 'Facebook', 'Twitter', 'Core'
s.prefix_header_contents = <<-EOS
#import "A0Logging.h"
Expand Down
1 change: 1 addition & 0 deletions Lock/Lock/A0HomeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#import <libextobjc/EXTScope.h>
#import <SimpleKeychain/A0SimpleKeychain.h>
#import <JWTDecode/A0JWTDecoder.h>
#import <ReactiveCocoa/ReactiveCocoa.h>

#define kClientIdKey @"Auth0ClientId"
#define kTenantKey @"Auth0Tenant"
Expand Down
1 change: 1 addition & 0 deletions Lock/Lock/A0ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#import <libextobjc/EXTScope.h>
#import <SimpleKeychain/A0SimpleKeychain.h>
#import <JWTDecode/A0JWTDecoder.h>
#import <ReactiveCocoa/ReactiveCocoa.h>

@interface A0ViewController ()

Expand Down
2 changes: 1 addition & 1 deletion Lock/Lock/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6751" systemVersion="14C1510" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="b0G-O7-9pB">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6751" systemVersion="14C1514" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="b0G-O7-9pB">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
Expand Down
88 changes: 38 additions & 50 deletions Lock/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
PODS:
- AFNetworking (2.5.1):
- AFNetworking/NSURLConnection (= 2.5.1)
- AFNetworking/NSURLSession (= 2.5.1)
- AFNetworking/Reachability (= 2.5.1)
- AFNetworking/Security (= 2.5.1)
- AFNetworking/Serialization (= 2.5.1)
- AFNetworking/UIKit (= 2.5.1)
- AFNetworking/NSURLConnection (2.5.1):
- AFNetworking (2.5.2):
- AFNetworking/NSURLConnection (= 2.5.2)
- AFNetworking/NSURLSession (= 2.5.2)
- AFNetworking/Reachability (= 2.5.2)
- AFNetworking/Security (= 2.5.2)
- AFNetworking/Serialization (= 2.5.2)
- AFNetworking/UIKit (= 2.5.2)
- AFNetworking/NSURLConnection (2.5.2):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/NSURLSession (2.5.1):
- AFNetworking/NSURLSession (2.5.2):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/Reachability (2.5.1)
- AFNetworking/Security (2.5.1)
- AFNetworking/Serialization (2.5.1)
- AFNetworking/UIKit (2.5.1):
- AFNetworking/Reachability (2.5.2)
- AFNetworking/Security (2.5.2)
- AFNetworking/Serialization (2.5.2)
- AFNetworking/UIKit (2.5.2):
- AFNetworking/NSURLConnection
- AFNetworking/NSURLSession
- BDBOAuth1Manager (1.5.0):
Expand Down Expand Up @@ -80,61 +80,51 @@ PODS:
- Lock/Facebook (= 1.10.3.beta)
- Lock/Twitter (= 1.10.3.beta)
- Lock/UI (= 1.10.3.beta)
- ObjectiveSugar (~> 1.1)
- Lock/Core (1.10.3.beta):
- AFNetworking (~> 2.5)
- CocoaLumberjack (~> 2.0.0-rc)
- ISO8601DateFormatter (~> 0.7)
- libextobjc (~> 0.4)
- ObjectiveSugar (~> 1.1)
- Lock/Facebook (1.10.3.beta):
- CocoaLumberjack (~> 2.0.0-rc)
- Facebook-iOS-SDK (~> 3.15)
- libextobjc (~> 0.4)
- Lock/Core
- ObjectiveSugar (~> 1.1)
- Lock/GooglePlus (1.10.3.beta):
- CocoaLumberjack (~> 2.0.0-rc)
- googleplus-ios-sdk (~> 1.7.1)
- libextobjc (~> 0.4)
- Lock/Core
- ObjectiveSugar (~> 1.1)
- Lock/ReactiveCore (1.10.3.beta):
- CocoaLumberjack (~> 2.0.0-rc)
- libextobjc (~> 0.4)
- Lock/Core
- ObjectiveSugar (~> 1.1)
- ReactiveCocoa (~> 2.3)
- Lock/SMS (1.10.3.beta):
- CocoaLumberjack (~> 2.0.0-rc)
- libextobjc (~> 0.4)
- Lock/UI
- ObjectiveSugar (~> 1.1)
- Lock/TouchID (1.10.3.beta):
- CocoaLumberjack (~> 2.0.0-rc)
- libextobjc (~> 0.4)
- Lock/UI
- ObjectiveSugar (~> 1.1)
- SimpleKeychain (~> 0.2)
- TouchIDAuth (~> 0.1)
- Lock/Twitter (1.10.3.beta):
- BDBOAuth1Manager (~> 1.5.0)
- CocoaLumberjack (~> 2.0.0-rc)
- libextobjc (~> 0.4)
- Lock/Core
- ObjectiveSugar (~> 1.1)
- PSAlertView (~> 2.0)
- TWReverseAuth (~> 0.1.0)
- Lock/UI (1.10.3.beta):
- CocoaLumberjack (~> 2.0.0-rc)
- libextobjc (~> 0.4)
- Lock/Core
- ObjectiveSugar (~> 1.1)
- LUKeychainAccess (1.2.4)
- NSData+Base64 (1.0.0)
- OAuthCore (0.0.1):
- NSData+Base64
- ObjectiveSugar (1.1.0)
- OCHamcrest (4.1.1)
- OCMockito (1.4.0):
- OCHamcrest (~> 4.0)
Expand All @@ -151,10 +141,9 @@ PODS:
- ReactiveCocoa/Core
- SimpleKeychain (0.3.0)
- Specta (0.3.2)
- TouchIDAuth (0.1.0):
- TouchIDAuth (0.1.1):
- libextobjc (~> 0.4)
- ObjectiveSugar (~> 1.1)
- SimpleKeychain (~> 0.2)
- SimpleKeychain (~> 0.3)
- TWReverseAuth (0.1.1):
- LUKeychainAccess
- OAuthCore
Expand All @@ -176,32 +165,31 @@ DEPENDENCIES:

EXTERNAL SOURCES:
Lock:
:path: ../
:path: "../"

SPEC CHECKSUMS:
AFNetworking: 8bee59492a6ff15d69130efa4d0dc67e0094a52a
BDBOAuth1Manager: 274574557077abc873fc5688abe8b991e782749c
Bolts: dd9fb8433d67f5acc3b6b4d1379bbc5513d716c1
CocoaLumberjack: fd2b1031c6c4e0f08b5ea928ef677fa0a5de517d
Expecta: ee641011fe10aa1855d487b40e4976dac50ec342
AFNetworking: fefbce9660acb17f48ae0011292d4da0f457bf36
BDBOAuth1Manager: 2e28773b58f880fb36b5cd3efcf0b1fefbc78a99
Bolts: f8e2f94edbf9fec7bb8de5ecaaa3aa6b7de6f64e
CocoaLumberjack: a6f77d987d65dc7ba86b0f84db7d0b9084f77bcb
Expecta: 8c507baf13211207b1e9d0a741480600e6b4ed15
Facebook-iOS-SDK: cd87f0b2f0c1d9574b44e8fa2baacc275524bac3
googleplus-ios-sdk: b0f6cd8aa29c51d0048cace8dc3bd8f4ae0806bb
ISO8601DateFormatter: 59731cd880cf87e71b4fa95f0d6b713dcbc4cbce
JWTDecode: 72e3393caf14dc762eba51d29f15bd86f608aba3
libextobjc: d6146fce3ebea986b7f75fcb4c967639200b88b0
Lock: 7335fd660115be1c73d3d01bf05cb40ed49dee91
googleplus-ios-sdk: 065d9135061a5f84c07656a68ced48336408fe35
ISO8601DateFormatter: ab926648eebe497f4d167c0fd083992f959f1274
JWTDecode: bff190dc06ff9ee7a3a244c454dc8ef05962c994
libextobjc: a650fc1bf489a3d3a9bc2e621efa3e1006fc5471
Lock: fe881f0612ffb3e28b8582548af68bfbce65d1e9
LUKeychainAccess: 6479edb12cf06e11ff3336f796959eedbc58f714
NSData+Base64: aae92a2e3f0bd88b29fe6093551ded3f5c062548
OAuthCore: 09d3c56dd3f64a61d1ffcbf103f28118ff8ca2e9
ObjectiveSugar: f48793f5902c77cfc02a4ce46d2e8ecddcad4dc2
OCHamcrest: af1c7c5ea345de69ea6c9c2958f65f3044e5c420
OCMockito: 991936bb775cc4c27f063d38f5e17b9161fbd21c
OHHTTPStubs: e6ecc3fd4fa11b2cfb5f4823421bddc95a82913d
PSAlertView: fa44c0b5dbdae9afa9c2ec5e0662f5d33fd1148c
ReactiveCocoa: 313fc53cc9aeb2bbbc3f5f13c7eac16478d9af8f
SimpleKeychain: 4758625a53ca89cfae98b4aca8c550d1193292f8
Specta: 698a58ffa5ec948327d3b92eab50ca58d7f4fbe8
TouchIDAuth: 4a104cd6a614e63c23fad6e6446bf79b6cc6f429
TWReverseAuth: da3ae5f14c3b26ebb503ddff25cb1cb0b9c1839b
NSData+Base64: 4e84902c4db907a15673474677e57763ef3903e4
OAuthCore: 43dce261db846a1fe20234d95654257e00e78581
OCHamcrest: 6f03ffa81d12feab872638490a44ab0a6d3aca10
OCMockito: 4981140c9a9ec06c31af40f636e3c0f25f27e6b2
OHHTTPStubs: 5624a5d20d97d46d47e15a68ca8808b59ccf0512
PSAlertView: 16d35f5dba549418492cf68a750d4f0dca21f4a2
ReactiveCocoa: eb38dee0a0e698f73a9b25e5c1faea2bb4c79240
SimpleKeychain: 8de48eb1de10c6403911a6be52e127e5b5d31404
Specta: e5ad38f1b2227a23bc63d0b5a3b41c5e628f2851
TouchIDAuth: f63596baf1c23d85211ab7a3b4bea794d73f3e36
TWReverseAuth: d2deef3521fa6bee32eabab67f114c2c4a53d4f5

COCOAPODS: 0.36.0
COCOAPODS: 0.36.1
15 changes: 8 additions & 7 deletions Lock/Tests/A0LockConfigurationSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#import <OCMockito/OCMockito.h>
#import "A0Application.h"
#import "A0Connection.h"
#import <ObjectiveSugar/ObjectiveSugar.h>
#import "A0Strategy.h"

#define kLockConfig @"LockConfig"
Expand Down Expand Up @@ -89,20 +88,22 @@
});

it(@"should have social connections", ^{
NSArray *names = [config.socialStrategies map:^id(A0Strategy *strategy) {
return [strategy.connections.firstObject name];
__block NSMutableArray *names = [@[] mutableCopy];
[config.socialStrategies enumerateObjectsUsingBlock:^(A0Strategy *stragegy, NSUInteger idx, BOOL *stop) {
[names addObject:stragegy.name];
}];
NSArray *expected = [data[kSocialConnectionNames] mutableCopy];
expect(names).to.beSupersetOf(expected);
expect(names).to.haveCountOf(expected.count);
});

it(@"should have enterprise connections", ^{
NSArray *names = [[config.enterpriseStrategies map:^id(A0Strategy *strategy) {
return [strategy.connections map:^id(A0Connection *connection) {
return connection.name;
__block NSMutableArray *names = [@[] mutableCopy];
[config.enterpriseStrategies enumerateObjectsUsingBlock:^(A0Strategy *stragegy, NSUInteger idx, BOOL *stop) {
[stragegy.connections enumerateObjectsUsingBlock:^(A0Connection *connection, NSUInteger idx, BOOL *stop) {
[names addObject:connection.name];
}];
}] flatten];
}];
NSArray *expected = [data[kEnterpriseConnectionNames] mutableCopy];
expect(names).to.beSupersetOf(expected);
expect(names).to.haveCountOf(expected.count);
Expand Down
14 changes: 5 additions & 9 deletions Pod/Classes/Core/A0Application.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#import "A0Strategy.h"
#import "A0Connection.h"

#import <ObjectiveSugar/ObjectiveSugar.h>

@interface A0Application ()
@property (strong, nonatomic) A0Strategy *databaseStrategy;
@property (strong, nonatomic) NSArray *socialStrategies;
Expand All @@ -44,8 +42,8 @@ - (instancetype)initWithJSONDictionary:(NSDictionary *)JSONDict {
NSString *authorize = JSONDict[@"authorize"];
NSArray *array = JSONDict[@"strategies"];
NSMutableDictionary *strategies = [@{} mutableCopy];
[array each:^(NSDictionary *strategyDict) {
A0Strategy *strategy = [[A0Strategy alloc] initWithJSONDictionary:strategyDict];
[array enumerateObjectsUsingBlock:^(NSDictionary *strategyDictionary, NSUInteger idx, BOOL *stop) {
A0Strategy *strategy = [[A0Strategy alloc] initWithJSONDictionary:strategyDictionary];
[strategies setObject:strategy forKey:strategy.name];
if ([strategy.name isEqualToString:A0StrategyNameAuth0]) {
_databaseStrategy = strategy;
Expand Down Expand Up @@ -82,11 +80,9 @@ - (A0Strategy *)strategyByName:(NSString *)name {
}

- (A0Strategy *)enterpriseStrategyWithConnection:(NSString *)connectionName {
return [self.enterpriseStrategies select:^BOOL(A0Strategy *strategy) {
return [strategy.connections indexOfObjectPassingTest:^BOOL(A0Connection *connection, NSUInteger idx, BOOL *stop) {
return [connection.name isEqualToString:connectionName];
}] != NSNotFound;
}].firstObject;
return [self.enterpriseStrategies filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(A0Strategy *strategy, NSDictionary *bindings) {
return [strategy hasConnectionWithName:connectionName];
}]].firstObject;
}

@end
7 changes: 3 additions & 4 deletions Pod/Classes/Core/A0FilteredConnectionDomainMatcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@
#import "A0Connection.h"
#import "A0Strategy.h"

#import <ObjectiveSugar/ObjectiveSugar.h>

@implementation A0FilteredConnectionDomainMatcher

- (instancetype)initWithStrategies:(NSArray *)strategies filter:(NSArray *)strategyNamesToFilter {
NSArray *filtered = [strategies select:^BOOL(A0Strategy *strategy) {
NSArray *filtered = [strategies filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(A0Strategy *strategy, NSDictionary *bindings) {
return ![strategyNamesToFilter containsObject:strategy.name];
}];
}]];

return [super initWithStrategies:filtered];
}

Expand Down
6 changes: 4 additions & 2 deletions Pod/Classes/Core/A0LockLogger.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#import "A0LockLogger.h"

#import <CocoaLumberjack/CocoaLumberjack.h>

@implementation A0LockLogger

- (instancetype)init {
Expand All @@ -44,8 +46,8 @@ + (void)logOff {
}

+ (void)logWithLevel:(DDLogLevel)level {
for (Class clss in [DDLog registeredClasses]) {
[DDLog setLevel:level forClass:clss];
for (Class clazz in [DDLog registeredClasses]) {
[DDLog setLevel:level forClass:clazz];
}
}

Expand Down
14 changes: 7 additions & 7 deletions Pod/Classes/Core/A0SimpleConnectionDomainMatcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#import "A0Strategy.h"
#import "A0Connection.h"

#import <ObjectiveSugar/ObjectiveSugar.h>

@interface A0SimpleConnectionDomainMatcher ()
@property (strong, nonatomic) NSDictionary *connections;
@property (strong, nonatomic) NSDictionary *domains;
Expand All @@ -39,20 +37,22 @@ - (instancetype)initWithStrategies:(NSArray *)strategies {
NSMutableDictionary *connections = [@{} mutableCopy];
NSMutableDictionary *domains = [@{} mutableCopy];
for (A0Strategy *strategy in strategies) {
NSArray *filtered = [strategy.connections select:^BOOL(A0Connection *connection) {
NSArray *filtered = [strategy.connections filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(A0Connection *connection, NSDictionary *bindings) {
return connection.values[@"domain"] != nil && connection.values[@"domain"] != [NSNull null];
}];
[filtered each:^(A0Connection *connection) {
}]];
[filtered enumerateObjectsUsingBlock:^(A0Connection *connection, NSUInteger idx, BOOL *stop) {
connections[connection.name] = connection;
NSMutableArray *connectionDomains = [@[] mutableCopy];
[connectionDomains addObject:connection.values[@"domain"]];
NSArray *aliases = connection.values[@"domain_aliases"];
if (aliases.count > 0) {
[connectionDomains addObjectsFromArray:aliases];
}
domains[connection.name] = [connectionDomains map:^id(NSString *domain) {
return [A0SimpleConnectionDomainMatcher emailDomainPartFromDomain:domain];
NSMutableArray *result = [@[] mutableCopy];
[connectionDomains enumerateObjectsUsingBlock:^(NSString *domain, NSUInteger idx, BOOL *stop) {
[result addObject:[A0SimpleConnectionDomainMatcher emailDomainPartFromDomain:domain]];
}];
domains[connection.name] = result;
}];
}
_connections = connections;
Expand Down
9 changes: 9 additions & 0 deletions Pod/Classes/Core/A0Strategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ typedef NS_ENUM(NSUInteger, A0StrategyType) {
*/
- (instancetype)initWithName:(NSString *)name connections:(NSArray *)connections type:(A0StrategyType)type;

/**
* Checks if the strategy contains a connection with a given name
*
* @param name connection name
*
* @return if the strategy has a connection with name or not.
*/
- (BOOL)hasConnectionWithName:(NSString *)name;

/**
* Creates a new enterprise strategy
*
Expand Down
6 changes: 6 additions & 0 deletions Pod/Classes/Core/A0Strategy.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ - (instancetype)initWithJSONDictionary:(NSDictionary *)JSONDictionary {
return self;
}

- (BOOL)hasConnectionWithName:(NSString *)name {
return [self.connections indexOfObjectPassingTest:^BOOL(A0Connection *connection, NSUInteger idx, BOOL *stop) {
return [connection.name isEqualToString:name];
}] != NSNotFound;
}

- (NSString *)description {
return [NSString stringWithFormat:@"<A0Strategy name = '%@' connections = %@>", self.name, self.connections];
}
Expand Down
Loading

0 comments on commit c597ec0

Please sign in to comment.