Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble-iphoneos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorMikkel Krautz <mikkel@krautz.dk>2014-03-12 01:56:10 +0400
committerMikkel Krautz <mikkel@krautz.dk>2014-03-12 01:56:10 +0400
commitff44158da84056812b147c7b90ed1468e3371071 (patch)
tree08014670011f6c20d08d5a15f25dab8a9998066c /Source
parente3ec9d9febada1f4cfdee3caa2d53ca5d697022a (diff)
MUConnectionController, MUHorizontalFlipTransitionDelegate: fix horizontal flip transition on iOS 7.
Diffstat (limited to 'Source')
-rw-r--r--Source/Classes/MUConnectionController.m16
-rw-r--r--Source/Classes/MUHorizontalFlipTransitionDelegate.h6
-rw-r--r--Source/Classes/MUHorizontalFlipTransitionDelegate.m46
3 files changed, 66 insertions, 2 deletions
diff --git a/Source/Classes/MUConnectionController.m b/Source/Classes/MUConnectionController.m
index 94fafb1..3a292a5 100644
--- a/Source/Classes/MUConnectionController.m
+++ b/Source/Classes/MUConnectionController.m
@@ -8,6 +8,8 @@
#import "MUCertificateController.h"
#import "MUCertificateChainBuilder.h"
#import "MUDatabase.h"
+#import "MUOperatingSystem.h"
+#import "MUHorizontalFlipTransitionDelegate.h"
#import <MumbleKit/MKConnection.h>
#import <MumbleKit/MKServerModel.h>
@@ -32,6 +34,8 @@ NSString *MUConnectionClosedNotification = @"MUConnectionClosedNotification";
NSUInteger _port;
NSString *_username;
NSString *_password;
+
+ id _transitioningDelegate;
}
- (void) establishConnection;
- (void) teardownConnection;
@@ -52,13 +56,17 @@ NSString *MUConnectionClosedNotification = @"MUConnectionClosedNotification";
- (id) init {
if ((self = [super init])) {
- // ...
+ if (MUGetOperatingSystemVersion() >= MUMBLE_OS_IOS_7) {
+ _transitioningDelegate = [[MUHorizontalFlipTransitionDelegate alloc] init];
+ }
}
return self;
}
- (void) dealloc {
[super dealloc];
+
+ [_transitioningDelegate release];
}
- (void) connetToHostname:(NSString *)hostName port:(NSUInteger)port withUsername:(NSString *)userName andPassword:(NSString *)password withParentViewController:(UIViewController *)parentViewController {
@@ -373,7 +381,11 @@ NSString *MUConnectionClosedNotification = @"MUConnectionClosedNotification";
_password = nil;
if ([[UIDevice currentDevice] userInterfaceIdiom] != UIUserInterfaceIdiomPad) {
- [_serverRoot setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
+ if (MUGetOperatingSystemVersion() >= MUMBLE_OS_IOS_7) {
+ [_serverRoot setTransitioningDelegate:_transitioningDelegate];
+ } else {
+ [_serverRoot setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
+ }
}
[_parentViewController presentModalViewController:_serverRoot animated:YES];
diff --git a/Source/Classes/MUHorizontalFlipTransitionDelegate.h b/Source/Classes/MUHorizontalFlipTransitionDelegate.h
new file mode 100644
index 0000000..6414db4
--- /dev/null
+++ b/Source/Classes/MUHorizontalFlipTransitionDelegate.h
@@ -0,0 +1,6 @@
+// Copyright 2014 The 'Mumble for iOS' Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+@interface MUHorizontalFlipTransitionDelegate : NSObject <UIViewControllerTransitioningDelegate>
+@end
diff --git a/Source/Classes/MUHorizontalFlipTransitionDelegate.m b/Source/Classes/MUHorizontalFlipTransitionDelegate.m
new file mode 100644
index 0000000..a2fc84a
--- /dev/null
+++ b/Source/Classes/MUHorizontalFlipTransitionDelegate.m
@@ -0,0 +1,46 @@
+// Copyright 2014 The 'Mumble for iOS' Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#import "MUHorizontalFlipTransitionDelegate.h"
+
+@implementation MUHorizontalFlipTransitionDelegate
+
+- (id<UIViewControllerAnimatedTransitioning>) animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
+ return (id<UIViewControllerAnimatedTransitioning>) self;
+}
+
+- (id<UIViewControllerAnimatedTransitioning>) animationControllerForDismissedController:(UIViewController *)dismissed {
+ return (id<UIViewControllerAnimatedTransitioning>)self;
+}
+
+- (NSTimeInterval) transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext {
+ return 0.7f;
+}
+
+- (void) animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
+ UIView *containerView = [transitionContext containerView];
+
+ UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
+ [containerView addSubview:fromViewController.view];
+
+ UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
+ [containerView addSubview:toViewController.view];
+
+ UIViewAnimationOptions animationOption;
+ if ([toViewController.presentedViewController isEqual:fromViewController]) {
+ animationOption = UIViewAnimationOptionTransitionFlipFromLeft;
+ } else {
+ animationOption = UIViewAnimationOptionTransitionFlipFromRight;
+ }
+
+ [UIView transitionFromView:fromViewController.view
+ toView:toViewController.view
+ duration:[self transitionDuration:transitionContext]
+ options:animationOption
+ completion:^(BOOL finished) {
+ [transitionContext completeTransition:YES];
+ }];
+}
+
+@end