Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update Scheduler references with Runtime.
Reviewers: O2 Material Motion, appsforartists, O4 Material Motion Apple platform reviewers, markwei

Reviewed By: O2 Material Motion, appsforartists, O4 Material Motion Apple platform reviewers, markwei

Tags: #material_motion

Differential Revision: http://codereview.cc/D1828
  • Loading branch information
jverkoey committed Nov 2, 2016
1 parent 8c83bc2 commit 34d599e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Podfile.lock
Expand Up @@ -19,7 +19,7 @@ EXTERNAL SOURCES:

CHECKOUT OPTIONS:
MaterialMotionRuntime:
:commit: c0bd1afa20b33f441d2677af5ada6df33790e7c0
:commit: 1faad0f00a6cd9dfce951cdcc3fc4d1a86e76cd3
:git: https://github.com/material-motion/material-motion-runtime-objc.git

SPEC CHECKSUMS:
Expand Down
2 changes: 1 addition & 1 deletion examples/FadeInTransitionDirector.swift
Expand Up @@ -34,6 +34,6 @@ class FadeInTransitionDirector: NSObject, TransitionDirector {
animation.from = NSNumber(value: 1)
animation.to = NSNumber(value: 0)
}
transition.scheduler.addPlan(animation, to: transition.foreViewController.view)
transition.runtime.addPlan(animation, to: transition.foreViewController.view)
}
}
4 changes: 2 additions & 2 deletions src/MDMTransition.h
Expand Up @@ -25,8 +25,8 @@ NS_SWIFT_NAME(Transition)

#pragma mark Scheduler

/** The scheduler for this transition. */
@property(nonatomic, strong, nonnull, readonly) NSObject<MDMScheduling> *scheduler;
/** The runtime for this transition. */
@property(nonatomic, strong, nonnull, readonly) NSObject<MDMRuntimeFeatures> *runtime;

#pragma mark Time window

Expand Down
22 changes: 11 additions & 11 deletions src/MDMTransition.m
Expand Up @@ -21,9 +21,9 @@

const NSTimeInterval MDMTransitionDirectorTransitionDurationDefault = 0.3;

@interface MDMTransition () <MDMSchedulerDelegate>
@interface MDMTransition () <MDMRuntimeDelegate>

@property(nonatomic, strong) MDMScheduler *scheduler;
@property(nonatomic, strong) MDMRuntime *runtime;
@property(nonatomic, strong) id<MDMTransitionDirector> director;
@property(nonatomic, strong) id<UIViewControllerContextTransitioning> transitionContext;

Expand All @@ -49,8 +49,8 @@ - (instancetype)initWithDirectorClass:(Class)directorClass
_backViewController = backViewController;
_foreViewController = foreViewController;

_scheduler = [MDMScheduler new];
_scheduler.delegate = self;
_runtime = [MDMRuntime new];
_runtime.delegate = self;
}
return self;
}
Expand All @@ -76,9 +76,9 @@ - (void)animationEnded:(BOOL)transitionCompleted {

#pragma mark - MDMSchedulerDelegate

- (void)schedulerActivityStateDidChange:(MDMScheduler *)scheduler {
if (scheduler.activityState == MDMSchedulerActivityStateIdle) {
[self schedulerDidIdle];
- (void)runtimeActivityStateDidChange:(MDMRuntime *)runtime {
if (runtime.activityState == MDMRuntimeActivityStateIdle) {
[self runtimeDidIdle];
}
}

Expand Down Expand Up @@ -114,12 +114,12 @@ - (void)initiateTransition {

[self.director setUp];

if (self.scheduler.activityState == MDMSchedulerActivityStateIdle) {
[self schedulerDidIdle];
if (self.runtime.activityState == MDMRuntimeActivityStateIdle) {
[self runtimeDidIdle];
}
}

- (void)schedulerDidIdle {
- (void)runtimeDidIdle {
BOOL completedInOriginalDirection = self.window.currentDirection == self.window.initialDirection;
// UIKit container view controllers will replay their transition animation if the transition
// percentage is exactly 0 or 1, so we fake being super close to these values in order to avoid
Expand All @@ -138,7 +138,7 @@ - (void)schedulerDidIdle {
// Ultimately calls -animationEnded:
[self.transitionContext completeTransition:completedInOriginalDirection];

self.scheduler = nil;
self.runtime = nil;
self.director = nil;

[self.delegate transitionDidComplete:self];
Expand Down

0 comments on commit 34d599e

Please sign in to comment.