Skip to content

Commit

Permalink
Switched to use targets and removed JTTargetActionBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchiles committed Mar 22, 2016
1 parent db6c2d1 commit d5c85c2
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 86 deletions.
45 changes: 24 additions & 21 deletions ChatSecure.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
3A971C2C5AB08E34FDD18676 /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CCD1F8E85C658C8D3865B584 /* Pods.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
6308D1451CA20762002F5F30 /* Pods-ChatSecureCore-acknowledgements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6308D1441CA20762002F5F30 /* Pods-ChatSecureCore-acknowledgements.plist */; };
631098B11BD6FED000494A47 /* YapDatabse+ChatSecure.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631098B01BD6FED000494A47 /* YapDatabse+ChatSecure.swift */; };
631E1E9F1C583B6900E263CD /* ChatSecureCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D9227C2A1BA7952100B5E1D0 /* ChatSecureCore.framework */; };
633107201A16D1A300C17BAE /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 633106661A16D1A300C17BAE /* LaunchScreen.xib */; };
Expand Down Expand Up @@ -61,7 +62,6 @@
63E353F61BB9E46D005C54C3 /* OTRPushTLVHandlerProtocols.h in Headers */ = {isa = PBXBuildFile; fileRef = 63E353F51BB9E41D005C54C3 /* OTRPushTLVHandlerProtocols.h */; settings = {ATTRIBUTES = (Public, ); }; };
63F614DC1BB214660083A06A /* ChatSecureModelTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63F614DB1BB214660083A06A /* ChatSecureModelTest.swift */; };
63FA130C1C8A4EB700AE33EF /* OTRMessagesCollectionViewFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63FA130B1C8A4EB700AE33EF /* OTRMessagesCollectionViewFlowLayout.swift */; };
8FE09CE9A16DB3D068D19753 /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CCD1F8E85C658C8D3865B584 /* Pods.framework */; };
BB852C4F65587CD8A46FF428 /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CCD1F8E85C658C8D3865B584 /* Pods.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
D9227C241BA78E6B00B5E1D0 /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D9227C231BA78E6B00B5E1D0 /* FontAwesome.ttf */; };
D9227C2D1BA7952100B5E1D0 /* ChatSecureCore.h in Headers */ = {isa = PBXBuildFile; fileRef = D9227C2C1BA7952100B5E1D0 /* ChatSecureCore.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -357,7 +357,6 @@
D93DDBDE1BA79AF900CD8331 /* OTRTouchAndHoldGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 639CDD8F1AD74419009BAABC /* OTRTouchAndHoldGestureRecognizer.h */; settings = {ATTRIBUTES = (Public, ); }; };
D93DDBE21BA7A06A00CD8331 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6396AF9F1A169D54009F3E6C /* main.m */; };
D95AD2291B684AE1007DEBC3 /* xmpp-server-list in Resources */ = {isa = PBXBuildFile; fileRef = D95AD2281B684AE1007DEBC3 /* xmpp-server-list */; };
D973D7061A2D4094004D353E /* Pods-acknowledgements.plist in Resources */ = {isa = PBXBuildFile; fileRef = D973D7051A2D4094004D353E /* Pods-acknowledgements.plist */; };
D978BC921BABE0F4009246CF /* OTRTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = D978BC901BABE0F4009246CF /* OTRTheme.h */; settings = {ATTRIBUTES = (Public, ); }; };
D978BC931BABE0F4009246CF /* OTRTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = D978BC911BABE0F4009246CF /* OTRTheme.m */; };
D99F17861BAB932800604558 /* OTRImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D9AE3A231BA8D02800255537 /* OTRImages.xcassets */; };
Expand All @@ -384,6 +383,7 @@
D9AE3A341BA8DAB600255537 /* OTRLanguageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6331051B1A16D1A300C17BAE /* OTRLanguageManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
D9AE3A351BA8DAB600255537 /* OTRLanguageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6331051C1A16D1A300C17BAE /* OTRLanguageManager.m */; };
D9CBBC581C642BAA005CD715 /* EnablePushViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9CBBC571C642BAA005CD715 /* EnablePushViewController.swift */; };
EE22362CF225156043E19FA7 /* Pods_ChatSecureCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B353F12AE2FDB52438B426D /* Pods_ChatSecureCore.framework */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -440,9 +440,9 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
154CBBDFA16BDE9C28017B1F /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
63039E961B0D43FE007C9978 /* OTRXMPPServerListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTRXMPPServerListViewController.h; sourceTree = "<group>"; };
63039E971B0D43FE007C9978 /* OTRXMPPServerListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTRXMPPServerListViewController.m; sourceTree = "<group>"; };
6308D1441CA20762002F5F30 /* Pods-ChatSecureCore-acknowledgements.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Pods-ChatSecureCore-acknowledgements.plist"; path = "Pods/Target Support Files/Pods-ChatSecureCore/Pods-ChatSecureCore-acknowledgements.plist"; sourceTree = "<group>"; };
631098B01BD6FED000494A47 /* YapDatabse+ChatSecure.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "YapDatabse+ChatSecure.swift"; sourceTree = "<group>"; };
633104D51A169EC800C17BAE /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
633104D81A169F0E00C17BAE /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -812,8 +812,7 @@
63FABC8D1A410EBF009BF681 /* JSQMessagesCollectionViewCell+ChatSecure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JSQMessagesCollectionViewCell+ChatSecure.m"; sourceTree = "<group>"; };
63FABC8F1A41218E009BF681 /* NSString+ChatSecure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+ChatSecure.h"; sourceTree = "<group>"; };
63FABC901A41218E009BF681 /* NSString+ChatSecure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+ChatSecure.m"; sourceTree = "<group>"; };
954B60A022C05FDE4DCFEF6E /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
B977533C20F88A4A840303F9 /* Pods.beta.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.beta.xcconfig; path = "Pods/Target Support Files/Pods/Pods.beta.xcconfig"; sourceTree = "<group>"; };
9B353F12AE2FDB52438B426D /* Pods_ChatSecureCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ChatSecureCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CCD1F8E85C658C8D3865B584 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D913A56C1B747B62006C5ACD /* Onboarding.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Onboarding.storyboard; path = Interface/Onboarding.storyboard; sourceTree = "<group>"; };
D913A56E1B7481AD006C5ACD /* OTRWelcomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OTRWelcomeViewController.swift; path = Onboarding/OTRWelcomeViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -883,7 +882,7 @@
buildActionMask = 2147483647;
files = (
D9AE3A201BA8CCFE00255537 /* OTRAssets.framework in Frameworks */,
8FE09CE9A16DB3D068D19753 /* Pods.framework in Frameworks */,
EE22362CF225156043E19FA7 /* Pods_ChatSecureCore.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1371,7 +1370,6 @@
6396AF911A169D54009F3E6C = {
isa = PBXGroup;
children = (
63DC0EB21A1ABC3E002C9598 /* Configurations */,
6396AF9C1A169D54009F3E6C /* ChatSecure */,
6396AFB61A169D54009F3E6C /* ChatSecureTests */,
D9227C2B1BA7952100B5E1D0 /* ChatSecureCore */,
Expand Down Expand Up @@ -1529,9 +1527,8 @@
C1E90FC219EFFEE2E8C7EECF /* Pods */ = {
isa = PBXGroup;
children = (
954B60A022C05FDE4DCFEF6E /* Pods.debug.xcconfig */,
154CBBDFA16BDE9C28017B1F /* Pods.release.xcconfig */,
B977533C20F88A4A840303F9 /* Pods.beta.xcconfig */,
63DC0EB21A1ABC3E002C9598 /* Configurations */,
6308D1441CA20762002F5F30 /* Pods-ChatSecureCore-acknowledgements.plist */,
);
name = Pods;
sourceTree = "<group>";
Expand Down Expand Up @@ -1598,6 +1595,7 @@
isa = PBXGroup;
children = (
CCD1F8E85C658C8D3865B584 /* Pods.framework */,
9B353F12AE2FDB52438B426D /* Pods_ChatSecureCore.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -1992,7 +1990,7 @@
D99F178E1BAB9B2100604558 /* OTRResources.bundle in Resources */,
D9227C241BA78E6B00B5E1D0 /* FontAwesome.ttf in Resources */,
6331072C1A16D1F200C17BAE /* Images.xcassets in Resources */,
D973D7061A2D4094004D353E /* Pods-acknowledgements.plist in Resources */,
6308D1451CA20762002F5F30 /* Pods-ChatSecureCore-acknowledgements.plist in Resources */,
D9365E7A1A1EB0050006434A /* torrc in Resources */,
6331072B1A16D1F200C17BAE /* DemoImages.xcassets in Resources */,
633107201A16D1A300C17BAE /* LaunchScreen.xib in Resources */,
Expand Down Expand Up @@ -2081,7 +2079,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ChatSecureCore/Pods-ChatSecureCore-resources.sh\"\n";
showEnvVarsInLog = 0;
};
A60AF14A61B7922CB2D653D0 /* Embed Pods Frameworks */ = {
Expand All @@ -2096,7 +2094,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ChatSecureCore/Pods-ChatSecureCore-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
C51DC9AFCD4F8C0D582CD146 /* Copy Pods Resources */ = {
Expand All @@ -2111,7 +2109,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ChatSecureCore/Pods-ChatSecureCore-resources.sh\"\n";
showEnvVarsInLog = 0;
};
C6209FD4E67B0AE13FA1CE51 /* Check Pods Manifest.lock */ = {
Expand Down Expand Up @@ -2157,7 +2155,6 @@
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
F92CD31427EF6855AC77AF5E /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -2536,7 +2533,7 @@
};
632461561A1AE1C1000EF33B /* Beta */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = B977533C20F88A4A840303F9 /* Pods.beta.xcconfig */;
baseConfigurationReference = 63DC0EB61A1ABC86002C9598 /* OTR_Release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -2685,7 +2682,7 @@
};
6396AFC11A169D54009F3E6C /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 954B60A022C05FDE4DCFEF6E /* Pods.debug.xcconfig */;
baseConfigurationReference = 63DC0EB41A1ABC86002C9598 /* OTR_Debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
Expand All @@ -2711,7 +2708,7 @@
};
6396AFC21A169D54009F3E6C /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 154CBBDFA16BDE9C28017B1F /* Pods.release.xcconfig */;
baseConfigurationReference = 63DC0EB61A1ABC86002C9598 /* OTR_Release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
Expand All @@ -2730,7 +2727,7 @@
};
D9227C411BA7952100B5E1D0 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 954B60A022C05FDE4DCFEF6E /* Pods.debug.xcconfig */;
baseConfigurationReference = 63DC0EB41A1ABC86002C9598 /* OTR_Debug.xcconfig */;
buildSettings = {
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
Expand Down Expand Up @@ -2758,7 +2755,7 @@
};
D9227C421BA7952100B5E1D0 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 154CBBDFA16BDE9C28017B1F /* Pods.release.xcconfig */;
baseConfigurationReference = 63DC0EB61A1ABC86002C9598 /* OTR_Release.xcconfig */;
buildSettings = {
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
Expand Down Expand Up @@ -2786,7 +2783,7 @@
};
D9227C431BA7952100B5E1D0 /* Beta */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = B977533C20F88A4A840303F9 /* Pods.beta.xcconfig */;
baseConfigurationReference = 63DC0EB61A1ABC86002C9598 /* OTR_Release.xcconfig */;
buildSettings = {
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
Expand Down Expand Up @@ -2814,6 +2811,7 @@
};
D93027591BAA381F000CC975 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 63DC0EB41A1ABC86002C9598 /* OTR_Debug.xcconfig */;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
Expand All @@ -2831,6 +2829,7 @@
};
D930275A1BAA381F000CC975 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 63DC0EB61A1ABC86002C9598 /* OTR_Release.xcconfig */;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
Expand All @@ -2849,6 +2848,7 @@
};
D930275B1BAA381F000CC975 /* Beta */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 63DC0EB61A1ABC86002C9598 /* OTR_Release.xcconfig */;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
Expand All @@ -2867,6 +2867,7 @@
};
D9AE3A181BA8CBFA00255537 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 63DC0EB41A1ABC86002C9598 /* OTR_Debug.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -2892,6 +2893,7 @@
};
D9AE3A191BA8CBFA00255537 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 63DC0EB61A1ABC86002C9598 /* OTR_Release.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -2918,6 +2920,7 @@
};
D9AE3A1A1BA8CBFA00255537 /* Beta */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 63DC0EB61A1ABC86002C9598 /* OTR_Release.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand Down
30 changes: 26 additions & 4 deletions ChatSecure/Classes/Views/OTRLockButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

#import "OTRLockButton.h"
#import "UIControl+JTTargetActionBlock.h"
@import OTRAssets;

static NSString *const kOTRLockImageName = @"Lock_Locked";
Expand All @@ -16,6 +15,13 @@
static NSString *const kOTRLockedAndWarnImageName = @"Lock_Locked_yellow";
static NSString *const kOTRUnlockImageName = @"Lock_Unlocked";

typedef void (^ButtonBlock)(id sender);

@interface OTRLockButton ()

@property (nonatomic, strong) ButtonBlock blockAction;

@end


@implementation OTRLockButton
Expand Down Expand Up @@ -58,20 +64,36 @@ - (void)setLockStatus:(OTRLockStatus)lockStatus
[self didChangeValueForKey:NSStringFromSelector(@selector(lockStatus))];
}

#pragma - MARK block handler

-(void) handleControlEvent:(UIControlEvents)event
withBlock:(ButtonBlock) block
{
self.blockAction = block;
[self addTarget:self action:@selector(callBlock:) forControlEvents:event];
}

-(void) callBlock:(id)sender{
if (self.blockAction) {
self.blockAction(sender);
}
}

+(instancetype)lockButtonWithInitailLockStatus:(OTRLockStatus)lockStatus withBlock:(void(^)(OTRLockStatus currentStatus))block
{
OTRLockButton * lockButton = [self buttonWithType:UIButtonTypeCustom];
lockButton.lockStatus = lockStatus;
[lockButton addEventHandler:^(id sender, UIEvent *event) {

[lockButton handleControlEvent:UIControlEventTouchUpInside withBlock:^(id sender) {
if (block) {
OTRLockStatus status = OTRLockStatusUnknown;
if ([sender isKindOfClass:[OTRLockButton class]]) {
status = ((OTRLockButton *)sender).lockStatus;
}

block(status);
}
} forControlEvent:UIControlEventTouchUpInside];
}];
return lockButton;
}
@end
Loading

0 comments on commit d5c85c2

Please sign in to comment.