Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with iOS 8 #42

Merged
merged 2 commits into from
Oct 10, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions IntentKit/Core/INKActivityViewController/INKActivityCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ - (void)updateConstraints {
self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
}

+ (BOOL)requiresConstraintBasedLayout {
return YES;
}

- (void)layoutSubviews {
[super layoutSubviews];

Expand Down
46 changes: 37 additions & 9 deletions IntentKit/Core/INKActivityViewController/INKActivityPresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ @interface INKActivityPresenter ()
@property (assign, nonatomic) UIModalPresentationStyle originalPresentingModalPresentationStyle;
@property (assign, nonatomic) UIModalPresentationStyle originalRootModalPresentationStyle;

@property (assign, nonatomic) BOOL originalRootProvidesPresentationContextTransitionStyle;
@property (assign, nonatomic) BOOL originalRootDefinesPresentationContext;

@property (copy, nonatomic) void (^completionBlock)();

@end
Expand Down Expand Up @@ -67,27 +70,46 @@ - (void)presentModalActivitySheetFromViewController:(UIViewController *)presenti
if (self.activity) {
[self.activity performActivityInViewController:presentingViewController];
} else if (self.activitySheet) {
self.originalRootModalPresentationStyle = UIApplication.sharedApplication.keyWindow.rootViewController.modalPresentationStyle;
UIApplication.sharedApplication.keyWindow.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;

self.presentingViewController = presentingViewController;

self.shadeView = [[UIView alloc] initWithFrame:self.presentingViewController.view.bounds];
self.shadeView.backgroundColor = [UIColor blackColor];
[self.presentingViewController.view addSubview:self.shadeView];

self.originalPresentingModalPresentationStyle = presentingViewController.modalPresentationStyle;
presentingViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
[presentingViewController presentViewController:self.activitySheet animated:NO completion:nil];
BOOL isiOS8OrSuperior = [[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0f;

if (!isiOS8OrSuperior) {
self.originalRootModalPresentationStyle = UIApplication.sharedApplication.keyWindow.rootViewController.modalPresentationStyle;
UIApplication.sharedApplication.keyWindow.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;

self.originalPresentingModalPresentationStyle = presentingViewController.modalPresentationStyle;
presentingViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
}
else {
self.originalRootProvidesPresentationContextTransitionStyle = UIApplication.sharedApplication.keyWindow.rootViewController.providesPresentationContextTransitionStyle;
self.originalRootDefinesPresentationContext = UIApplication.sharedApplication.keyWindow.rootViewController.definesPresentationContext;

UIApplication.sharedApplication.keyWindow.rootViewController.providesPresentationContextTransitionStyle = YES;
UIApplication.sharedApplication.keyWindow.rootViewController.definesPresentationContext = YES;
[self.activitySheet setModalPresentationStyle:UIModalPresentationOverCurrentContext];
}

[presentingViewController presentViewController:self.activitySheet animated:isiOS8OrSuperior completion:nil];

self.shadeView.alpha = 0;
CGPoint activitySheetOrigin = self.activitySheet.contentView.frame.origin;
[self.activitySheet.contentView moveToPoint:CGPointMake(self.presentingViewController.view.left, self.presentingViewController.view.bottom)];
if (!isiOS8OrSuperior) {
[self.activitySheet.contentView moveToPoint:CGPointMake(self.presentingViewController.view.left, self.presentingViewController.view.bottom)];
}

[UIView animateWithDuration:0.3f delay:0 options:UIViewAnimationOptionCurveEaseInOut animations: ^{
self.shadeView.alpha = 0.4;
[self.activitySheet.contentView moveToPoint:activitySheetOrigin];
if (!isiOS8OrSuperior) {
[self.activitySheet.contentView moveToPoint:activitySheetOrigin];
}
} completion:nil];
}
}
}

- (void)presentActivitySheetFromViewController:(UIViewController *)presentingViewController popoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated completion:(void (^)())completion {
Expand Down Expand Up @@ -139,6 +161,12 @@ - (void)dismissActivitySheetAnimated:(BOOL)animated {
if (self.originalRootModalPresentationStyle != -1) {
UIApplication.sharedApplication.keyWindow.rootViewController.modalPresentationStyle = self.originalRootModalPresentationStyle;
}

BOOL isiOS8OrSuperior = [[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0f;
if (isiOS8OrSuperior) {
UIApplication.sharedApplication.keyWindow.rootViewController.providesPresentationContextTransitionStyle = self.originalRootProvidesPresentationContextTransitionStyle;
UIApplication.sharedApplication.keyWindow.rootViewController.definesPresentationContext = self.originalRootDefinesPresentationContext;
}

[self.presentingViewController dismissViewControllerAnimated:NO completion:nil];

Expand Down
4 changes: 4 additions & 0 deletions IntentKit/Core/INKDefaultToggleView.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ - (void)updateConstraints {
}
}

+ (BOOL)requiresConstraintBasedLayout {
return YES;
}

#pragma mark - Event handlers
- (void)didTapTextLabel {
[self.toggle setOn:!self.toggle.isOn animated:YES];
Expand Down
33 changes: 22 additions & 11 deletions IntentKitDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@

/* Begin PBXFileReference section */
0CFB950D1860E110006BB1EC /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; };
17EA3B95307C4A4A8B304C44 /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = "<group>"; };
4D175A3D31E9461F80754612 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
7CB1A92AD90442B2ADE581B1 /* Pods-IntentKitTests.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IntentKitTests.xcconfig"; path = "Pods/Pods-IntentKitTests.xcconfig"; sourceTree = "<group>"; };
A605C31718623D0F007E6AFE /* INKDefaultsManagerSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = INKDefaultsManagerSpec.m; sourceTree = "<group>"; };
A6170A6818543FFA0086AC63 /* INKHandlerSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = INKHandlerSpec.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
A61B5CBC18579B2100BA1F66 /* INKActivityPresenterSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = INKActivityPresenterSpec.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
Expand All @@ -81,6 +79,7 @@
A67F39D8184EDFE5002EED53 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
A67F39D9184EDFE5002EED53 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
A67F39DA184EDFE5002EED53 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
A693CC7DFE3240DB77220442 /* 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>"; };
A6942BB21905F58E00977692 /* INKTweetSheetSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = INKTweetSheetSpec.m; path = INKPresentables/INKTweetSheetSpec.m; sourceTree = "<group>"; };
A6A16CC81851375000778944 /* IntentKit.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IntentKit.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
A6B73C63184D341E0055C60D /* IntentKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IntentKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -109,6 +108,9 @@
A6E7675C18FDF85100749E0A /* INKMailSheetSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = INKMailSheetSpec.m; path = INKPresentables/INKMailSheetSpec.m; sourceTree = "<group>"; };
A6E7675F18FDF98100749E0A /* UIViewController+Spec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIViewController+Spec.h"; path = "Helpers/UIViewController+Spec.h"; sourceTree = "<group>"; };
A6E7676018FDF98100749E0A /* UIViewController+Spec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIViewController+Spec.m"; path = "Helpers/UIViewController+Spec.m"; sourceTree = "<group>"; };
ADA03402BC031023D51599B3 /* Pods-IntentKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IntentKitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-IntentKitTests/Pods-IntentKitTests.debug.xcconfig"; sourceTree = "<group>"; };
C6AAA3836BF05FC4A2C0A07D /* 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>"; };
E10F6DFA474458AD1A88B38E /* Pods-IntentKitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IntentKitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-IntentKitTests/Pods-IntentKitTests.release.xcconfig"; sourceTree = "<group>"; };
E19E678BCBB9409FBE1FDD1D /* libPods-IntentKitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-IntentKitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -174,8 +176,7 @@
A6B73CDB184D38450055C60D /* IntentKitDemo */,
A6B73C65184D341E0055C60D /* Frameworks */,
A6B73C64184D341E0055C60D /* Products */,
7CB1A92AD90442B2ADE581B1 /* Pods-IntentKitTests.xcconfig */,
17EA3B95307C4A4A8B304C44 /* Pods.xcconfig */,
BDBBCC19F730F981E3685F49 /* Pods */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -264,6 +265,17 @@
name = Helpers;
sourceTree = "<group>";
};
BDBBCC19F730F981E3685F49 /* Pods */ = {
isa = PBXGroup;
children = (
A693CC7DFE3240DB77220442 /* Pods.debug.xcconfig */,
C6AAA3836BF05FC4A2C0A07D /* Pods.release.xcconfig */,
ADA03402BC031023D51599B3 /* Pods-IntentKitTests.debug.xcconfig */,
E10F6DFA474458AD1A88B38E /* Pods-IntentKitTests.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -393,7 +405,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
showEnvVarsInLog = 0;
};
51B52ECD75E547B2B61EFA91 /* Copy Pods Resources */ = {
Expand All @@ -408,7 +420,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Pods-IntentKitTests-resources.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-IntentKitTests/Pods-IntentKitTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
8B19D2BFC4234EA5B2770355 /* Check Pods Manifest.lock */ = {
Expand Down Expand Up @@ -539,7 +551,6 @@
/* Begin XCBuildConfiguration section */
A6A16CD21851375000778944 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 17EA3B95307C4A4A8B304C44 /* Pods.xcconfig */;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -659,7 +670,7 @@
};
A6B73C90184D341E0055C60D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 17EA3B95307C4A4A8B304C44 /* Pods.xcconfig */;
baseConfigurationReference = A693CC7DFE3240DB77220442 /* Pods.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
Expand All @@ -677,7 +688,7 @@
};
A6B73C91184D341E0055C60D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 17EA3B95307C4A4A8B304C44 /* Pods.xcconfig */;
baseConfigurationReference = C6AAA3836BF05FC4A2C0A07D /* Pods.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
Expand All @@ -695,7 +706,7 @@
};
A6B73C93184D341E0055C60D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7CB1A92AD90442B2ADE581B1 /* Pods-IntentKitTests.xcconfig */;
baseConfigurationReference = ADA03402BC031023D51599B3 /* Pods-IntentKitTests.debug.xcconfig */;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/IntentKitDemo.app/IntentKitDemo";
Expand All @@ -719,7 +730,7 @@
};
A6B73C94184D341E0055C60D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7CB1A92AD90442B2ADE581B1 /* Pods-IntentKitTests.xcconfig */;
baseConfigurationReference = E10F6DFA474458AD1A88B38E /* Pods-IntentKitTests.release.xcconfig */;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/IntentKitDemo.app/IntentKitDemo";
Expand Down
47 changes: 26 additions & 21 deletions IntentKitDemo/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,53 @@
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
Expand Down
51 changes: 36 additions & 15 deletions IntentKitDemo/Images.xcassets/LaunchImage.launchimage/Contents.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,66 @@
{
"images" : [
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "Default-736h@3x.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"idiom" : "ipad",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "667h",
"filename" : "Default-667h@2x.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "retina4",
"filename" : "Default-568h@2x.png",
"minimum-system-version" : "7.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "landscape",
"orientation" : "portrait",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"minimum-system-version" : "7.0",
"scale" : "2x"
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"subtype" : "retina4",
"scale" : "2x"
},
{
"orientation" : "portrait",
"orientation" : "landscape",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "1x"
"minimum-system-version" : "7.0",
"scale" : "2x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions IntentKitDemo/Images.xcassets/settings.imageset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"idiom" : "universal",
"scale" : "2x",
"filename" : "740-gear@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
Expand Down